0089-Add-2709-platform-for-Raspberry-Pi-2.patch 279 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188318931903191319231933194319531963197319831993200320132023203320432053206320732083209321032113212321332143215321632173218321932203221322232233224322532263227322832293230323132323233323432353236323732383239324032413242324332443245324632473248324932503251325232533254325532563257325832593260326132623263326432653266326732683269327032713272327332743275327632773278327932803281328232833284328532863287328832893290329132923293329432953296329732983299330033013302330333043305330633073308330933103311331233133314331533163317331833193320332133223323332433253326332733283329333033313332333333343335333633373338333933403341334233433344334533463347334833493350335133523353335433553356335733583359336033613362336333643365336633673368336933703371337233733374337533763377337833793380338133823383338433853386338733883389339033913392339333943395339633973398339934003401340234033404340534063407340834093410341134123413341434153416341734183419342034213422342334243425342634273428342934303431343234333434343534363437343834393440344134423443344434453446344734483449345034513452345334543455345634573458345934603461346234633464346534663467346834693470347134723473347434753476347734783479348034813482348334843485348634873488348934903491349234933494349534963497349834993500350135023503350435053506350735083509351035113512351335143515351635173518351935203521352235233524352535263527352835293530353135323533353435353536353735383539354035413542354335443545354635473548354935503551355235533554355535563557355835593560356135623563356435653566356735683569357035713572357335743575357635773578357935803581358235833584358535863587358835893590359135923593359435953596359735983599360036013602360336043605360636073608360936103611361236133614361536163617361836193620362136223623362436253626362736283629363036313632363336343635363636373638363936403641364236433644364536463647364836493650365136523653365436553656365736583659366036613662366336643665366636673668366936703671367236733674367536763677367836793680368136823683368436853686368736883689369036913692369336943695369636973698369937003701370237033704370537063707370837093710371137123713371437153716371737183719372037213722372337243725372637273728372937303731373237333734373537363737373837393740374137423743374437453746374737483749375037513752375337543755375637573758375937603761376237633764376537663767376837693770377137723773377437753776377737783779378037813782378337843785378637873788378937903791379237933794379537963797379837993800380138023803380438053806380738083809381038113812381338143815381638173818381938203821382238233824382538263827382838293830383138323833383438353836383738383839384038413842384338443845384638473848384938503851385238533854385538563857385838593860386138623863386438653866386738683869387038713872387338743875387638773878387938803881388238833884388538863887388838893890389138923893389438953896389738983899390039013902390339043905390639073908390939103911391239133914391539163917391839193920392139223923392439253926392739283929393039313932393339343935393639373938393939403941394239433944394539463947394839493950395139523953395439553956395739583959396039613962396339643965396639673968396939703971397239733974397539763977397839793980398139823983398439853986398739883989399039913992399339943995399639973998399940004001400240034004400540064007400840094010401140124013401440154016401740184019402040214022402340244025402640274028402940304031403240334034403540364037403840394040404140424043404440454046404740484049405040514052405340544055405640574058405940604061406240634064406540664067406840694070407140724073407440754076407740784079408040814082408340844085408640874088408940904091409240934094409540964097409840994100410141024103410441054106410741084109411041114112411341144115411641174118411941204121412241234124412541264127412841294130413141324133413441354136413741384139414041414142414341444145414641474148414941504151415241534154415541564157415841594160416141624163416441654166416741684169417041714172417341744175417641774178417941804181418241834184418541864187418841894190419141924193419441954196419741984199420042014202420342044205420642074208420942104211421242134214421542164217421842194220422142224223422442254226422742284229423042314232423342344235423642374238423942404241424242434244424542464247424842494250425142524253425442554256425742584259426042614262426342644265426642674268426942704271427242734274427542764277427842794280428142824283428442854286428742884289429042914292429342944295429642974298429943004301430243034304430543064307430843094310431143124313431443154316431743184319432043214322432343244325432643274328432943304331433243334334433543364337433843394340434143424343434443454346434743484349435043514352435343544355435643574358435943604361436243634364436543664367436843694370437143724373437443754376437743784379438043814382438343844385438643874388438943904391439243934394439543964397439843994400440144024403440444054406440744084409441044114412441344144415441644174418441944204421442244234424442544264427442844294430443144324433443444354436443744384439444044414442444344444445444644474448444944504451445244534454445544564457445844594460446144624463446444654466446744684469447044714472447344744475447644774478447944804481448244834484448544864487448844894490449144924493449444954496449744984499450045014502450345044505450645074508450945104511451245134514451545164517451845194520452145224523452445254526452745284529453045314532453345344535453645374538453945404541454245434544454545464547454845494550455145524553455445554556455745584559456045614562456345644565456645674568456945704571457245734574457545764577457845794580458145824583458445854586458745884589459045914592459345944595459645974598459946004601460246034604460546064607460846094610461146124613461446154616461746184619462046214622462346244625462646274628462946304631463246334634463546364637463846394640464146424643464446454646464746484649465046514652465346544655465646574658465946604661466246634664466546664667466846694670467146724673467446754676467746784679468046814682468346844685468646874688468946904691469246934694469546964697469846994700470147024703470447054706470747084709471047114712471347144715471647174718471947204721472247234724472547264727472847294730473147324733473447354736473747384739474047414742474347444745474647474748474947504751475247534754475547564757475847594760476147624763476447654766476747684769477047714772477347744775477647774778477947804781478247834784478547864787478847894790479147924793479447954796479747984799480048014802480348044805480648074808480948104811481248134814481548164817481848194820482148224823482448254826482748284829483048314832483348344835483648374838483948404841484248434844484548464847484848494850485148524853485448554856485748584859486048614862486348644865486648674868486948704871487248734874487548764877487848794880488148824883488448854886488748884889489048914892489348944895489648974898489949004901490249034904490549064907490849094910491149124913491449154916491749184919492049214922492349244925492649274928492949304931493249334934493549364937493849394940494149424943494449454946494749484949495049514952495349544955495649574958495949604961496249634964496549664967496849694970497149724973497449754976497749784979498049814982498349844985498649874988498949904991499249934994499549964997499849995000500150025003500450055006500750085009501050115012501350145015501650175018501950205021502250235024502550265027502850295030503150325033503450355036503750385039504050415042504350445045504650475048504950505051505250535054505550565057505850595060506150625063506450655066506750685069507050715072507350745075507650775078507950805081508250835084508550865087508850895090509150925093509450955096509750985099510051015102510351045105510651075108510951105111511251135114511551165117511851195120512151225123512451255126512751285129513051315132513351345135513651375138513951405141514251435144514551465147514851495150515151525153515451555156515751585159516051615162516351645165516651675168516951705171517251735174517551765177517851795180518151825183518451855186518751885189519051915192519351945195519651975198519952005201520252035204520552065207520852095210521152125213521452155216521752185219522052215222522352245225522652275228522952305231523252335234523552365237523852395240524152425243524452455246524752485249525052515252525352545255525652575258525952605261526252635264526552665267526852695270527152725273527452755276527752785279528052815282528352845285528652875288528952905291529252935294529552965297529852995300530153025303530453055306530753085309531053115312531353145315531653175318531953205321532253235324532553265327532853295330533153325333533453355336533753385339534053415342534353445345534653475348534953505351535253535354535553565357535853595360536153625363536453655366536753685369537053715372537353745375537653775378537953805381538253835384538553865387538853895390539153925393539453955396539753985399540054015402540354045405540654075408540954105411541254135414541554165417541854195420542154225423542454255426542754285429543054315432543354345435543654375438543954405441544254435444544554465447544854495450545154525453545454555456545754585459546054615462546354645465546654675468546954705471547254735474547554765477547854795480548154825483548454855486548754885489549054915492549354945495549654975498549955005501550255035504550555065507550855095510551155125513551455155516551755185519552055215522552355245525552655275528552955305531553255335534553555365537553855395540554155425543554455455546554755485549555055515552555355545555555655575558555955605561556255635564556555665567556855695570557155725573557455755576557755785579558055815582558355845585558655875588558955905591559255935594559555965597559855995600560156025603560456055606560756085609561056115612561356145615561656175618561956205621562256235624562556265627562856295630563156325633563456355636563756385639564056415642564356445645564656475648564956505651565256535654565556565657565856595660566156625663566456655666566756685669567056715672567356745675567656775678567956805681568256835684568556865687568856895690569156925693569456955696569756985699570057015702570357045705570657075708570957105711571257135714571557165717571857195720572157225723572457255726572757285729573057315732573357345735573657375738573957405741574257435744574557465747574857495750575157525753575457555756575757585759576057615762576357645765576657675768576957705771577257735774577557765777577857795780578157825783578457855786578757885789579057915792579357945795579657975798579958005801580258035804580558065807580858095810581158125813581458155816581758185819582058215822582358245825582658275828582958305831583258335834583558365837583858395840584158425843584458455846584758485849585058515852585358545855585658575858585958605861586258635864586558665867586858695870587158725873587458755876587758785879588058815882588358845885588658875888588958905891589258935894589558965897589858995900590159025903590459055906590759085909591059115912591359145915591659175918591959205921592259235924592559265927592859295930593159325933593459355936593759385939594059415942594359445945594659475948594959505951595259535954595559565957595859595960596159625963596459655966596759685969597059715972597359745975597659775978597959805981598259835984598559865987598859895990599159925993599459955996599759985999600060016002600360046005600660076008600960106011601260136014601560166017601860196020602160226023602460256026602760286029603060316032603360346035603660376038603960406041604260436044604560466047604860496050605160526053605460556056605760586059606060616062606360646065606660676068606960706071607260736074607560766077607860796080608160826083608460856086608760886089609060916092609360946095609660976098609961006101610261036104610561066107610861096110611161126113611461156116611761186119612061216122612361246125612661276128612961306131613261336134613561366137613861396140614161426143614461456146614761486149615061516152615361546155615661576158615961606161616261636164616561666167616861696170617161726173617461756176617761786179618061816182618361846185618661876188618961906191619261936194619561966197619861996200620162026203620462056206620762086209621062116212621362146215621662176218621962206221622262236224622562266227622862296230623162326233623462356236623762386239624062416242624362446245624662476248624962506251625262536254625562566257625862596260626162626263626462656266626762686269627062716272627362746275627662776278627962806281628262836284628562866287628862896290629162926293629462956296629762986299630063016302630363046305630663076308630963106311631263136314631563166317631863196320632163226323632463256326632763286329633063316332633363346335633663376338633963406341634263436344634563466347634863496350635163526353635463556356635763586359636063616362636363646365636663676368636963706371637263736374637563766377637863796380638163826383638463856386638763886389639063916392639363946395639663976398639964006401640264036404640564066407640864096410641164126413641464156416641764186419642064216422642364246425642664276428642964306431643264336434643564366437643864396440644164426443644464456446644764486449645064516452645364546455645664576458645964606461646264636464646564666467646864696470647164726473647464756476647764786479648064816482648364846485648664876488648964906491649264936494649564966497649864996500650165026503650465056506650765086509651065116512651365146515651665176518651965206521652265236524652565266527652865296530653165326533653465356536653765386539654065416542654365446545654665476548654965506551655265536554655565566557655865596560656165626563656465656566656765686569657065716572657365746575657665776578657965806581658265836584658565866587658865896590659165926593659465956596659765986599660066016602660366046605660666076608660966106611661266136614661566166617661866196620662166226623662466256626662766286629663066316632663366346635663666376638663966406641664266436644664566466647664866496650665166526653665466556656665766586659666066616662666366646665666666676668666966706671667266736674667566766677667866796680668166826683668466856686668766886689669066916692669366946695669666976698669967006701670267036704670567066707670867096710671167126713671467156716671767186719672067216722672367246725672667276728672967306731673267336734673567366737673867396740674167426743674467456746674767486749675067516752675367546755675667576758675967606761676267636764676567666767676867696770677167726773677467756776677767786779678067816782678367846785678667876788678967906791679267936794679567966797679867996800680168026803680468056806680768086809681068116812681368146815681668176818681968206821682268236824682568266827682868296830683168326833683468356836683768386839684068416842684368446845684668476848684968506851685268536854685568566857685868596860686168626863686468656866686768686869687068716872687368746875687668776878687968806881688268836884688568866887688868896890689168926893689468956896689768986899690069016902690369046905690669076908690969106911691269136914691569166917691869196920692169226923692469256926692769286929693069316932693369346935693669376938693969406941694269436944694569466947694869496950695169526953695469556956695769586959696069616962696369646965696669676968696969706971697269736974697569766977697869796980698169826983698469856986698769886989699069916992699369946995699669976998699970007001700270037004700570067007700870097010701170127013701470157016701770187019702070217022702370247025702670277028702970307031703270337034703570367037703870397040704170427043704470457046704770487049705070517052705370547055705670577058705970607061706270637064706570667067706870697070707170727073707470757076707770787079708070817082708370847085708670877088708970907091709270937094709570967097709870997100710171027103710471057106710771087109711071117112711371147115711671177118711971207121712271237124712571267127712871297130713171327133713471357136713771387139714071417142714371447145714671477148714971507151715271537154715571567157715871597160716171627163716471657166716771687169717071717172717371747175717671777178717971807181718271837184718571867187718871897190719171927193719471957196719771987199720072017202720372047205720672077208720972107211721272137214721572167217721872197220722172227223722472257226722772287229723072317232723372347235723672377238723972407241724272437244724572467247724872497250725172527253725472557256725772587259726072617262726372647265726672677268726972707271727272737274727572767277727872797280728172827283728472857286728772887289729072917292729372947295729672977298729973007301730273037304730573067307730873097310731173127313731473157316731773187319732073217322732373247325732673277328732973307331733273337334733573367337733873397340734173427343734473457346734773487349735073517352735373547355735673577358735973607361736273637364736573667367736873697370737173727373737473757376737773787379738073817382738373847385738673877388738973907391739273937394739573967397739873997400740174027403740474057406740774087409741074117412741374147415741674177418741974207421742274237424742574267427742874297430743174327433743474357436743774387439744074417442744374447445744674477448744974507451745274537454745574567457745874597460746174627463746474657466746774687469747074717472747374747475747674777478747974807481748274837484748574867487748874897490749174927493749474957496749774987499750075017502750375047505750675077508750975107511751275137514751575167517751875197520752175227523752475257526752775287529753075317532753375347535753675377538753975407541754275437544754575467547754875497550755175527553755475557556755775587559756075617562756375647565756675677568756975707571757275737574757575767577757875797580758175827583758475857586758775887589759075917592759375947595759675977598759976007601760276037604760576067607760876097610761176127613761476157616761776187619762076217622762376247625762676277628762976307631763276337634763576367637763876397640764176427643764476457646764776487649765076517652765376547655765676577658765976607661766276637664766576667667766876697670767176727673767476757676767776787679768076817682768376847685768676877688768976907691769276937694769576967697769876997700770177027703770477057706770777087709771077117712771377147715771677177718771977207721772277237724772577267727772877297730773177327733773477357736773777387739774077417742774377447745774677477748774977507751775277537754775577567757775877597760776177627763776477657766776777687769777077717772777377747775777677777778777977807781778277837784778577867787778877897790779177927793779477957796779777987799780078017802780378047805780678077808780978107811781278137814781578167817781878197820782178227823782478257826782778287829783078317832783378347835783678377838783978407841784278437844784578467847784878497850785178527853785478557856785778587859786078617862786378647865786678677868786978707871787278737874787578767877787878797880788178827883788478857886788778887889789078917892789378947895789678977898789979007901790279037904790579067907790879097910791179127913791479157916791779187919792079217922792379247925792679277928792979307931793279337934793579367937793879397940794179427943794479457946794779487949795079517952795379547955795679577958795979607961796279637964796579667967796879697970797179727973797479757976797779787979798079817982798379847985798679877988798979907991799279937994799579967997799879998000800180028003800480058006800780088009801080118012801380148015801680178018801980208021802280238024802580268027802880298030803180328033803480358036803780388039804080418042804380448045804680478048804980508051805280538054805580568057805880598060806180628063806480658066806780688069807080718072807380748075807680778078807980808081808280838084808580868087808880898090809180928093809480958096809780988099810081018102810381048105810681078108810981108111811281138114811581168117811881198120812181228123812481258126812781288129813081318132813381348135813681378138813981408141814281438144814581468147814881498150815181528153815481558156815781588159816081618162816381648165816681678168816981708171817281738174817581768177817881798180818181828183818481858186818781888189819081918192819381948195819681978198819982008201820282038204820582068207820882098210821182128213821482158216821782188219822082218222822382248225822682278228822982308231823282338234823582368237823882398240824182428243824482458246824782488249825082518252825382548255825682578258825982608261826282638264826582668267826882698270827182728273827482758276827782788279828082818282828382848285828682878288828982908291829282938294829582968297829882998300830183028303830483058306830783088309831083118312831383148315831683178318831983208321832283238324832583268327832883298330833183328333833483358336833783388339834083418342834383448345834683478348834983508351835283538354835583568357835883598360836183628363836483658366836783688369837083718372837383748375837683778378837983808381838283838384838583868387838883898390839183928393839483958396839783988399840084018402840384048405840684078408840984108411841284138414841584168417841884198420842184228423842484258426842784288429843084318432843384348435843684378438843984408441844284438444844584468447844884498450845184528453845484558456845784588459846084618462846384648465846684678468846984708471847284738474847584768477847884798480848184828483848484858486848784888489849084918492849384948495849684978498849985008501850285038504850585068507850885098510851185128513851485158516851785188519852085218522852385248525852685278528852985308531853285338534853585368537853885398540854185428543854485458546854785488549855085518552855385548555855685578558855985608561856285638564856585668567856885698570857185728573857485758576857785788579858085818582858385848585858685878588858985908591859285938594859585968597859885998600860186028603860486058606860786088609861086118612861386148615861686178618861986208621862286238624862586268627862886298630863186328633863486358636863786388639864086418642864386448645864686478648864986508651865286538654865586568657865886598660866186628663866486658666866786688669867086718672867386748675867686778678867986808681868286838684868586868687868886898690869186928693869486958696869786988699870087018702870387048705870687078708870987108711871287138714871587168717871887198720872187228723872487258726872787288729873087318732873387348735873687378738873987408741874287438744874587468747874887498750875187528753875487558756875787588759876087618762876387648765876687678768876987708771877287738774877587768777877887798780878187828783878487858786878787888789879087918792879387948795879687978798879988008801880288038804880588068807880888098810881188128813881488158816881788188819882088218822882388248825882688278828882988308831883288338834883588368837883888398840884188428843884488458846884788488849885088518852885388548855885688578858885988608861886288638864886588668867886888698870887188728873887488758876887788788879888088818882888388848885888688878888888988908891889288938894889588968897889888998900890189028903890489058906890789088909891089118912891389148915891689178918891989208921892289238924892589268927892889298930893189328933893489358936893789388939894089418942894389448945894689478948894989508951895289538954895589568957895889598960896189628963896489658966896789688969897089718972897389748975897689778978897989808981898289838984898589868987898889898990899189928993899489958996899789988999900090019002900390049005900690079008900990109011901290139014901590169017901890199020902190229023902490259026902790289029903090319032903390349035903690379038903990409041904290439044904590469047904890499050905190529053905490559056905790589059906090619062906390649065906690679068906990709071907290739074907590769077907890799080908190829083908490859086908790889089909090919092909390949095909690979098909991009101910291039104910591069107910891099110911191129113911491159116911791189119912091219122912391249125912691279128912991309131913291339134913591369137913891399140914191429143914491459146914791489149915091519152915391549155915691579158915991609161916291639164916591669167916891699170917191729173917491759176917791789179918091819182918391849185918691879188918991909191919291939194919591969197919891999200920192029203920492059206920792089209921092119212921392149215921692179218921992209221922292239224922592269227922892299230923192329233923492359236923792389239924092419242924392449245924692479248924992509251925292539254925592569257925892599260926192629263926492659266926792689269927092719272927392749275927692779278927992809281928292839284928592869287928892899290929192929293929492959296929792989299930093019302930393049305930693079308930993109311931293139314931593169317931893199320932193229323932493259326932793289329933093319332933393349335933693379338933993409341934293439344934593469347934893499350935193529353935493559356935793589359936093619362936393649365936693679368936993709371937293739374937593769377937893799380938193829383938493859386938793889389939093919392939393949395939693979398939994009401940294039404940594069407940894099410941194129413941494159416941794189419942094219422942394249425942694279428942994309431943294339434943594369437943894399440944194429443944494459446944794489449945094519452945394549455945694579458945994609461946294639464946594669467946894699470
  1. From 08891f5b4dedf2c490371cef6af91f3b7475282d Mon Sep 17 00:00:00 2001
  2. From: popcornmix <popcornmix@gmail.com>
  3. Date: Tue, 7 May 2013 14:32:27 +0100
  4. Subject: [PATCH 089/114] Add 2709 platform for Raspberry Pi 2
  5. ---
  6. arch/arm/Kconfig | 21 +
  7. arch/arm/Makefile | 1 +
  8. arch/arm/boot/dts/Makefile | 11 +-
  9. arch/arm/boot/dts/bcm2709-rpi-2-b.dts | 101 ++
  10. arch/arm/boot/dts/bcm2709.dtsi | 159 +++
  11. arch/arm/configs/bcm2709_defconfig | 1149 ++++++++++++++++++++
  12. arch/arm/configs/bcm2709_sdcard_defconfig | 129 +++
  13. arch/arm/configs/bcm2709_small_defconfig | 61 ++
  14. arch/arm/configs/bcm2835_sdcard_defconfig | 176 +++
  15. arch/arm/configs/bcmrpi_sdcard_defconfig | 176 +++
  16. arch/arm/configs/bcmrpi_small_defconfig | 103 ++
  17. arch/arm/kernel/head.S | 8 +
  18. arch/arm/mach-bcm2709/Kconfig | 49 +
  19. arch/arm/mach-bcm2709/Makefile | 7 +
  20. arch/arm/mach-bcm2709/Makefile.boot | 3 +
  21. arch/arm/mach-bcm2709/armctrl.c | 357 +++++++
  22. arch/arm/mach-bcm2709/armctrl.h | 27 +
  23. arch/arm/mach-bcm2709/bcm2708_gpio.c | 426 ++++++++
  24. arch/arm/mach-bcm2709/bcm2709.c | 1237 ++++++++++++++++++++++
  25. arch/arm/mach-bcm2709/bcm2709.h | 49 +
  26. arch/arm/mach-bcm2709/clock.c | 61 ++
  27. arch/arm/mach-bcm2709/clock.h | 24 +
  28. arch/arm/mach-bcm2709/delay.S | 21 +
  29. arch/arm/mach-bcm2709/dma.c | 409 +++++++
  30. arch/arm/mach-bcm2709/dmaer.c | 886 ++++++++++++++++
  31. arch/arm/mach-bcm2709/include/mach/arm_control.h | 493 +++++++++
  32. arch/arm/mach-bcm2709/include/mach/arm_power.h | 62 ++
  33. arch/arm/mach-bcm2709/include/mach/barriers.h | 3 +
  34. arch/arm/mach-bcm2709/include/mach/clkdev.h | 7 +
  35. arch/arm/mach-bcm2709/include/mach/debug-macro.S | 22 +
  36. arch/arm/mach-bcm2709/include/mach/dma.h | 94 ++
  37. arch/arm/mach-bcm2709/include/mach/entry-macro.S | 123 +++
  38. arch/arm/mach-bcm2709/include/mach/frc.h | 38 +
  39. arch/arm/mach-bcm2709/include/mach/gpio.h | 17 +
  40. arch/arm/mach-bcm2709/include/mach/hardware.h | 28 +
  41. arch/arm/mach-bcm2709/include/mach/io.h | 27 +
  42. arch/arm/mach-bcm2709/include/mach/irqs.h | 225 ++++
  43. arch/arm/mach-bcm2709/include/mach/memory.h | 57 +
  44. arch/arm/mach-bcm2709/include/mach/platform.h | 225 ++++
  45. arch/arm/mach-bcm2709/include/mach/power.h | 26 +
  46. arch/arm/mach-bcm2709/include/mach/system.h | 38 +
  47. arch/arm/mach-bcm2709/include/mach/timex.h | 23 +
  48. arch/arm/mach-bcm2709/include/mach/uncompress.h | 84 ++
  49. arch/arm/mach-bcm2709/include/mach/vc_mem.h | 35 +
  50. arch/arm/mach-bcm2709/include/mach/vc_support.h | 69 ++
  51. arch/arm/mach-bcm2709/include/mach/vcio.h | 165 +++
  52. arch/arm/mach-bcm2709/include/mach/vmalloc.h | 20 +
  53. arch/arm/mach-bcm2709/power.c | 195 ++++
  54. arch/arm/mach-bcm2709/vc_mem.c | 431 ++++++++
  55. arch/arm/mach-bcm2709/vc_support.c | 318 ++++++
  56. arch/arm/mach-bcm2709/vcio.c | 474 +++++++++
  57. arch/arm/mm/proc-v7.S | 1 +
  58. arch/arm/tools/mach-types | 1 +
  59. drivers/char/hw_random/Kconfig | 2 +-
  60. drivers/clocksource/arm_arch_timer.c | 36 +
  61. drivers/dma/Kconfig | 2 +-
  62. drivers/i2c/busses/Kconfig | 4 +-
  63. drivers/media/platform/bcm2835/Kconfig | 2 +-
  64. drivers/misc/vc04_services/Kconfig | 2 +-
  65. drivers/misc/vc04_services/Makefile | 3 -
  66. drivers/mmc/host/Kconfig | 2 +-
  67. drivers/spi/Kconfig | 4 +-
  68. drivers/watchdog/Kconfig | 2 +-
  69. sound/arm/Kconfig | 2 +-
  70. sound/soc/bcm/Kconfig | 2 +-
  71. 65 files changed, 8999 insertions(+), 16 deletions(-)
  72. create mode 100644 arch/arm/boot/dts/bcm2709-rpi-2-b.dts
  73. create mode 100644 arch/arm/boot/dts/bcm2709.dtsi
  74. create mode 100644 arch/arm/configs/bcm2709_defconfig
  75. create mode 100644 arch/arm/configs/bcm2709_sdcard_defconfig
  76. create mode 100644 arch/arm/configs/bcm2709_small_defconfig
  77. create mode 100644 arch/arm/configs/bcm2835_sdcard_defconfig
  78. create mode 100644 arch/arm/configs/bcmrpi_sdcard_defconfig
  79. create mode 100644 arch/arm/configs/bcmrpi_small_defconfig
  80. create mode 100644 arch/arm/mach-bcm2709/Kconfig
  81. create mode 100644 arch/arm/mach-bcm2709/Makefile
  82. create mode 100644 arch/arm/mach-bcm2709/Makefile.boot
  83. create mode 100644 arch/arm/mach-bcm2709/armctrl.c
  84. create mode 100644 arch/arm/mach-bcm2709/armctrl.h
  85. create mode 100644 arch/arm/mach-bcm2709/bcm2708_gpio.c
  86. create mode 100644 arch/arm/mach-bcm2709/bcm2709.c
  87. create mode 100644 arch/arm/mach-bcm2709/bcm2709.h
  88. create mode 100644 arch/arm/mach-bcm2709/clock.c
  89. create mode 100644 arch/arm/mach-bcm2709/clock.h
  90. create mode 100644 arch/arm/mach-bcm2709/delay.S
  91. create mode 100644 arch/arm/mach-bcm2709/dma.c
  92. create mode 100755 arch/arm/mach-bcm2709/dmaer.c
  93. create mode 100644 arch/arm/mach-bcm2709/include/mach/arm_control.h
  94. create mode 100644 arch/arm/mach-bcm2709/include/mach/arm_power.h
  95. create mode 100644 arch/arm/mach-bcm2709/include/mach/barriers.h
  96. create mode 100644 arch/arm/mach-bcm2709/include/mach/clkdev.h
  97. create mode 100644 arch/arm/mach-bcm2709/include/mach/debug-macro.S
  98. create mode 100644 arch/arm/mach-bcm2709/include/mach/dma.h
  99. create mode 100644 arch/arm/mach-bcm2709/include/mach/entry-macro.S
  100. create mode 100644 arch/arm/mach-bcm2709/include/mach/frc.h
  101. create mode 100644 arch/arm/mach-bcm2709/include/mach/gpio.h
  102. create mode 100644 arch/arm/mach-bcm2709/include/mach/hardware.h
  103. create mode 100644 arch/arm/mach-bcm2709/include/mach/io.h
  104. create mode 100644 arch/arm/mach-bcm2709/include/mach/irqs.h
  105. create mode 100644 arch/arm/mach-bcm2709/include/mach/memory.h
  106. create mode 100644 arch/arm/mach-bcm2709/include/mach/platform.h
  107. create mode 100644 arch/arm/mach-bcm2709/include/mach/power.h
  108. create mode 100644 arch/arm/mach-bcm2709/include/mach/system.h
  109. create mode 100644 arch/arm/mach-bcm2709/include/mach/timex.h
  110. create mode 100644 arch/arm/mach-bcm2709/include/mach/uncompress.h
  111. create mode 100644 arch/arm/mach-bcm2709/include/mach/vc_mem.h
  112. create mode 100755 arch/arm/mach-bcm2709/include/mach/vc_support.h
  113. create mode 100644 arch/arm/mach-bcm2709/include/mach/vcio.h
  114. create mode 100644 arch/arm/mach-bcm2709/include/mach/vmalloc.h
  115. create mode 100644 arch/arm/mach-bcm2709/power.c
  116. create mode 100644 arch/arm/mach-bcm2709/vc_mem.c
  117. create mode 100755 arch/arm/mach-bcm2709/vc_support.c
  118. create mode 100644 arch/arm/mach-bcm2709/vcio.c
  119. --- a/arch/arm/Kconfig
  120. +++ b/arch/arm/Kconfig
  121. @@ -803,6 +803,26 @@ config ARCH_OMAP1
  122. help
  123. Support for older TI OMAP1 (omap7xx, omap15xx or omap16xx)
  124. +config ARCH_BCM2709
  125. + bool "Broadcom BCM2709 family"
  126. + select ARCH_HAS_BARRIERS if SMP
  127. + select CPU_V7
  128. + select HAVE_SMP
  129. + select ARM_AMBA
  130. + select MIGHT_HAVE_CACHE_L2X0
  131. + select HAVE_SCHED_CLOCK
  132. + select NEED_MACH_MEMORY_H
  133. + select NEED_MACH_IO_H
  134. + select COMMON_CLK
  135. + select ARCH_HAS_CPUFREQ
  136. + select GENERIC_CLOCKEVENTS
  137. + select MACH_BCM2709
  138. + select VC4
  139. + select FIQ
  140. +# select ZONE_DMA
  141. + help
  142. + This enables support for Broadcom BCM2709 boards.
  143. +
  144. endchoice
  145. menu "Multiple platform selection"
  146. @@ -990,6 +1010,7 @@ source "arch/arm/mach-vt8500/Kconfig"
  147. source "arch/arm/mach-w90x900/Kconfig"
  148. source "arch/arm/mach-bcm2708/Kconfig"
  149. +source "arch/arm/mach-bcm2709/Kconfig"
  150. source "arch/arm/mach-zynq/Kconfig"
  151. --- a/arch/arm/Makefile
  152. +++ b/arch/arm/Makefile
  153. @@ -160,6 +160,7 @@ machine-$(CONFIG_ARCH_AT91) += at91
  154. machine-$(CONFIG_ARCH_AXXIA) += axxia
  155. machine-$(CONFIG_ARCH_BCM) += bcm
  156. machine-$(CONFIG_ARCH_BCM2708) += bcm2708
  157. +machine-$(CONFIG_ARCH_BCM2709) += bcm2709
  158. machine-$(CONFIG_ARCH_BERLIN) += berlin
  159. machine-$(CONFIG_ARCH_CLPS711X) += clps711x
  160. machine-$(CONFIG_ARCH_CNS3XXX) += cns3xxx
  161. --- a/arch/arm/boot/dts/Makefile
  162. +++ b/arch/arm/boot/dts/Makefile
  163. @@ -53,6 +53,14 @@ dtb-$(CONFIG_ARCH_AT91) += at91-sama5d4e
  164. dtb-$(CONFIG_ARCH_ATLAS6) += atlas6-evb.dtb
  165. dtb-$(CONFIG_ARCH_AXXIA) += axm5516-amarillo.dtb
  166. +
  167. +# Raspberry Pi
  168. +ifeq ($(CONFIG_BCM2708_DT),y)
  169. + RPI_DT_OVERLAYS=y
  170. +endif
  171. +ifeq ($(CONFIG_BCM2709_DT),y)
  172. + RPI_DT_OVERLAYS=y
  173. +endif
  174. dtb-$(CONFIG_BCM2708_DT) += bcm2708-rpi-b.dtb
  175. dtb-$(CONFIG_BCM2708_DT) += bcm2708-rpi-b-plus.dtb
  176. dtb-$(CONFIG_BCM2708_DT) += hifiberry-dac-overlay.dtb
  177. @@ -68,6 +76,7 @@ dtb-$(CONFIG_BCM2708_DT) += ds1307-rtc-o
  178. dtb-$(CONFIG_BCM2708_DT) += w1-gpio-overlay.dtb
  179. dtb-$(CONFIG_BCM2708_DT) += w1-gpio-pullup-overlay.dtb
  180. dtb-$(CONFIG_ARCH_BCM2835) += bcm2835-rpi-b.dtb
  181. +
  182. dtb-$(CONFIG_ARCH_BCM_5301X) += bcm4708-netgear-r6250.dtb
  183. dtb-$(CONFIG_ARCH_BCM_63XX) += bcm963138dvt.dtb
  184. dtb-$(CONFIG_ARCH_BCM_MOBILE) += bcm28155-ap.dtb \
  185. @@ -537,7 +546,7 @@ targets += $(dtb-y)
  186. endif
  187. # Enable fixups to support overlays on BCM2708 platforms
  188. -ifeq ($(CONFIG_BCM2708_DT),y)
  189. +ifeq ($(RPI_DT_OVERLAYS),y)
  190. DTC_FLAGS ?= -@
  191. endif
  192. --- /dev/null
  193. +++ b/arch/arm/boot/dts/bcm2709-rpi-2-b.dts
  194. @@ -0,0 +1,101 @@
  195. +/dts-v1/;
  196. +
  197. +/include/ "bcm2709.dtsi"
  198. +
  199. +/ {
  200. + compatible = "brcm,bcm2709";
  201. + model = "Raspberry Pi 2 Model B";
  202. +
  203. + aliases {
  204. + soc = &soc;
  205. + spi0 = &spi0;
  206. + i2c0 = &i2c0;
  207. + i2c1 = &i2c1;
  208. + i2s = &i2s;
  209. + gpio = &gpio;
  210. + intc = &intc;
  211. + leds = &leds;
  212. + sound = &sound;
  213. + };
  214. +
  215. + sound: sound {
  216. + };
  217. +};
  218. +
  219. +&gpio {
  220. + spi0_pins: spi0_pins {
  221. + brcm,pins = <7 8 9 10 11>;
  222. + brcm,function = <4>; /* alt0 */
  223. + };
  224. +
  225. + i2c0_pins: i2c0 {
  226. + brcm,pins = <0 1>;
  227. + brcm,function = <4>;
  228. + };
  229. +
  230. + i2c1_pins: i2c1 {
  231. + brcm,pins = <2 3>;
  232. + brcm,function = <4>;
  233. + };
  234. +
  235. + i2s_pins: i2s {
  236. + brcm,pins = <18 19 20 21>;
  237. + brcm,function = <4>; /* alt0 */
  238. + };
  239. +};
  240. +
  241. +&spi0 {
  242. + pinctrl-names = "default";
  243. + pinctrl-0 = <&spi0_pins>;
  244. +
  245. + spidev@0{
  246. + compatible = "spidev";
  247. + reg = <0>; /* CE0 */
  248. + #address-cells = <1>;
  249. + #size-cells = <0>;
  250. + spi-max-frequency = <500000>;
  251. + };
  252. +
  253. + spidev@1{
  254. + compatible = "spidev";
  255. + reg = <1>; /* CE1 */
  256. + #address-cells = <1>;
  257. + #size-cells = <0>;
  258. + spi-max-frequency = <500000>;
  259. + };
  260. +};
  261. +
  262. +&i2c0 {
  263. + pinctrl-names = "default";
  264. + pinctrl-0 = <&i2c0_pins>;
  265. + clock-frequency = <100000>;
  266. +};
  267. +
  268. +&i2c1 {
  269. + pinctrl-names = "default";
  270. + pinctrl-0 = <&i2c1_pins>;
  271. + clock-frequency = <100000>;
  272. +};
  273. +
  274. +&i2s {
  275. + #sound-dai-cells = <0>;
  276. + pinctrl-names = "default";
  277. + pinctrl-0 = <&i2s_pins>;
  278. +};
  279. +
  280. +&act_led {
  281. + gpios = <&gpio 47 0>;
  282. +};
  283. +
  284. +/ {
  285. + __overrides__ {
  286. + i2s = <&i2s>,"status";
  287. + spi = <&spi0>,"status";
  288. + i2c0 = <&i2c0>,"status";
  289. + i2c1 = <&i2c1>,"status";
  290. +
  291. + act_led_gpio = <&act_led>,"gpios:4";
  292. + act_led_activelow = <&act_led>,"gpios:8";
  293. + act_led_trigger = <&act_led>,"linux,default-trigger";
  294. + };
  295. +};
  296. --- /dev/null
  297. +++ b/arch/arm/boot/dts/bcm2709.dtsi
  298. @@ -0,0 +1,159 @@
  299. +/include/ "skeleton.dtsi"
  300. +
  301. +/ {
  302. + compatible = "brcm,bcm2709";
  303. + model = "BCM2709";
  304. +
  305. + interrupt-parent = <&intc>;
  306. +
  307. + chosen {
  308. + /* No padding required - the boot loader can do that. */
  309. + bootargs = "";
  310. + };
  311. +
  312. + soc: soc {
  313. + compatible = "simple-bus";
  314. + #address-cells = <1>;
  315. + #size-cells = <1>;
  316. + ranges = <0x7e000000 0x3f000000 0x01000000>;
  317. +
  318. + intc: interrupt-controller {
  319. + compatible = "brcm,bcm2708-armctrl-ic";
  320. + reg = <0x7e00b200 0x200>;
  321. + interrupt-controller;
  322. + #interrupt-cells = <2>;
  323. + };
  324. +
  325. + gpio: gpio {
  326. + compatible = "brcm,bcm2835-gpio";
  327. + reg = <0x7e200000 0xb4>;
  328. + interrupts = <2 17>, <2 18>;
  329. +
  330. + gpio-controller;
  331. + #gpio-cells = <2>;
  332. +
  333. + interrupt-controller;
  334. + #interrupt-cells = <2>;
  335. + };
  336. +
  337. + i2s: i2s@7e203000 {
  338. + compatible = "brcm,bcm2708-i2s";
  339. + reg = <0x7e203000 0x20>,
  340. + <0x7e101098 0x02>;
  341. +
  342. + //dmas = <&dma 2>,
  343. + // <&dma 3>;
  344. + dma-names = "tx", "rx";
  345. + status = "disabled";
  346. + };
  347. +
  348. + spi0: spi@7e204000 {
  349. + compatible = "brcm,bcm2708-spi";
  350. + reg = <0x7e204000 0x1000>;
  351. + interrupts = <2 22>;
  352. + clocks = <&clk_spi>;
  353. + #address-cells = <1>;
  354. + #size-cells = <0>;
  355. + status = "disabled";
  356. + };
  357. +
  358. + i2c0: i2c@7e205000 {
  359. + compatible = "brcm,bcm2708-i2c";
  360. + reg = <0x7e205000 0x1000>;
  361. + interrupts = <2 21>;
  362. + clocks = <&clk_i2c>;
  363. + #address-cells = <1>;
  364. + #size-cells = <0>;
  365. + status = "disabled";
  366. + };
  367. +
  368. + i2c1: i2c@7e804000 {
  369. + compatible = "brcm,bcm2708-i2c";
  370. + reg = <0x7e804000 0x1000>;
  371. + interrupts = <2 21>;
  372. + clocks = <&clk_i2c>;
  373. + #address-cells = <1>;
  374. + #size-cells = <0>;
  375. + status = "disabled";
  376. + };
  377. +
  378. + leds: leds {
  379. + compatible = "gpio-leds";
  380. +
  381. + act_led: act {
  382. + label = "ACT";
  383. + linux,default-trigger = "mmc0";
  384. + };
  385. + };
  386. + };
  387. +
  388. + clocks {
  389. + compatible = "simple-bus";
  390. + #address-cells = <1>;
  391. + #size-cells = <0>;
  392. +
  393. + clk_i2c: i2c {
  394. + compatible = "fixed-clock";
  395. + reg = <1>;
  396. + #clock-cells = <0>;
  397. + clock-frequency = <250000000>;
  398. + };
  399. +
  400. + clk_spi: clock@2 {
  401. + compatible = "fixed-clock";
  402. + reg = <2>;
  403. + #clock-cells = <0>;
  404. + clock-output-names = "spi";
  405. + clock-frequency = <250000000>;
  406. + };
  407. + };
  408. +
  409. + timer {
  410. + compatible = "arm,armv7-timer";
  411. + clock-frequency = <19200000>;
  412. + interrupts = <3 0>, // PHYS_SECURE_PPI
  413. + <3 1>, // PHYS_NONSECURE_PPI
  414. + <3 3>, // VIRT_PPI
  415. + <3 2>; // HYP_PPI
  416. + };
  417. +
  418. + cpus: cpus {
  419. + #address-cells = <1>;
  420. + #size-cells = <0>;
  421. +
  422. + v7_cpu0: cpu@0 {
  423. + device_type = "cpu";
  424. + compatible = "arm,cortex-a7";
  425. + reg = <0xf00>;
  426. + clock-frequency = <800000000>;
  427. + };
  428. +
  429. + v7_cpu1: cpu@1 {
  430. + device_type = "cpu";
  431. + compatible = "arm,cortex-a7";
  432. + reg = <0xf01>;
  433. + clock-frequency = <800000000>;
  434. + };
  435. +
  436. + v7_cpu2: cpu@2 {
  437. + device_type = "cpu";
  438. + compatible = "arm,cortex-a7";
  439. + reg = <0xf02>;
  440. + clock-frequency = <800000000>;
  441. + };
  442. +
  443. + v7_cpu3: cpu@3 {
  444. + device_type = "cpu";
  445. + compatible = "arm,cortex-a7";
  446. + reg = <0xf03>;
  447. + clock-frequency = <800000000>;
  448. + };
  449. + };
  450. +
  451. + __overrides__ {
  452. + arm_freq = <&v7_cpu0>, "clock-frequency:0",
  453. + <&v7_cpu1>, "clock-frequency:0",
  454. + <&v7_cpu2>, "clock-frequency:0",
  455. + <&v7_cpu3>, "clock-frequency:0";
  456. + };
  457. +};
  458. --- /dev/null
  459. +++ b/arch/arm/configs/bcm2709_defconfig
  460. @@ -0,0 +1,1149 @@
  461. +# CONFIG_ARM_PATCH_PHYS_VIRT is not set
  462. +CONFIG_PHYS_OFFSET=0
  463. +CONFIG_LOCALVERSION="-v7"
  464. +# CONFIG_LOCALVERSION_AUTO is not set
  465. +CONFIG_SYSVIPC=y
  466. +CONFIG_POSIX_MQUEUE=y
  467. +CONFIG_FHANDLE=y
  468. +CONFIG_AUDIT=y
  469. +CONFIG_NO_HZ=y
  470. +CONFIG_HIGH_RES_TIMERS=y
  471. +CONFIG_BSD_PROCESS_ACCT=y
  472. +CONFIG_BSD_PROCESS_ACCT_V3=y
  473. +CONFIG_TASKSTATS=y
  474. +CONFIG_TASK_DELAY_ACCT=y
  475. +CONFIG_TASK_XACCT=y
  476. +CONFIG_TASK_IO_ACCOUNTING=y
  477. +CONFIG_IKCONFIG=y
  478. +CONFIG_IKCONFIG_PROC=y
  479. +CONFIG_CGROUP_FREEZER=y
  480. +CONFIG_CGROUP_DEVICE=y
  481. +CONFIG_CGROUP_CPUACCT=y
  482. +CONFIG_RESOURCE_COUNTERS=y
  483. +CONFIG_MEMCG=y
  484. +CONFIG_BLK_CGROUP=y
  485. +CONFIG_NAMESPACES=y
  486. +CONFIG_SCHED_AUTOGROUP=y
  487. +CONFIG_BLK_DEV_INITRD=y
  488. +CONFIG_EMBEDDED=y
  489. +# CONFIG_COMPAT_BRK is not set
  490. +CONFIG_PROFILING=y
  491. +CONFIG_OPROFILE=m
  492. +CONFIG_KPROBES=y
  493. +CONFIG_JUMP_LABEL=y
  494. +CONFIG_MODULES=y
  495. +CONFIG_MODULE_UNLOAD=y
  496. +CONFIG_MODVERSIONS=y
  497. +CONFIG_MODULE_SRCVERSION_ALL=y
  498. +CONFIG_BLK_DEV_THROTTLING=y
  499. +CONFIG_PARTITION_ADVANCED=y
  500. +CONFIG_MAC_PARTITION=y
  501. +CONFIG_CFQ_GROUP_IOSCHED=y
  502. +CONFIG_ARCH_BCM2709=y
  503. +CONFIG_BCM2709_DT=y
  504. +# CONFIG_CACHE_L2X0 is not set
  505. +CONFIG_SMP=y
  506. +CONFIG_HAVE_ARM_ARCH_TIMER=y
  507. +CONFIG_VMSPLIT_2G=y
  508. +CONFIG_PREEMPT=y
  509. +CONFIG_AEABI=y
  510. +CONFIG_CLEANCACHE=y
  511. +CONFIG_FRONTSWAP=y
  512. +CONFIG_CMA=y
  513. +CONFIG_UACCESS_WITH_MEMCPY=y
  514. +CONFIG_SECCOMP=y
  515. +CONFIG_ZBOOT_ROM_TEXT=0x0
  516. +CONFIG_ZBOOT_ROM_BSS=0x0
  517. +CONFIG_CMDLINE="console=ttyAMA0,115200 kgdboc=ttyAMA0,115200 root=/dev/mmcblk0p2 rootfstype=ext4 rootwait"
  518. +CONFIG_KEXEC=y
  519. +CONFIG_CPU_FREQ=y
  520. +CONFIG_CPU_FREQ_STAT=m
  521. +CONFIG_CPU_FREQ_STAT_DETAILS=y
  522. +CONFIG_CPU_FREQ_DEFAULT_GOV_POWERSAVE=y
  523. +CONFIG_CPU_FREQ_GOV_PERFORMANCE=y
  524. +CONFIG_CPU_FREQ_GOV_USERSPACE=y
  525. +CONFIG_CPU_FREQ_GOV_ONDEMAND=y
  526. +CONFIG_CPU_FREQ_GOV_CONSERVATIVE=y
  527. +CONFIG_CPU_IDLE=y
  528. +CONFIG_VFP=y
  529. +CONFIG_NEON=y
  530. +CONFIG_KERNEL_MODE_NEON=y
  531. +CONFIG_BINFMT_MISC=m
  532. +CONFIG_NET=y
  533. +CONFIG_PACKET=y
  534. +CONFIG_UNIX=y
  535. +CONFIG_XFRM_USER=y
  536. +CONFIG_NET_KEY=m
  537. +CONFIG_INET=y
  538. +CONFIG_IP_MULTICAST=y
  539. +CONFIG_IP_ADVANCED_ROUTER=y
  540. +CONFIG_IP_MULTIPLE_TABLES=y
  541. +CONFIG_IP_ROUTE_MULTIPATH=y
  542. +CONFIG_IP_ROUTE_VERBOSE=y
  543. +CONFIG_IP_PNP=y
  544. +CONFIG_IP_PNP_DHCP=y
  545. +CONFIG_IP_PNP_RARP=y
  546. +CONFIG_NET_IPIP=m
  547. +CONFIG_NET_IPGRE_DEMUX=m
  548. +CONFIG_NET_IPGRE=m
  549. +CONFIG_IP_MROUTE=y
  550. +CONFIG_IP_MROUTE_MULTIPLE_TABLES=y
  551. +CONFIG_IP_PIMSM_V1=y
  552. +CONFIG_IP_PIMSM_V2=y
  553. +CONFIG_SYN_COOKIES=y
  554. +CONFIG_INET_AH=m
  555. +CONFIG_INET_ESP=m
  556. +CONFIG_INET_IPCOMP=m
  557. +CONFIG_INET_XFRM_MODE_TRANSPORT=m
  558. +CONFIG_INET_XFRM_MODE_TUNNEL=m
  559. +CONFIG_INET_XFRM_MODE_BEET=m
  560. +CONFIG_INET_LRO=m
  561. +CONFIG_INET_DIAG=m
  562. +CONFIG_INET6_AH=m
  563. +CONFIG_INET6_ESP=m
  564. +CONFIG_INET6_IPCOMP=m
  565. +CONFIG_IPV6_TUNNEL=m
  566. +CONFIG_IPV6_MULTIPLE_TABLES=y
  567. +CONFIG_IPV6_MROUTE=y
  568. +CONFIG_IPV6_MROUTE_MULTIPLE_TABLES=y
  569. +CONFIG_IPV6_PIMSM_V2=y
  570. +CONFIG_NETFILTER=y
  571. +CONFIG_NF_CONNTRACK=m
  572. +CONFIG_NF_CONNTRACK_ZONES=y
  573. +CONFIG_NF_CONNTRACK_EVENTS=y
  574. +CONFIG_NF_CONNTRACK_TIMESTAMP=y
  575. +CONFIG_NF_CT_PROTO_DCCP=m
  576. +CONFIG_NF_CT_PROTO_UDPLITE=m
  577. +CONFIG_NF_CONNTRACK_AMANDA=m
  578. +CONFIG_NF_CONNTRACK_FTP=m
  579. +CONFIG_NF_CONNTRACK_H323=m
  580. +CONFIG_NF_CONNTRACK_IRC=m
  581. +CONFIG_NF_CONNTRACK_NETBIOS_NS=m
  582. +CONFIG_NF_CONNTRACK_SNMP=m
  583. +CONFIG_NF_CONNTRACK_PPTP=m
  584. +CONFIG_NF_CONNTRACK_SANE=m
  585. +CONFIG_NF_CONNTRACK_SIP=m
  586. +CONFIG_NF_CONNTRACK_TFTP=m
  587. +CONFIG_NF_CT_NETLINK=m
  588. +CONFIG_NETFILTER_XT_SET=m
  589. +CONFIG_NETFILTER_XT_TARGET_AUDIT=m
  590. +CONFIG_NETFILTER_XT_TARGET_CHECKSUM=m
  591. +CONFIG_NETFILTER_XT_TARGET_CLASSIFY=m
  592. +CONFIG_NETFILTER_XT_TARGET_CONNMARK=m
  593. +CONFIG_NETFILTER_XT_TARGET_DSCP=m
  594. +CONFIG_NETFILTER_XT_TARGET_HMARK=m
  595. +CONFIG_NETFILTER_XT_TARGET_IDLETIMER=m
  596. +CONFIG_NETFILTER_XT_TARGET_LED=m
  597. +CONFIG_NETFILTER_XT_TARGET_LOG=m
  598. +CONFIG_NETFILTER_XT_TARGET_MARK=m
  599. +CONFIG_NETFILTER_XT_TARGET_NFLOG=m
  600. +CONFIG_NETFILTER_XT_TARGET_NFQUEUE=m
  601. +CONFIG_NETFILTER_XT_TARGET_NOTRACK=m
  602. +CONFIG_NETFILTER_XT_TARGET_TEE=m
  603. +CONFIG_NETFILTER_XT_TARGET_TPROXY=m
  604. +CONFIG_NETFILTER_XT_TARGET_TRACE=m
  605. +CONFIG_NETFILTER_XT_TARGET_TCPMSS=m
  606. +CONFIG_NETFILTER_XT_TARGET_TCPOPTSTRIP=m
  607. +CONFIG_NETFILTER_XT_MATCH_ADDRTYPE=m
  608. +CONFIG_NETFILTER_XT_MATCH_BPF=m
  609. +CONFIG_NETFILTER_XT_MATCH_CLUSTER=m
  610. +CONFIG_NETFILTER_XT_MATCH_COMMENT=m
  611. +CONFIG_NETFILTER_XT_MATCH_CONNBYTES=m
  612. +CONFIG_NETFILTER_XT_MATCH_CONNLABEL=m
  613. +CONFIG_NETFILTER_XT_MATCH_CONNLIMIT=m
  614. +CONFIG_NETFILTER_XT_MATCH_CONNMARK=m
  615. +CONFIG_NETFILTER_XT_MATCH_CONNTRACK=m
  616. +CONFIG_NETFILTER_XT_MATCH_CPU=m
  617. +CONFIG_NETFILTER_XT_MATCH_DCCP=m
  618. +CONFIG_NETFILTER_XT_MATCH_DEVGROUP=m
  619. +CONFIG_NETFILTER_XT_MATCH_DSCP=m
  620. +CONFIG_NETFILTER_XT_MATCH_ESP=m
  621. +CONFIG_NETFILTER_XT_MATCH_HASHLIMIT=m
  622. +CONFIG_NETFILTER_XT_MATCH_HELPER=m
  623. +CONFIG_NETFILTER_XT_MATCH_IPRANGE=m
  624. +CONFIG_NETFILTER_XT_MATCH_IPVS=m
  625. +CONFIG_NETFILTER_XT_MATCH_LENGTH=m
  626. +CONFIG_NETFILTER_XT_MATCH_LIMIT=m
  627. +CONFIG_NETFILTER_XT_MATCH_MAC=m
  628. +CONFIG_NETFILTER_XT_MATCH_MARK=m
  629. +CONFIG_NETFILTER_XT_MATCH_MULTIPORT=m
  630. +CONFIG_NETFILTER_XT_MATCH_NFACCT=m
  631. +CONFIG_NETFILTER_XT_MATCH_OSF=m
  632. +CONFIG_NETFILTER_XT_MATCH_OWNER=m
  633. +CONFIG_NETFILTER_XT_MATCH_POLICY=m
  634. +CONFIG_NETFILTER_XT_MATCH_PHYSDEV=m
  635. +CONFIG_NETFILTER_XT_MATCH_PKTTYPE=m
  636. +CONFIG_NETFILTER_XT_MATCH_QUOTA=m
  637. +CONFIG_NETFILTER_XT_MATCH_RATEEST=m
  638. +CONFIG_NETFILTER_XT_MATCH_REALM=m
  639. +CONFIG_NETFILTER_XT_MATCH_RECENT=m
  640. +CONFIG_NETFILTER_XT_MATCH_SOCKET=m
  641. +CONFIG_NETFILTER_XT_MATCH_STATE=m
  642. +CONFIG_NETFILTER_XT_MATCH_STATISTIC=m
  643. +CONFIG_NETFILTER_XT_MATCH_STRING=m
  644. +CONFIG_NETFILTER_XT_MATCH_TCPMSS=m
  645. +CONFIG_NETFILTER_XT_MATCH_TIME=m
  646. +CONFIG_NETFILTER_XT_MATCH_U32=m
  647. +CONFIG_IP_SET=m
  648. +CONFIG_IP_SET_BITMAP_IP=m
  649. +CONFIG_IP_SET_BITMAP_IPMAC=m
  650. +CONFIG_IP_SET_BITMAP_PORT=m
  651. +CONFIG_IP_SET_HASH_IP=m
  652. +CONFIG_IP_SET_HASH_IPPORT=m
  653. +CONFIG_IP_SET_HASH_IPPORTIP=m
  654. +CONFIG_IP_SET_HASH_IPPORTNET=m
  655. +CONFIG_IP_SET_HASH_NET=m
  656. +CONFIG_IP_SET_HASH_NETPORT=m
  657. +CONFIG_IP_SET_HASH_NETIFACE=m
  658. +CONFIG_IP_SET_LIST_SET=m
  659. +CONFIG_IP_VS=m
  660. +CONFIG_IP_VS_PROTO_TCP=y
  661. +CONFIG_IP_VS_PROTO_UDP=y
  662. +CONFIG_IP_VS_PROTO_ESP=y
  663. +CONFIG_IP_VS_PROTO_AH=y
  664. +CONFIG_IP_VS_PROTO_SCTP=y
  665. +CONFIG_IP_VS_RR=m
  666. +CONFIG_IP_VS_WRR=m
  667. +CONFIG_IP_VS_LC=m
  668. +CONFIG_IP_VS_WLC=m
  669. +CONFIG_IP_VS_LBLC=m
  670. +CONFIG_IP_VS_LBLCR=m
  671. +CONFIG_IP_VS_DH=m
  672. +CONFIG_IP_VS_SH=m
  673. +CONFIG_IP_VS_SED=m
  674. +CONFIG_IP_VS_NQ=m
  675. +CONFIG_IP_VS_FTP=m
  676. +CONFIG_IP_VS_PE_SIP=m
  677. +CONFIG_NF_CONNTRACK_IPV4=m
  678. +CONFIG_IP_NF_IPTABLES=m
  679. +CONFIG_IP_NF_MATCH_AH=m
  680. +CONFIG_IP_NF_MATCH_ECN=m
  681. +CONFIG_IP_NF_MATCH_TTL=m
  682. +CONFIG_IP_NF_FILTER=m
  683. +CONFIG_IP_NF_TARGET_REJECT=m
  684. +CONFIG_IP_NF_NAT=m
  685. +CONFIG_IP_NF_TARGET_MASQUERADE=m
  686. +CONFIG_IP_NF_TARGET_NETMAP=m
  687. +CONFIG_IP_NF_TARGET_REDIRECT=m
  688. +CONFIG_IP_NF_MANGLE=m
  689. +CONFIG_IP_NF_TARGET_ECN=m
  690. +CONFIG_IP_NF_TARGET_TTL=m
  691. +CONFIG_IP_NF_RAW=m
  692. +CONFIG_IP_NF_ARPTABLES=m
  693. +CONFIG_IP_NF_ARPFILTER=m
  694. +CONFIG_IP_NF_ARP_MANGLE=m
  695. +CONFIG_NF_CONNTRACK_IPV6=m
  696. +CONFIG_IP6_NF_IPTABLES=m
  697. +CONFIG_IP6_NF_MATCH_AH=m
  698. +CONFIG_IP6_NF_MATCH_EUI64=m
  699. +CONFIG_IP6_NF_MATCH_FRAG=m
  700. +CONFIG_IP6_NF_MATCH_OPTS=m
  701. +CONFIG_IP6_NF_MATCH_HL=m
  702. +CONFIG_IP6_NF_MATCH_IPV6HEADER=m
  703. +CONFIG_IP6_NF_MATCH_MH=m
  704. +CONFIG_IP6_NF_MATCH_RT=m
  705. +CONFIG_IP6_NF_TARGET_HL=m
  706. +CONFIG_IP6_NF_FILTER=m
  707. +CONFIG_IP6_NF_TARGET_REJECT=m
  708. +CONFIG_IP6_NF_MANGLE=m
  709. +CONFIG_IP6_NF_RAW=m
  710. +CONFIG_IP6_NF_NAT=m
  711. +CONFIG_IP6_NF_TARGET_MASQUERADE=m
  712. +CONFIG_IP6_NF_TARGET_NPT=m
  713. +CONFIG_BRIDGE_NF_EBTABLES=m
  714. +CONFIG_BRIDGE_EBT_BROUTE=m
  715. +CONFIG_BRIDGE_EBT_T_FILTER=m
  716. +CONFIG_BRIDGE_EBT_T_NAT=m
  717. +CONFIG_BRIDGE_EBT_802_3=m
  718. +CONFIG_BRIDGE_EBT_AMONG=m
  719. +CONFIG_BRIDGE_EBT_ARP=m
  720. +CONFIG_BRIDGE_EBT_IP=m
  721. +CONFIG_BRIDGE_EBT_IP6=m
  722. +CONFIG_BRIDGE_EBT_LIMIT=m
  723. +CONFIG_BRIDGE_EBT_MARK=m
  724. +CONFIG_BRIDGE_EBT_PKTTYPE=m
  725. +CONFIG_BRIDGE_EBT_STP=m
  726. +CONFIG_BRIDGE_EBT_VLAN=m
  727. +CONFIG_BRIDGE_EBT_ARPREPLY=m
  728. +CONFIG_BRIDGE_EBT_DNAT=m
  729. +CONFIG_BRIDGE_EBT_MARK_T=m
  730. +CONFIG_BRIDGE_EBT_REDIRECT=m
  731. +CONFIG_BRIDGE_EBT_SNAT=m
  732. +CONFIG_BRIDGE_EBT_LOG=m
  733. +CONFIG_BRIDGE_EBT_NFLOG=m
  734. +CONFIG_SCTP_COOKIE_HMAC_SHA1=y
  735. +CONFIG_ATM=m
  736. +CONFIG_L2TP=m
  737. +CONFIG_L2TP_V3=y
  738. +CONFIG_L2TP_IP=m
  739. +CONFIG_L2TP_ETH=m
  740. +CONFIG_BRIDGE=m
  741. +CONFIG_VLAN_8021Q=m
  742. +CONFIG_VLAN_8021Q_GVRP=y
  743. +CONFIG_ATALK=m
  744. +CONFIG_NET_SCHED=y
  745. +CONFIG_NET_SCH_CBQ=m
  746. +CONFIG_NET_SCH_HTB=m
  747. +CONFIG_NET_SCH_HFSC=m
  748. +CONFIG_NET_SCH_PRIO=m
  749. +CONFIG_NET_SCH_MULTIQ=m
  750. +CONFIG_NET_SCH_RED=m
  751. +CONFIG_NET_SCH_SFB=m
  752. +CONFIG_NET_SCH_SFQ=m
  753. +CONFIG_NET_SCH_TEQL=m
  754. +CONFIG_NET_SCH_TBF=m
  755. +CONFIG_NET_SCH_GRED=m
  756. +CONFIG_NET_SCH_DSMARK=m
  757. +CONFIG_NET_SCH_NETEM=m
  758. +CONFIG_NET_SCH_DRR=m
  759. +CONFIG_NET_SCH_MQPRIO=m
  760. +CONFIG_NET_SCH_CHOKE=m
  761. +CONFIG_NET_SCH_QFQ=m
  762. +CONFIG_NET_SCH_CODEL=m
  763. +CONFIG_NET_SCH_FQ_CODEL=m
  764. +CONFIG_NET_SCH_INGRESS=m
  765. +CONFIG_NET_SCH_PLUG=m
  766. +CONFIG_NET_CLS_BASIC=m
  767. +CONFIG_NET_CLS_TCINDEX=m
  768. +CONFIG_NET_CLS_ROUTE4=m
  769. +CONFIG_NET_CLS_FW=m
  770. +CONFIG_NET_CLS_U32=m
  771. +CONFIG_CLS_U32_MARK=y
  772. +CONFIG_NET_CLS_RSVP=m
  773. +CONFIG_NET_CLS_RSVP6=m
  774. +CONFIG_NET_CLS_FLOW=m
  775. +CONFIG_NET_CLS_CGROUP=m
  776. +CONFIG_NET_EMATCH=y
  777. +CONFIG_NET_EMATCH_CMP=m
  778. +CONFIG_NET_EMATCH_NBYTE=m
  779. +CONFIG_NET_EMATCH_U32=m
  780. +CONFIG_NET_EMATCH_META=m
  781. +CONFIG_NET_EMATCH_TEXT=m
  782. +CONFIG_NET_EMATCH_IPSET=m
  783. +CONFIG_NET_CLS_ACT=y
  784. +CONFIG_NET_ACT_POLICE=m
  785. +CONFIG_NET_ACT_GACT=m
  786. +CONFIG_GACT_PROB=y
  787. +CONFIG_NET_ACT_MIRRED=m
  788. +CONFIG_NET_ACT_IPT=m
  789. +CONFIG_NET_ACT_NAT=m
  790. +CONFIG_NET_ACT_PEDIT=m
  791. +CONFIG_NET_ACT_SIMP=m
  792. +CONFIG_NET_ACT_SKBEDIT=m
  793. +CONFIG_NET_ACT_CSUM=m
  794. +CONFIG_BATMAN_ADV=m
  795. +CONFIG_OPENVSWITCH=m
  796. +CONFIG_NET_PKTGEN=m
  797. +CONFIG_HAMRADIO=y
  798. +CONFIG_AX25=m
  799. +CONFIG_NETROM=m
  800. +CONFIG_ROSE=m
  801. +CONFIG_MKISS=m
  802. +CONFIG_6PACK=m
  803. +CONFIG_BPQETHER=m
  804. +CONFIG_BAYCOM_SER_FDX=m
  805. +CONFIG_BAYCOM_SER_HDX=m
  806. +CONFIG_YAM=m
  807. +CONFIG_IRDA=m
  808. +CONFIG_IRLAN=m
  809. +CONFIG_IRNET=m
  810. +CONFIG_IRCOMM=m
  811. +CONFIG_IRDA_ULTRA=y
  812. +CONFIG_IRDA_CACHE_LAST_LSAP=y
  813. +CONFIG_IRDA_FAST_RR=y
  814. +CONFIG_IRTTY_SIR=m
  815. +CONFIG_KINGSUN_DONGLE=m
  816. +CONFIG_KSDAZZLE_DONGLE=m
  817. +CONFIG_KS959_DONGLE=m
  818. +CONFIG_USB_IRDA=m
  819. +CONFIG_SIGMATEL_FIR=m
  820. +CONFIG_MCS_FIR=m
  821. +CONFIG_BT=m
  822. +CONFIG_BT_RFCOMM=m
  823. +CONFIG_BT_RFCOMM_TTY=y
  824. +CONFIG_BT_BNEP=m
  825. +CONFIG_BT_BNEP_MC_FILTER=y
  826. +CONFIG_BT_BNEP_PROTO_FILTER=y
  827. +CONFIG_BT_HIDP=m
  828. +CONFIG_BT_HCIBTUSB=m
  829. +CONFIG_BT_HCIBCM203X=m
  830. +CONFIG_BT_HCIBPA10X=m
  831. +CONFIG_BT_HCIBFUSB=m
  832. +CONFIG_BT_HCIVHCI=m
  833. +CONFIG_BT_MRVL=m
  834. +CONFIG_BT_MRVL_SDIO=m
  835. +CONFIG_BT_ATH3K=m
  836. +CONFIG_BT_WILINK=m
  837. +CONFIG_CFG80211_WEXT=y
  838. +CONFIG_MAC80211=m
  839. +CONFIG_MAC80211_MESH=y
  840. +CONFIG_WIMAX=m
  841. +CONFIG_RFKILL=m
  842. +CONFIG_RFKILL_INPUT=y
  843. +CONFIG_NET_9P=m
  844. +CONFIG_NFC=m
  845. +CONFIG_NFC_PN533=m
  846. +CONFIG_DEVTMPFS=y
  847. +CONFIG_DEVTMPFS_MOUNT=y
  848. +CONFIG_DMA_CMA=y
  849. +CONFIG_CMA_SIZE_MBYTES=5
  850. +CONFIG_BLK_DEV_LOOP=y
  851. +CONFIG_BLK_DEV_CRYPTOLOOP=m
  852. +CONFIG_BLK_DEV_DRBD=m
  853. +CONFIG_BLK_DEV_NBD=m
  854. +CONFIG_BLK_DEV_RAM=y
  855. +CONFIG_CDROM_PKTCDVD=m
  856. +CONFIG_EEPROM_AT24=m
  857. +CONFIG_SCSI=y
  858. +# CONFIG_SCSI_PROC_FS is not set
  859. +CONFIG_BLK_DEV_SD=y
  860. +CONFIG_CHR_DEV_ST=m
  861. +CONFIG_CHR_DEV_OSST=m
  862. +CONFIG_BLK_DEV_SR=m
  863. +CONFIG_CHR_DEV_SG=m
  864. +CONFIG_SCSI_ISCSI_ATTRS=y
  865. +CONFIG_ISCSI_TCP=m
  866. +CONFIG_ISCSI_BOOT_SYSFS=m
  867. +CONFIG_MD=y
  868. +CONFIG_MD_LINEAR=m
  869. +CONFIG_MD_RAID0=m
  870. +CONFIG_BLK_DEV_DM=m
  871. +CONFIG_DM_CRYPT=m
  872. +CONFIG_DM_SNAPSHOT=m
  873. +CONFIG_DM_MIRROR=m
  874. +CONFIG_DM_LOG_USERSPACE=m
  875. +CONFIG_DM_RAID=m
  876. +CONFIG_DM_ZERO=m
  877. +CONFIG_DM_DELAY=m
  878. +CONFIG_NETDEVICES=y
  879. +CONFIG_BONDING=m
  880. +CONFIG_DUMMY=m
  881. +CONFIG_IFB=m
  882. +CONFIG_MACVLAN=m
  883. +CONFIG_NETCONSOLE=m
  884. +CONFIG_TUN=m
  885. +CONFIG_VETH=m
  886. +CONFIG_MDIO_BITBANG=m
  887. +CONFIG_PPP=m
  888. +CONFIG_PPP_BSDCOMP=m
  889. +CONFIG_PPP_DEFLATE=m
  890. +CONFIG_PPP_FILTER=y
  891. +CONFIG_PPP_MPPE=m
  892. +CONFIG_PPP_MULTILINK=y
  893. +CONFIG_PPPOATM=m
  894. +CONFIG_PPPOE=m
  895. +CONFIG_PPPOL2TP=m
  896. +CONFIG_PPP_ASYNC=m
  897. +CONFIG_PPP_SYNC_TTY=m
  898. +CONFIG_SLIP=m
  899. +CONFIG_SLIP_COMPRESSED=y
  900. +CONFIG_SLIP_SMART=y
  901. +CONFIG_USB_CATC=m
  902. +CONFIG_USB_KAWETH=m
  903. +CONFIG_USB_PEGASUS=m
  904. +CONFIG_USB_RTL8150=m
  905. +CONFIG_USB_RTL8152=m
  906. +CONFIG_USB_USBNET=y
  907. +CONFIG_USB_NET_AX8817X=m
  908. +CONFIG_USB_NET_AX88179_178A=m
  909. +CONFIG_USB_NET_CDCETHER=m
  910. +CONFIG_USB_NET_CDC_EEM=m
  911. +CONFIG_USB_NET_CDC_NCM=m
  912. +CONFIG_USB_NET_HUAWEI_CDC_NCM=m
  913. +CONFIG_USB_NET_CDC_MBIM=m
  914. +CONFIG_USB_NET_DM9601=m
  915. +CONFIG_USB_NET_SR9700=m
  916. +CONFIG_USB_NET_SR9800=m
  917. +CONFIG_USB_NET_SMSC75XX=m
  918. +CONFIG_USB_NET_SMSC95XX=y
  919. +CONFIG_USB_NET_GL620A=m
  920. +CONFIG_USB_NET_NET1080=m
  921. +CONFIG_USB_NET_PLUSB=m
  922. +CONFIG_USB_NET_MCS7830=m
  923. +CONFIG_USB_NET_CDC_SUBSET=m
  924. +CONFIG_USB_ALI_M5632=y
  925. +CONFIG_USB_AN2720=y
  926. +CONFIG_USB_EPSON2888=y
  927. +CONFIG_USB_KC2190=y
  928. +CONFIG_USB_NET_ZAURUS=m
  929. +CONFIG_USB_NET_CX82310_ETH=m
  930. +CONFIG_USB_NET_KALMIA=m
  931. +CONFIG_USB_NET_QMI_WWAN=m
  932. +CONFIG_USB_HSO=m
  933. +CONFIG_USB_NET_INT51X1=m
  934. +CONFIG_USB_IPHETH=m
  935. +CONFIG_USB_SIERRA_NET=m
  936. +CONFIG_USB_VL600=m
  937. +CONFIG_LIBERTAS_THINFIRM=m
  938. +CONFIG_LIBERTAS_THINFIRM_USB=m
  939. +CONFIG_AT76C50X_USB=m
  940. +CONFIG_USB_ZD1201=m
  941. +CONFIG_USB_NET_RNDIS_WLAN=m
  942. +CONFIG_RTL8187=m
  943. +CONFIG_MAC80211_HWSIM=m
  944. +CONFIG_ATH_CARDS=m
  945. +CONFIG_ATH9K=m
  946. +CONFIG_ATH9K_HTC=m
  947. +CONFIG_CARL9170=m
  948. +CONFIG_ATH6KL=m
  949. +CONFIG_ATH6KL_USB=m
  950. +CONFIG_AR5523=m
  951. +CONFIG_B43=m
  952. +# CONFIG_B43_PHY_N is not set
  953. +CONFIG_B43LEGACY=m
  954. +CONFIG_BRCMFMAC=m
  955. +CONFIG_BRCMFMAC_USB=y
  956. +CONFIG_HOSTAP=m
  957. +CONFIG_LIBERTAS=m
  958. +CONFIG_LIBERTAS_USB=m
  959. +CONFIG_LIBERTAS_SDIO=m
  960. +CONFIG_P54_COMMON=m
  961. +CONFIG_P54_USB=m
  962. +CONFIG_RT2X00=m
  963. +CONFIG_RT2500USB=m
  964. +CONFIG_RT73USB=m
  965. +CONFIG_RT2800USB=m
  966. +CONFIG_RT2800USB_RT3573=y
  967. +CONFIG_RT2800USB_RT53XX=y
  968. +CONFIG_RT2800USB_RT55XX=y
  969. +CONFIG_RT2800USB_UNKNOWN=y
  970. +CONFIG_RTL8192CU=m
  971. +CONFIG_ZD1211RW=m
  972. +CONFIG_MWIFIEX=m
  973. +CONFIG_MWIFIEX_SDIO=m
  974. +CONFIG_WIMAX_I2400M_USB=m
  975. +CONFIG_INPUT_POLLDEV=m
  976. +# CONFIG_INPUT_MOUSEDEV_PSAUX is not set
  977. +CONFIG_INPUT_JOYDEV=m
  978. +CONFIG_INPUT_EVDEV=m
  979. +# CONFIG_INPUT_KEYBOARD is not set
  980. +# CONFIG_INPUT_MOUSE is not set
  981. +CONFIG_INPUT_JOYSTICK=y
  982. +CONFIG_JOYSTICK_IFORCE=m
  983. +CONFIG_JOYSTICK_IFORCE_USB=y
  984. +CONFIG_JOYSTICK_XPAD=m
  985. +CONFIG_JOYSTICK_XPAD_FF=y
  986. +CONFIG_INPUT_TOUCHSCREEN=y
  987. +CONFIG_TOUCHSCREEN_ADS7846=m
  988. +CONFIG_INPUT_MISC=y
  989. +CONFIG_INPUT_AD714X=m
  990. +CONFIG_INPUT_ATI_REMOTE2=m
  991. +CONFIG_INPUT_KEYSPAN_REMOTE=m
  992. +CONFIG_INPUT_POWERMATE=m
  993. +CONFIG_INPUT_YEALINK=m
  994. +CONFIG_INPUT_CM109=m
  995. +CONFIG_INPUT_UINPUT=m
  996. +CONFIG_INPUT_GPIO_ROTARY_ENCODER=m
  997. +CONFIG_INPUT_ADXL34X=m
  998. +CONFIG_INPUT_CMA3000=m
  999. +CONFIG_SERIO=m
  1000. +CONFIG_SERIO_RAW=m
  1001. +CONFIG_GAMEPORT=m
  1002. +CONFIG_GAMEPORT_NS558=m
  1003. +CONFIG_GAMEPORT_L4=m
  1004. +CONFIG_DEVPTS_MULTIPLE_INSTANCES=y
  1005. +# CONFIG_LEGACY_PTYS is not set
  1006. +# CONFIG_DEVKMEM is not set
  1007. +CONFIG_SERIAL_AMBA_PL011=y
  1008. +CONFIG_SERIAL_AMBA_PL011_CONSOLE=y
  1009. +CONFIG_TTY_PRINTK=y
  1010. +CONFIG_HW_RANDOM=y
  1011. +CONFIG_HW_RANDOM_BCM2708=m
  1012. +CONFIG_RAW_DRIVER=y
  1013. +CONFIG_BRCM_CHAR_DRIVERS=y
  1014. +CONFIG_BCM_VC_CMA=y
  1015. +CONFIG_BCM_VC_SM=y
  1016. +CONFIG_I2C=y
  1017. +CONFIG_I2C_CHARDEV=m
  1018. +CONFIG_I2C_MUX=m
  1019. +CONFIG_I2C_BCM2708=m
  1020. +CONFIG_SPI=y
  1021. +CONFIG_SPI_BCM2708=m
  1022. +CONFIG_SPI_SPIDEV=y
  1023. +CONFIG_PPS=m
  1024. +CONFIG_PPS_CLIENT_LDISC=m
  1025. +CONFIG_PPS_CLIENT_GPIO=m
  1026. +CONFIG_GPIO_SYSFS=y
  1027. +CONFIG_GPIO_ARIZONA=m
  1028. +CONFIG_W1=m
  1029. +CONFIG_W1_MASTER_DS2490=m
  1030. +CONFIG_W1_MASTER_DS2482=m
  1031. +CONFIG_W1_MASTER_DS1WM=m
  1032. +CONFIG_W1_MASTER_GPIO=m
  1033. +CONFIG_W1_SLAVE_THERM=m
  1034. +CONFIG_W1_SLAVE_SMEM=m
  1035. +CONFIG_W1_SLAVE_DS2408=m
  1036. +CONFIG_W1_SLAVE_DS2413=m
  1037. +CONFIG_W1_SLAVE_DS2406=m
  1038. +CONFIG_W1_SLAVE_DS2423=m
  1039. +CONFIG_W1_SLAVE_DS2431=m
  1040. +CONFIG_W1_SLAVE_DS2433=m
  1041. +CONFIG_W1_SLAVE_DS2760=m
  1042. +CONFIG_W1_SLAVE_DS2780=m
  1043. +CONFIG_W1_SLAVE_DS2781=m
  1044. +CONFIG_W1_SLAVE_DS28E04=m
  1045. +CONFIG_W1_SLAVE_BQ27000=m
  1046. +CONFIG_BATTERY_DS2760=m
  1047. +# CONFIG_HWMON is not set
  1048. +CONFIG_THERMAL=y
  1049. +CONFIG_THERMAL_BCM2835=y
  1050. +CONFIG_WATCHDOG=y
  1051. +CONFIG_BCM2708_WDT=m
  1052. +CONFIG_UCB1400_CORE=m
  1053. +CONFIG_MFD_ARIZONA_I2C=m
  1054. +CONFIG_MFD_ARIZONA_SPI=m
  1055. +CONFIG_MFD_WM5102=y
  1056. +CONFIG_MEDIA_SUPPORT=m
  1057. +CONFIG_MEDIA_CAMERA_SUPPORT=y
  1058. +CONFIG_MEDIA_ANALOG_TV_SUPPORT=y
  1059. +CONFIG_MEDIA_DIGITAL_TV_SUPPORT=y
  1060. +CONFIG_MEDIA_RADIO_SUPPORT=y
  1061. +CONFIG_MEDIA_RC_SUPPORT=y
  1062. +CONFIG_MEDIA_CONTROLLER=y
  1063. +CONFIG_LIRC=m
  1064. +CONFIG_RC_DEVICES=y
  1065. +CONFIG_RC_ATI_REMOTE=m
  1066. +CONFIG_IR_IMON=m
  1067. +CONFIG_IR_MCEUSB=m
  1068. +CONFIG_IR_REDRAT3=m
  1069. +CONFIG_IR_STREAMZAP=m
  1070. +CONFIG_IR_IGUANA=m
  1071. +CONFIG_IR_TTUSBIR=m
  1072. +CONFIG_RC_LOOPBACK=m
  1073. +CONFIG_IR_GPIO_CIR=m
  1074. +CONFIG_MEDIA_USB_SUPPORT=y
  1075. +CONFIG_USB_VIDEO_CLASS=m
  1076. +CONFIG_USB_M5602=m
  1077. +CONFIG_USB_STV06XX=m
  1078. +CONFIG_USB_GL860=m
  1079. +CONFIG_USB_GSPCA_BENQ=m
  1080. +CONFIG_USB_GSPCA_CONEX=m
  1081. +CONFIG_USB_GSPCA_CPIA1=m
  1082. +CONFIG_USB_GSPCA_DTCS033=m
  1083. +CONFIG_USB_GSPCA_ETOMS=m
  1084. +CONFIG_USB_GSPCA_FINEPIX=m
  1085. +CONFIG_USB_GSPCA_JEILINJ=m
  1086. +CONFIG_USB_GSPCA_JL2005BCD=m
  1087. +CONFIG_USB_GSPCA_KINECT=m
  1088. +CONFIG_USB_GSPCA_KONICA=m
  1089. +CONFIG_USB_GSPCA_MARS=m
  1090. +CONFIG_USB_GSPCA_MR97310A=m
  1091. +CONFIG_USB_GSPCA_NW80X=m
  1092. +CONFIG_USB_GSPCA_OV519=m
  1093. +CONFIG_USB_GSPCA_OV534=m
  1094. +CONFIG_USB_GSPCA_OV534_9=m
  1095. +CONFIG_USB_GSPCA_PAC207=m
  1096. +CONFIG_USB_GSPCA_PAC7302=m
  1097. +CONFIG_USB_GSPCA_PAC7311=m
  1098. +CONFIG_USB_GSPCA_SE401=m
  1099. +CONFIG_USB_GSPCA_SN9C2028=m
  1100. +CONFIG_USB_GSPCA_SN9C20X=m
  1101. +CONFIG_USB_GSPCA_SONIXB=m
  1102. +CONFIG_USB_GSPCA_SONIXJ=m
  1103. +CONFIG_USB_GSPCA_SPCA500=m
  1104. +CONFIG_USB_GSPCA_SPCA501=m
  1105. +CONFIG_USB_GSPCA_SPCA505=m
  1106. +CONFIG_USB_GSPCA_SPCA506=m
  1107. +CONFIG_USB_GSPCA_SPCA508=m
  1108. +CONFIG_USB_GSPCA_SPCA561=m
  1109. +CONFIG_USB_GSPCA_SPCA1528=m
  1110. +CONFIG_USB_GSPCA_SQ905=m
  1111. +CONFIG_USB_GSPCA_SQ905C=m
  1112. +CONFIG_USB_GSPCA_SQ930X=m
  1113. +CONFIG_USB_GSPCA_STK014=m
  1114. +CONFIG_USB_GSPCA_STK1135=m
  1115. +CONFIG_USB_GSPCA_STV0680=m
  1116. +CONFIG_USB_GSPCA_SUNPLUS=m
  1117. +CONFIG_USB_GSPCA_T613=m
  1118. +CONFIG_USB_GSPCA_TOPRO=m
  1119. +CONFIG_USB_GSPCA_TV8532=m
  1120. +CONFIG_USB_GSPCA_VC032X=m
  1121. +CONFIG_USB_GSPCA_VICAM=m
  1122. +CONFIG_USB_GSPCA_XIRLINK_CIT=m
  1123. +CONFIG_USB_GSPCA_ZC3XX=m
  1124. +CONFIG_USB_PWC=m
  1125. +CONFIG_VIDEO_CPIA2=m
  1126. +CONFIG_USB_ZR364XX=m
  1127. +CONFIG_USB_STKWEBCAM=m
  1128. +CONFIG_USB_S2255=m
  1129. +CONFIG_VIDEO_USBTV=m
  1130. +CONFIG_VIDEO_PVRUSB2=m
  1131. +CONFIG_VIDEO_HDPVR=m
  1132. +CONFIG_VIDEO_TLG2300=m
  1133. +CONFIG_VIDEO_USBVISION=m
  1134. +CONFIG_VIDEO_STK1160_COMMON=m
  1135. +CONFIG_VIDEO_STK1160_AC97=y
  1136. +CONFIG_VIDEO_GO7007=m
  1137. +CONFIG_VIDEO_GO7007_USB=m
  1138. +CONFIG_VIDEO_GO7007_USB_S2250_BOARD=m
  1139. +CONFIG_VIDEO_AU0828=m
  1140. +CONFIG_VIDEO_AU0828_RC=y
  1141. +CONFIG_VIDEO_CX231XX=m
  1142. +CONFIG_VIDEO_CX231XX_ALSA=m
  1143. +CONFIG_VIDEO_CX231XX_DVB=m
  1144. +CONFIG_VIDEO_TM6000=m
  1145. +CONFIG_VIDEO_TM6000_ALSA=m
  1146. +CONFIG_VIDEO_TM6000_DVB=m
  1147. +CONFIG_DVB_USB=m
  1148. +CONFIG_DVB_USB_A800=m
  1149. +CONFIG_DVB_USB_DIBUSB_MB=m
  1150. +CONFIG_DVB_USB_DIBUSB_MB_FAULTY=y
  1151. +CONFIG_DVB_USB_DIBUSB_MC=m
  1152. +CONFIG_DVB_USB_DIB0700=m
  1153. +CONFIG_DVB_USB_UMT_010=m
  1154. +CONFIG_DVB_USB_CXUSB=m
  1155. +CONFIG_DVB_USB_M920X=m
  1156. +CONFIG_DVB_USB_DIGITV=m
  1157. +CONFIG_DVB_USB_VP7045=m
  1158. +CONFIG_DVB_USB_VP702X=m
  1159. +CONFIG_DVB_USB_GP8PSK=m
  1160. +CONFIG_DVB_USB_NOVA_T_USB2=m
  1161. +CONFIG_DVB_USB_TTUSB2=m
  1162. +CONFIG_DVB_USB_DTT200U=m
  1163. +CONFIG_DVB_USB_OPERA1=m
  1164. +CONFIG_DVB_USB_AF9005=m
  1165. +CONFIG_DVB_USB_AF9005_REMOTE=m
  1166. +CONFIG_DVB_USB_PCTV452E=m
  1167. +CONFIG_DVB_USB_DW2102=m
  1168. +CONFIG_DVB_USB_CINERGY_T2=m
  1169. +CONFIG_DVB_USB_DTV5100=m
  1170. +CONFIG_DVB_USB_FRIIO=m
  1171. +CONFIG_DVB_USB_AZ6027=m
  1172. +CONFIG_DVB_USB_TECHNISAT_USB2=m
  1173. +CONFIG_DVB_USB_V2=m
  1174. +CONFIG_DVB_USB_AF9015=m
  1175. +CONFIG_DVB_USB_AF9035=m
  1176. +CONFIG_DVB_USB_ANYSEE=m
  1177. +CONFIG_DVB_USB_AU6610=m
  1178. +CONFIG_DVB_USB_AZ6007=m
  1179. +CONFIG_DVB_USB_CE6230=m
  1180. +CONFIG_DVB_USB_EC168=m
  1181. +CONFIG_DVB_USB_GL861=m
  1182. +CONFIG_DVB_USB_LME2510=m
  1183. +CONFIG_DVB_USB_MXL111SF=m
  1184. +CONFIG_DVB_USB_RTL28XXU=m
  1185. +CONFIG_SMS_USB_DRV=m
  1186. +CONFIG_DVB_B2C2_FLEXCOP_USB=m
  1187. +CONFIG_DVB_AS102=m
  1188. +CONFIG_VIDEO_EM28XX=m
  1189. +CONFIG_VIDEO_EM28XX_ALSA=m
  1190. +CONFIG_VIDEO_EM28XX_DVB=m
  1191. +CONFIG_V4L_PLATFORM_DRIVERS=y
  1192. +CONFIG_VIDEO_BCM2835=y
  1193. +CONFIG_VIDEO_BCM2835_MMAL=m
  1194. +CONFIG_RADIO_SI470X=y
  1195. +CONFIG_USB_SI470X=m
  1196. +CONFIG_I2C_SI470X=m
  1197. +CONFIG_RADIO_SI4713=m
  1198. +CONFIG_I2C_SI4713=m
  1199. +CONFIG_USB_MR800=m
  1200. +CONFIG_USB_DSBR=m
  1201. +CONFIG_RADIO_SHARK=m
  1202. +CONFIG_RADIO_SHARK2=m
  1203. +CONFIG_USB_KEENE=m
  1204. +CONFIG_USB_MA901=m
  1205. +CONFIG_RADIO_TEA5764=m
  1206. +CONFIG_RADIO_SAA7706H=m
  1207. +CONFIG_RADIO_TEF6862=m
  1208. +CONFIG_RADIO_WL1273=m
  1209. +CONFIG_RADIO_WL128X=m
  1210. +# CONFIG_MEDIA_SUBDRV_AUTOSELECT is not set
  1211. +CONFIG_VIDEO_UDA1342=m
  1212. +CONFIG_VIDEO_SONY_BTF_MPX=m
  1213. +CONFIG_VIDEO_TVP5150=m
  1214. +CONFIG_VIDEO_TW2804=m
  1215. +CONFIG_VIDEO_TW9903=m
  1216. +CONFIG_VIDEO_TW9906=m
  1217. +CONFIG_VIDEO_OV7640=m
  1218. +CONFIG_VIDEO_MT9V011=m
  1219. +CONFIG_FB=y
  1220. +CONFIG_FB_BCM2708=y
  1221. +# CONFIG_BACKLIGHT_GENERIC is not set
  1222. +CONFIG_FRAMEBUFFER_CONSOLE=y
  1223. +CONFIG_LOGO=y
  1224. +# CONFIG_LOGO_LINUX_MONO is not set
  1225. +# CONFIG_LOGO_LINUX_VGA16 is not set
  1226. +CONFIG_SOUND=y
  1227. +CONFIG_SND=m
  1228. +CONFIG_SND_SEQUENCER=m
  1229. +CONFIG_SND_SEQ_DUMMY=m
  1230. +CONFIG_SND_MIXER_OSS=m
  1231. +CONFIG_SND_PCM_OSS=m
  1232. +CONFIG_SND_SEQUENCER_OSS=y
  1233. +CONFIG_SND_HRTIMER=m
  1234. +CONFIG_SND_DUMMY=m
  1235. +CONFIG_SND_ALOOP=m
  1236. +CONFIG_SND_VIRMIDI=m
  1237. +CONFIG_SND_MTPAV=m
  1238. +CONFIG_SND_SERIAL_U16550=m
  1239. +CONFIG_SND_MPU401=m
  1240. +CONFIG_SND_BCM2835=m
  1241. +CONFIG_SND_USB_AUDIO=m
  1242. +CONFIG_SND_USB_UA101=m
  1243. +CONFIG_SND_USB_CAIAQ=m
  1244. +CONFIG_SND_USB_CAIAQ_INPUT=y
  1245. +CONFIG_SND_USB_6FIRE=m
  1246. +CONFIG_SND_SOC=m
  1247. +CONFIG_SND_BCM2708_SOC_I2S=m
  1248. +CONFIG_SND_BCM2708_SOC_HIFIBERRY_DAC=m
  1249. +CONFIG_SND_BCM2708_SOC_HIFIBERRY_DACPLUS=m
  1250. +CONFIG_SND_BCM2708_SOC_HIFIBERRY_DIGI=m
  1251. +CONFIG_SND_BCM2708_SOC_HIFIBERRY_AMP=m
  1252. +CONFIG_SND_BCM2708_SOC_RPI_DAC=m
  1253. +CONFIG_SND_BCM2708_SOC_IQAUDIO_DAC=m
  1254. +CONFIG_SND_SIMPLE_CARD=m
  1255. +CONFIG_SOUND_PRIME=m
  1256. +CONFIG_HIDRAW=y
  1257. +CONFIG_HID_A4TECH=m
  1258. +CONFIG_HID_ACRUX=m
  1259. +CONFIG_HID_APPLE=m
  1260. +CONFIG_HID_BELKIN=m
  1261. +CONFIG_HID_CHERRY=m
  1262. +CONFIG_HID_CHICONY=m
  1263. +CONFIG_HID_CYPRESS=m
  1264. +CONFIG_HID_DRAGONRISE=m
  1265. +CONFIG_HID_EMS_FF=m
  1266. +CONFIG_HID_ELECOM=m
  1267. +CONFIG_HID_ELO=m
  1268. +CONFIG_HID_EZKEY=m
  1269. +CONFIG_HID_HOLTEK=m
  1270. +CONFIG_HID_KEYTOUCH=m
  1271. +CONFIG_HID_KYE=m
  1272. +CONFIG_HID_UCLOGIC=m
  1273. +CONFIG_HID_WALTOP=m
  1274. +CONFIG_HID_GYRATION=m
  1275. +CONFIG_HID_TWINHAN=m
  1276. +CONFIG_HID_KENSINGTON=m
  1277. +CONFIG_HID_LCPOWER=m
  1278. +CONFIG_HID_LOGITECH=m
  1279. +CONFIG_HID_MAGICMOUSE=m
  1280. +CONFIG_HID_MICROSOFT=m
  1281. +CONFIG_HID_MONTEREY=m
  1282. +CONFIG_HID_MULTITOUCH=m
  1283. +CONFIG_HID_NTRIG=m
  1284. +CONFIG_HID_ORTEK=m
  1285. +CONFIG_HID_PANTHERLORD=m
  1286. +CONFIG_HID_PETALYNX=m
  1287. +CONFIG_HID_PICOLCD=m
  1288. +CONFIG_HID_ROCCAT=m
  1289. +CONFIG_HID_SAMSUNG=m
  1290. +CONFIG_HID_SONY=m
  1291. +CONFIG_HID_SPEEDLINK=m
  1292. +CONFIG_HID_SUNPLUS=m
  1293. +CONFIG_HID_GREENASIA=m
  1294. +CONFIG_HID_SMARTJOYPLUS=m
  1295. +CONFIG_HID_TOPSEED=m
  1296. +CONFIG_HID_THINGM=m
  1297. +CONFIG_HID_THRUSTMASTER=m
  1298. +CONFIG_HID_WACOM=m
  1299. +CONFIG_HID_WIIMOTE=m
  1300. +CONFIG_HID_XINMO=m
  1301. +CONFIG_HID_ZEROPLUS=m
  1302. +CONFIG_HID_ZYDACRON=m
  1303. +CONFIG_HID_PID=y
  1304. +CONFIG_USB_HIDDEV=y
  1305. +CONFIG_USB=y
  1306. +CONFIG_USB_ANNOUNCE_NEW_DEVICES=y
  1307. +CONFIG_USB_MON=m
  1308. +CONFIG_USB_DWCOTG=y
  1309. +CONFIG_USB_PRINTER=m
  1310. +CONFIG_USB_STORAGE=y
  1311. +CONFIG_USB_STORAGE_REALTEK=m
  1312. +CONFIG_USB_STORAGE_DATAFAB=m
  1313. +CONFIG_USB_STORAGE_FREECOM=m
  1314. +CONFIG_USB_STORAGE_ISD200=m
  1315. +CONFIG_USB_STORAGE_USBAT=m
  1316. +CONFIG_USB_STORAGE_SDDR09=m
  1317. +CONFIG_USB_STORAGE_SDDR55=m
  1318. +CONFIG_USB_STORAGE_JUMPSHOT=m
  1319. +CONFIG_USB_STORAGE_ALAUDA=m
  1320. +CONFIG_USB_STORAGE_ONETOUCH=m
  1321. +CONFIG_USB_STORAGE_KARMA=m
  1322. +CONFIG_USB_STORAGE_CYPRESS_ATACB=m
  1323. +CONFIG_USB_STORAGE_ENE_UB6250=m
  1324. +CONFIG_USB_UAS=m
  1325. +CONFIG_USB_MDC800=m
  1326. +CONFIG_USB_MICROTEK=m
  1327. +CONFIG_USB_SERIAL=m
  1328. +CONFIG_USB_SERIAL_GENERIC=y
  1329. +CONFIG_USB_SERIAL_AIRCABLE=m
  1330. +CONFIG_USB_SERIAL_ARK3116=m
  1331. +CONFIG_USB_SERIAL_BELKIN=m
  1332. +CONFIG_USB_SERIAL_CH341=m
  1333. +CONFIG_USB_SERIAL_WHITEHEAT=m
  1334. +CONFIG_USB_SERIAL_DIGI_ACCELEPORT=m
  1335. +CONFIG_USB_SERIAL_CP210X=m
  1336. +CONFIG_USB_SERIAL_CYPRESS_M8=m
  1337. +CONFIG_USB_SERIAL_EMPEG=m
  1338. +CONFIG_USB_SERIAL_FTDI_SIO=m
  1339. +CONFIG_USB_SERIAL_VISOR=m
  1340. +CONFIG_USB_SERIAL_IPAQ=m
  1341. +CONFIG_USB_SERIAL_IR=m
  1342. +CONFIG_USB_SERIAL_EDGEPORT=m
  1343. +CONFIG_USB_SERIAL_EDGEPORT_TI=m
  1344. +CONFIG_USB_SERIAL_F81232=m
  1345. +CONFIG_USB_SERIAL_GARMIN=m
  1346. +CONFIG_USB_SERIAL_IPW=m
  1347. +CONFIG_USB_SERIAL_IUU=m
  1348. +CONFIG_USB_SERIAL_KEYSPAN_PDA=m
  1349. +CONFIG_USB_SERIAL_KEYSPAN=m
  1350. +CONFIG_USB_SERIAL_KLSI=m
  1351. +CONFIG_USB_SERIAL_KOBIL_SCT=m
  1352. +CONFIG_USB_SERIAL_MCT_U232=m
  1353. +CONFIG_USB_SERIAL_METRO=m
  1354. +CONFIG_USB_SERIAL_MOS7720=m
  1355. +CONFIG_USB_SERIAL_MOS7840=m
  1356. +CONFIG_USB_SERIAL_NAVMAN=m
  1357. +CONFIG_USB_SERIAL_PL2303=m
  1358. +CONFIG_USB_SERIAL_OTI6858=m
  1359. +CONFIG_USB_SERIAL_QCAUX=m
  1360. +CONFIG_USB_SERIAL_QUALCOMM=m
  1361. +CONFIG_USB_SERIAL_SPCP8X5=m
  1362. +CONFIG_USB_SERIAL_SAFE=m
  1363. +CONFIG_USB_SERIAL_SIERRAWIRELESS=m
  1364. +CONFIG_USB_SERIAL_SYMBOL=m
  1365. +CONFIG_USB_SERIAL_TI=m
  1366. +CONFIG_USB_SERIAL_CYBERJACK=m
  1367. +CONFIG_USB_SERIAL_XIRCOM=m
  1368. +CONFIG_USB_SERIAL_OPTION=m
  1369. +CONFIG_USB_SERIAL_OMNINET=m
  1370. +CONFIG_USB_SERIAL_OPTICON=m
  1371. +CONFIG_USB_SERIAL_XSENS_MT=m
  1372. +CONFIG_USB_SERIAL_WISHBONE=m
  1373. +CONFIG_USB_SERIAL_SSU100=m
  1374. +CONFIG_USB_SERIAL_QT2=m
  1375. +CONFIG_USB_SERIAL_DEBUG=m
  1376. +CONFIG_USB_EMI62=m
  1377. +CONFIG_USB_EMI26=m
  1378. +CONFIG_USB_ADUTUX=m
  1379. +CONFIG_USB_SEVSEG=m
  1380. +CONFIG_USB_RIO500=m
  1381. +CONFIG_USB_LEGOTOWER=m
  1382. +CONFIG_USB_LCD=m
  1383. +CONFIG_USB_LED=m
  1384. +CONFIG_USB_CYPRESS_CY7C63=m
  1385. +CONFIG_USB_CYTHERM=m
  1386. +CONFIG_USB_IDMOUSE=m
  1387. +CONFIG_USB_FTDI_ELAN=m
  1388. +CONFIG_USB_APPLEDISPLAY=m
  1389. +CONFIG_USB_LD=m
  1390. +CONFIG_USB_TRANCEVIBRATOR=m
  1391. +CONFIG_USB_IOWARRIOR=m
  1392. +CONFIG_USB_TEST=m
  1393. +CONFIG_USB_ISIGHTFW=m
  1394. +CONFIG_USB_YUREX=m
  1395. +CONFIG_USB_ATM=m
  1396. +CONFIG_USB_SPEEDTOUCH=m
  1397. +CONFIG_USB_CXACRU=m
  1398. +CONFIG_USB_UEAGLEATM=m
  1399. +CONFIG_USB_XUSBATM=m
  1400. +CONFIG_MMC=y
  1401. +CONFIG_MMC_BLOCK_MINORS=32
  1402. +CONFIG_MMC_SDHCI=y
  1403. +CONFIG_MMC_SDHCI_PLTFM=y
  1404. +CONFIG_MMC_BCM2835=y
  1405. +CONFIG_MMC_BCM2835_DMA=y
  1406. +CONFIG_MMC_SPI=m
  1407. +CONFIG_LEDS_CLASS=y
  1408. +CONFIG_LEDS_GPIO=y
  1409. +CONFIG_LEDS_TRIGGER_TIMER=y
  1410. +CONFIG_LEDS_TRIGGER_ONESHOT=y
  1411. +CONFIG_LEDS_TRIGGER_HEARTBEAT=y
  1412. +CONFIG_LEDS_TRIGGER_BACKLIGHT=y
  1413. +CONFIG_LEDS_TRIGGER_CPU=y
  1414. +CONFIG_LEDS_TRIGGER_GPIO=y
  1415. +CONFIG_LEDS_TRIGGER_DEFAULT_ON=y
  1416. +CONFIG_LEDS_TRIGGER_TRANSIENT=m
  1417. +CONFIG_LEDS_TRIGGER_CAMERA=m
  1418. +CONFIG_RTC_CLASS=y
  1419. +# CONFIG_RTC_HCTOSYS is not set
  1420. +CONFIG_RTC_DRV_DS1307=m
  1421. +CONFIG_RTC_DRV_DS1374=m
  1422. +CONFIG_RTC_DRV_DS1672=m
  1423. +CONFIG_RTC_DRV_DS3232=m
  1424. +CONFIG_RTC_DRV_MAX6900=m
  1425. +CONFIG_RTC_DRV_RS5C372=m
  1426. +CONFIG_RTC_DRV_ISL1208=m
  1427. +CONFIG_RTC_DRV_ISL12022=m
  1428. +CONFIG_RTC_DRV_ISL12057=m
  1429. +CONFIG_RTC_DRV_X1205=m
  1430. +CONFIG_RTC_DRV_PCF2127=m
  1431. +CONFIG_RTC_DRV_PCF8523=m
  1432. +CONFIG_RTC_DRV_PCF8563=m
  1433. +CONFIG_RTC_DRV_PCF8583=m
  1434. +CONFIG_RTC_DRV_M41T80=m
  1435. +CONFIG_RTC_DRV_BQ32K=m
  1436. +CONFIG_RTC_DRV_S35390A=m
  1437. +CONFIG_RTC_DRV_FM3130=m
  1438. +CONFIG_RTC_DRV_RX8581=m
  1439. +CONFIG_RTC_DRV_RX8025=m
  1440. +CONFIG_RTC_DRV_EM3027=m
  1441. +CONFIG_RTC_DRV_RV3029C2=m
  1442. +CONFIG_RTC_DRV_M41T93=m
  1443. +CONFIG_RTC_DRV_M41T94=m
  1444. +CONFIG_RTC_DRV_DS1305=m
  1445. +CONFIG_RTC_DRV_DS1390=m
  1446. +CONFIG_RTC_DRV_MAX6902=m
  1447. +CONFIG_RTC_DRV_R9701=m
  1448. +CONFIG_RTC_DRV_RS5C348=m
  1449. +CONFIG_RTC_DRV_DS3234=m
  1450. +CONFIG_RTC_DRV_PCF2123=m
  1451. +CONFIG_RTC_DRV_RX4581=m
  1452. +CONFIG_DMADEVICES=y
  1453. +CONFIG_DMA_BCM2708=y
  1454. +CONFIG_UIO=m
  1455. +CONFIG_UIO_PDRV_GENIRQ=m
  1456. +CONFIG_STAGING=y
  1457. +CONFIG_PRISM2_USB=m
  1458. +CONFIG_R8712U=m
  1459. +CONFIG_R8188EU=m
  1460. +CONFIG_R8723AU=m
  1461. +CONFIG_VT6656=m
  1462. +CONFIG_SPEAKUP=m
  1463. +CONFIG_SPEAKUP_SYNTH_SOFT=m
  1464. +CONFIG_STAGING_MEDIA=y
  1465. +CONFIG_LIRC_STAGING=y
  1466. +CONFIG_LIRC_IGORPLUGUSB=m
  1467. +CONFIG_LIRC_IMON=m
  1468. +CONFIG_LIRC_RPI=m
  1469. +CONFIG_LIRC_SASEM=m
  1470. +CONFIG_LIRC_SERIAL=m
  1471. +# CONFIG_IOMMU_SUPPORT is not set
  1472. +CONFIG_EXTCON=m
  1473. +CONFIG_EXTCON_ARIZONA=m
  1474. +CONFIG_EXT4_FS=y
  1475. +CONFIG_EXT4_FS_POSIX_ACL=y
  1476. +CONFIG_EXT4_FS_SECURITY=y
  1477. +CONFIG_REISERFS_FS=m
  1478. +CONFIG_REISERFS_FS_XATTR=y
  1479. +CONFIG_REISERFS_FS_POSIX_ACL=y
  1480. +CONFIG_REISERFS_FS_SECURITY=y
  1481. +CONFIG_JFS_FS=m
  1482. +CONFIG_JFS_POSIX_ACL=y
  1483. +CONFIG_JFS_SECURITY=y
  1484. +CONFIG_JFS_STATISTICS=y
  1485. +CONFIG_XFS_FS=m
  1486. +CONFIG_XFS_QUOTA=y
  1487. +CONFIG_XFS_POSIX_ACL=y
  1488. +CONFIG_XFS_RT=y
  1489. +CONFIG_GFS2_FS=m
  1490. +CONFIG_OCFS2_FS=m
  1491. +CONFIG_BTRFS_FS=m
  1492. +CONFIG_BTRFS_FS_POSIX_ACL=y
  1493. +CONFIG_NILFS2_FS=m
  1494. +CONFIG_FANOTIFY=y
  1495. +CONFIG_QFMT_V1=m
  1496. +CONFIG_QFMT_V2=m
  1497. +CONFIG_AUTOFS4_FS=y
  1498. +CONFIG_FUSE_FS=m
  1499. +CONFIG_CUSE=m
  1500. +CONFIG_FSCACHE=y
  1501. +CONFIG_FSCACHE_STATS=y
  1502. +CONFIG_FSCACHE_HISTOGRAM=y
  1503. +CONFIG_CACHEFILES=y
  1504. +CONFIG_ISO9660_FS=m
  1505. +CONFIG_JOLIET=y
  1506. +CONFIG_ZISOFS=y
  1507. +CONFIG_UDF_FS=m
  1508. +CONFIG_MSDOS_FS=y
  1509. +CONFIG_VFAT_FS=y
  1510. +CONFIG_FAT_DEFAULT_IOCHARSET="ascii"
  1511. +CONFIG_NTFS_FS=m
  1512. +CONFIG_NTFS_RW=y
  1513. +CONFIG_TMPFS=y
  1514. +CONFIG_TMPFS_POSIX_ACL=y
  1515. +CONFIG_CONFIGFS_FS=y
  1516. +CONFIG_ECRYPT_FS=m
  1517. +CONFIG_HFS_FS=m
  1518. +CONFIG_HFSPLUS_FS=m
  1519. +CONFIG_SQUASHFS=m
  1520. +CONFIG_SQUASHFS_XATTR=y
  1521. +CONFIG_SQUASHFS_LZO=y
  1522. +CONFIG_SQUASHFS_XZ=y
  1523. +CONFIG_F2FS_FS=y
  1524. +CONFIG_NFS_FS=y
  1525. +CONFIG_NFS_V3_ACL=y
  1526. +CONFIG_NFS_V4=y
  1527. +CONFIG_NFS_SWAP=y
  1528. +CONFIG_ROOT_NFS=y
  1529. +CONFIG_NFS_FSCACHE=y
  1530. +CONFIG_NFSD=m
  1531. +CONFIG_NFSD_V3_ACL=y
  1532. +CONFIG_NFSD_V4=y
  1533. +CONFIG_CIFS=m
  1534. +CONFIG_CIFS_WEAK_PW_HASH=y
  1535. +CONFIG_CIFS_XATTR=y
  1536. +CONFIG_CIFS_POSIX=y
  1537. +CONFIG_9P_FS=m
  1538. +CONFIG_9P_FS_POSIX_ACL=y
  1539. +CONFIG_NLS_DEFAULT="utf8"
  1540. +CONFIG_NLS_CODEPAGE_437=y
  1541. +CONFIG_NLS_CODEPAGE_737=m
  1542. +CONFIG_NLS_CODEPAGE_775=m
  1543. +CONFIG_NLS_CODEPAGE_850=m
  1544. +CONFIG_NLS_CODEPAGE_852=m
  1545. +CONFIG_NLS_CODEPAGE_855=m
  1546. +CONFIG_NLS_CODEPAGE_857=m
  1547. +CONFIG_NLS_CODEPAGE_860=m
  1548. +CONFIG_NLS_CODEPAGE_861=m
  1549. +CONFIG_NLS_CODEPAGE_862=m
  1550. +CONFIG_NLS_CODEPAGE_863=m
  1551. +CONFIG_NLS_CODEPAGE_864=m
  1552. +CONFIG_NLS_CODEPAGE_865=m
  1553. +CONFIG_NLS_CODEPAGE_866=m
  1554. +CONFIG_NLS_CODEPAGE_869=m
  1555. +CONFIG_NLS_CODEPAGE_936=m
  1556. +CONFIG_NLS_CODEPAGE_950=m
  1557. +CONFIG_NLS_CODEPAGE_932=m
  1558. +CONFIG_NLS_CODEPAGE_949=m
  1559. +CONFIG_NLS_CODEPAGE_874=m
  1560. +CONFIG_NLS_ISO8859_8=m
  1561. +CONFIG_NLS_CODEPAGE_1250=m
  1562. +CONFIG_NLS_CODEPAGE_1251=m
  1563. +CONFIG_NLS_ASCII=y
  1564. +CONFIG_NLS_ISO8859_1=m
  1565. +CONFIG_NLS_ISO8859_2=m
  1566. +CONFIG_NLS_ISO8859_3=m
  1567. +CONFIG_NLS_ISO8859_4=m
  1568. +CONFIG_NLS_ISO8859_5=m
  1569. +CONFIG_NLS_ISO8859_6=m
  1570. +CONFIG_NLS_ISO8859_7=m
  1571. +CONFIG_NLS_ISO8859_9=m
  1572. +CONFIG_NLS_ISO8859_13=m
  1573. +CONFIG_NLS_ISO8859_14=m
  1574. +CONFIG_NLS_ISO8859_15=m
  1575. +CONFIG_NLS_KOI8_R=m
  1576. +CONFIG_NLS_KOI8_U=m
  1577. +CONFIG_DLM=m
  1578. +CONFIG_PRINTK_TIME=y
  1579. +CONFIG_BOOT_PRINTK_DELAY=y
  1580. +CONFIG_DEBUG_MEMORY_INIT=y
  1581. +CONFIG_DETECT_HUNG_TASK=y
  1582. +CONFIG_TIMER_STATS=y
  1583. +# CONFIG_DEBUG_PREEMPT is not set
  1584. +CONFIG_IRQSOFF_TRACER=y
  1585. +CONFIG_SCHED_TRACER=y
  1586. +CONFIG_STACK_TRACER=y
  1587. +CONFIG_BLK_DEV_IO_TRACE=y
  1588. +# CONFIG_KPROBE_EVENT is not set
  1589. +CONFIG_FUNCTION_PROFILER=y
  1590. +CONFIG_KGDB=y
  1591. +CONFIG_KGDB_KDB=y
  1592. +CONFIG_KDB_KEYBOARD=y
  1593. +CONFIG_CRYPTO_USER=m
  1594. +CONFIG_CRYPTO_NULL=m
  1595. +CONFIG_CRYPTO_CBC=y
  1596. +CONFIG_CRYPTO_CTS=m
  1597. +CONFIG_CRYPTO_XTS=m
  1598. +CONFIG_CRYPTO_XCBC=m
  1599. +CONFIG_CRYPTO_SHA1_ARM_NEON=m
  1600. +CONFIG_CRYPTO_SHA512_ARM_NEON=m
  1601. +CONFIG_CRYPTO_TGR192=m
  1602. +CONFIG_CRYPTO_WP512=m
  1603. +CONFIG_CRYPTO_AES_ARM_BS=m
  1604. +CONFIG_CRYPTO_CAST5=m
  1605. +CONFIG_CRYPTO_DES=y
  1606. +# CONFIG_CRYPTO_ANSI_CPRNG is not set
  1607. +# CONFIG_CRYPTO_HW is not set
  1608. +CONFIG_CRC_ITU_T=y
  1609. +CONFIG_LIBCRC32C=y
  1610. --- /dev/null
  1611. +++ b/arch/arm/configs/bcm2709_sdcard_defconfig
  1612. @@ -0,0 +1,129 @@
  1613. +# CONFIG_ARM_PATCH_PHYS_VIRT is not set
  1614. +CONFIG_PHYS_OFFSET=0x0
  1615. +CONFIG_LOCALVERSION="-sdcard"
  1616. +# CONFIG_LOCALVERSION_AUTO is not set
  1617. +# CONFIG_SWAP is not set
  1618. +CONFIG_SYSVIPC=y
  1619. +CONFIG_POSIX_MQUEUE=y
  1620. +CONFIG_FHANDLE=y
  1621. +CONFIG_AUDIT=y
  1622. +CONFIG_NO_HZ=y
  1623. +CONFIG_HIGH_RES_TIMERS=y
  1624. +CONFIG_BSD_PROCESS_ACCT=y
  1625. +CONFIG_BSD_PROCESS_ACCT_V3=y
  1626. +CONFIG_TASKSTATS=y
  1627. +CONFIG_TASK_DELAY_ACCT=y
  1628. +CONFIG_TASK_XACCT=y
  1629. +CONFIG_TASK_IO_ACCOUNTING=y
  1630. +CONFIG_IKCONFIG=y
  1631. +CONFIG_IKCONFIG_PROC=y
  1632. +CONFIG_CGROUP_FREEZER=y
  1633. +CONFIG_CGROUP_DEVICE=y
  1634. +CONFIG_CGROUP_CPUACCT=y
  1635. +CONFIG_RESOURCE_COUNTERS=y
  1636. +CONFIG_MEMCG=y
  1637. +CONFIG_BLK_CGROUP=y
  1638. +CONFIG_NAMESPACES=y
  1639. +CONFIG_SCHED_AUTOGROUP=y
  1640. +CONFIG_RELAY=y
  1641. +CONFIG_BLK_DEV_INITRD=y
  1642. +CONFIG_EMBEDDED=y
  1643. +# CONFIG_PERF_EVENTS is not set
  1644. +# CONFIG_COMPAT_BRK is not set
  1645. +CONFIG_PROFILING=y
  1646. +CONFIG_JUMP_LABEL=y
  1647. +CONFIG_BLK_DEV_BSGLIB=y
  1648. +CONFIG_BLK_DEV_THROTTLING=y
  1649. +CONFIG_CFQ_GROUP_IOSCHED=y
  1650. +CONFIG_ARCH_BCM2709=y
  1651. +# CONFIG_CACHE_L2X0 is not set
  1652. +CONFIG_SMP=y
  1653. +CONFIG_HAVE_ARM_ARCH_TIMER=y
  1654. +CONFIG_HOTPLUG_CPU=y
  1655. +CONFIG_PREEMPT=y
  1656. +CONFIG_AEABI=y
  1657. +CONFIG_CMA=y
  1658. +CONFIG_UACCESS_WITH_MEMCPY=y
  1659. +CONFIG_SECCOMP=y
  1660. +CONFIG_ZBOOT_ROM_TEXT=0x0
  1661. +CONFIG_ZBOOT_ROM_BSS=0x0
  1662. +CONFIG_CMDLINE="console=ttyAMA0,115200 kgdboc=ttyAMA0,115200 root=/dev/mmcblk0p2 rootfstype=ext4 rootwait"
  1663. +CONFIG_CPU_IDLE=y
  1664. +CONFIG_VFP=y
  1665. +# CONFIG_COREDUMP is not set
  1666. +# CONFIG_SUSPEND is not set
  1667. +CONFIG_NET=y
  1668. +CONFIG_UNIX=y
  1669. +CONFIG_CGROUP_NET_CLASSID=y
  1670. +# CONFIG_WIRELESS is not set
  1671. +CONFIG_DEVTMPFS=y
  1672. +CONFIG_DEVTMPFS_MOUNT=y
  1673. +CONFIG_DMA_CMA=y
  1674. +CONFIG_CMA_SIZE_MBYTES=8
  1675. +CONFIG_BLK_DEV_LOOP=y
  1676. +CONFIG_BLK_DEV_RAM=y
  1677. +# CONFIG_INPUT_MOUSEDEV_PSAUX is not set
  1678. +# CONFIG_INPUT_KEYBOARD is not set
  1679. +# CONFIG_INPUT_MOUSE is not set
  1680. +# CONFIG_SERIO is not set
  1681. +# CONFIG_LEGACY_PTYS is not set
  1682. +# CONFIG_DEVKMEM is not set
  1683. +CONFIG_SERIAL_AMBA_PL011=y
  1684. +CONFIG_SERIAL_AMBA_PL011_CONSOLE=y
  1685. +CONFIG_TTY_PRINTK=y
  1686. +# CONFIG_HW_RANDOM is not set
  1687. +CONFIG_BRCM_CHAR_DRIVERS=y
  1688. +CONFIG_BCM_VC_CMA=y
  1689. +CONFIG_GPIO_SYSFS=y
  1690. +# CONFIG_HWMON is not set
  1691. +CONFIG_FB=y
  1692. +CONFIG_FB_BCM2708=y
  1693. +CONFIG_FRAMEBUFFER_CONSOLE=y
  1694. +# CONFIG_HID is not set
  1695. +# CONFIG_USB_SUPPORT is not set
  1696. +CONFIG_MMC=y
  1697. +CONFIG_MMC_BLOCK_MINORS=32
  1698. +CONFIG_MMC_SDHCI=y
  1699. +CONFIG_MMC_SDHCI_PLTFM=y
  1700. +CONFIG_MMC_BCM2835=y
  1701. +CONFIG_MMC_BCM2835_DMA=y
  1702. +CONFIG_DMADEVICES=y
  1703. +CONFIG_DMA_BCM2708=y
  1704. +# CONFIG_IOMMU_SUPPORT is not set
  1705. +CONFIG_EXT4_FS=y
  1706. +CONFIG_EXT4_FS_POSIX_ACL=y
  1707. +CONFIG_EXT4_FS_SECURITY=y
  1708. +CONFIG_FANOTIFY=y
  1709. +CONFIG_FSCACHE=y
  1710. +CONFIG_FSCACHE_STATS=y
  1711. +CONFIG_FSCACHE_HISTOGRAM=y
  1712. +CONFIG_CACHEFILES=y
  1713. +CONFIG_MSDOS_FS=y
  1714. +CONFIG_VFAT_FS=y
  1715. +CONFIG_FAT_DEFAULT_IOCHARSET="ascii"
  1716. +CONFIG_TMPFS=y
  1717. +CONFIG_TMPFS_POSIX_ACL=y
  1718. +CONFIG_CONFIGFS_FS=y
  1719. +# CONFIG_MISC_FILESYSTEMS is not set
  1720. +# CONFIG_NETWORK_FILESYSTEMS is not set
  1721. +CONFIG_NLS_DEFAULT="utf8"
  1722. +CONFIG_NLS_CODEPAGE_437=y
  1723. +CONFIG_NLS_ASCII=y
  1724. +CONFIG_PRINTK_TIME=y
  1725. +CONFIG_BOOT_PRINTK_DELAY=y
  1726. +CONFIG_DEBUG_FS=y
  1727. +CONFIG_MAGIC_SYSRQ=y
  1728. +CONFIG_DETECT_HUNG_TASK=y
  1729. +CONFIG_TIMER_STATS=y
  1730. +# CONFIG_DEBUG_PREEMPT is not set
  1731. +CONFIG_DEBUG_LL=y
  1732. +CONFIG_EARLY_PRINTK=y
  1733. +CONFIG_KEYS=y
  1734. +CONFIG_CRYPTO_CBC=y
  1735. +CONFIG_CRYPTO_AES=y
  1736. +CONFIG_CRYPTO_DES=y
  1737. +# CONFIG_CRYPTO_ANSI_CPRNG is not set
  1738. +# CONFIG_CRYPTO_HW is not set
  1739. +CONFIG_CRC_ITU_T=y
  1740. +CONFIG_LIBCRC32C=y
  1741. +CONFIG_AVERAGE=y
  1742. --- /dev/null
  1743. +++ b/arch/arm/configs/bcm2709_small_defconfig
  1744. @@ -0,0 +1,61 @@
  1745. +CONFIG_LOCALVERSION="-small"
  1746. +# CONFIG_LOCALVERSION_AUTO is not set
  1747. +# CONFIG_SWAP is not set
  1748. +CONFIG_SYSVIPC=y
  1749. +CONFIG_HIGH_RES_TIMERS=y
  1750. +CONFIG_LOG_BUF_SHIFT=16
  1751. +CONFIG_BLK_DEV_INITRD=y
  1752. +CONFIG_INITRAMFS_SOURCE="../target_fs"
  1753. +CONFIG_SLAB=y
  1754. +# CONFIG_BLK_DEV_BSG is not set
  1755. +# CONFIG_IOSCHED_CFQ is not set
  1756. +CONFIG_ARCH_BCM2709=y
  1757. +# CONFIG_BCM2708_GPIO is not set
  1758. +# CONFIG_BCM2708_VCMEM is not set
  1759. +CONFIG_ARM_THUMBEE=y
  1760. +# CONFIG_SWP_EMULATE is not set
  1761. +# CONFIG_CACHE_L2X0 is not set
  1762. +CONFIG_ARM_ERRATA_720789=y
  1763. +CONFIG_SMP=y
  1764. +CONFIG_SCHED_MC=y
  1765. +CONFIG_SCHED_SMT=y
  1766. +CONFIG_HOTPLUG_CPU=y
  1767. +CONFIG_PREEMPT=y
  1768. +CONFIG_AEABI=y
  1769. +CONFIG_HIGHMEM=y
  1770. +CONFIG_HIGHPTE=y
  1771. +# CONFIG_COMPACTION is not set
  1772. +CONFIG_ZBOOT_ROM_TEXT=0x0
  1773. +CONFIG_ZBOOT_ROM_BSS=0x0
  1774. +CONFIG_CMDLINE="earlyprintk=ttyAMA0,19200 loglevel=9 console=ttyAMA0,19200"
  1775. +CONFIG_AUTO_ZRELADDR=y
  1776. +CONFIG_BINFMT_MISC=y
  1777. +# CONFIG_SUSPEND is not set
  1778. +# CONFIG_UEVENT_HELPER is not set
  1779. +# CONFIG_FIRMWARE_IN_KERNEL is not set
  1780. +# CONFIG_INPUT_MOUSEDEV_PSAUX is not set
  1781. +# CONFIG_INPUT_KEYBOARD is not set
  1782. +# CONFIG_INPUT_MOUSE is not set
  1783. +# CONFIG_SERIO is not set
  1784. +# CONFIG_LEGACY_PTYS is not set
  1785. +# CONFIG_DEVKMEM is not set
  1786. +CONFIG_SERIAL_AMBA_PL011=y
  1787. +CONFIG_SERIAL_AMBA_PL011_CONSOLE=y
  1788. +# CONFIG_HW_RANDOM is not set
  1789. +# CONFIG_HWMON is not set
  1790. +# CONFIG_HID is not set
  1791. +# CONFIG_USB_SUPPORT is not set
  1792. +# CONFIG_IOMMU_SUPPORT is not set
  1793. +CONFIG_AUTOFS4_FS=y
  1794. +# CONFIG_MISC_FILESYSTEMS is not set
  1795. +CONFIG_PRINTK_TIME=y
  1796. +CONFIG_FRAME_WARN=4096
  1797. +CONFIG_MAGIC_SYSRQ=y
  1798. +CONFIG_DEBUG_KERNEL=y
  1799. +CONFIG_RCU_CPU_STALL_TIMEOUT=60
  1800. +# CONFIG_FTRACE is not set
  1801. +# CONFIG_ARM_UNWIND is not set
  1802. +CONFIG_DEBUG_LL=y
  1803. +CONFIG_EARLY_PRINTK=y
  1804. +CONFIG_CRC16=y
  1805. +CONFIG_CRC_ITU_T=y
  1806. --- /dev/null
  1807. +++ b/arch/arm/configs/bcm2835_sdcard_defconfig
  1808. @@ -0,0 +1,176 @@
  1809. +# CONFIG_ARM_PATCH_PHYS_VIRT is not set
  1810. +CONFIG_LOCALVERSION="-quick"
  1811. +# CONFIG_LOCALVERSION_AUTO is not set
  1812. +# CONFIG_SWAP is not set
  1813. +CONFIG_SYSVIPC=y
  1814. +CONFIG_POSIX_MQUEUE=y
  1815. +CONFIG_NO_HZ=y
  1816. +CONFIG_HIGH_RES_TIMERS=y
  1817. +CONFIG_IKCONFIG=y
  1818. +CONFIG_IKCONFIG_PROC=y
  1819. +CONFIG_KALLSYMS_ALL=y
  1820. +CONFIG_EMBEDDED=y
  1821. +CONFIG_PERF_EVENTS=y
  1822. +# CONFIG_COMPAT_BRK is not set
  1823. +CONFIG_SLAB=y
  1824. +# CONFIG_BLK_DEV_BSG is not set
  1825. +CONFIG_ARCH_BCM2708=y
  1826. +# CONFIG_BCM2708_GPIO is not set
  1827. +CONFIG_PREEMPT=y
  1828. +CONFIG_AEABI=y
  1829. +CONFIG_UACCESS_WITH_MEMCPY=y
  1830. +CONFIG_ZBOOT_ROM_TEXT=0x0
  1831. +CONFIG_ZBOOT_ROM_BSS=0x0
  1832. +CONFIG_CMDLINE="dwc_otg.lpm_enable=0 console=ttyAMA0,115200 kgdboc=ttyAMA0,115200 root=/dev/mmcblk0p2 rootfstype=ext4 rootwait"
  1833. +CONFIG_CPU_FREQ=y
  1834. +CONFIG_CPU_FREQ_DEFAULT_GOV_POWERSAVE=y
  1835. +CONFIG_CPU_FREQ_GOV_PERFORMANCE=y
  1836. +CONFIG_CPU_FREQ_GOV_USERSPACE=y
  1837. +CONFIG_CPU_FREQ_GOV_ONDEMAND=y
  1838. +CONFIG_CPU_FREQ_GOV_CONSERVATIVE=y
  1839. +CONFIG_CPU_IDLE=y
  1840. +CONFIG_VFP=y
  1841. +CONFIG_BINFMT_MISC=y
  1842. +CONFIG_NET=y
  1843. +CONFIG_PACKET=y
  1844. +CONFIG_UNIX=y
  1845. +CONFIG_INET=y
  1846. +CONFIG_IP_MULTICAST=y
  1847. +CONFIG_IP_PNP=y
  1848. +CONFIG_IP_PNP_DHCP=y
  1849. +CONFIG_IP_PNP_RARP=y
  1850. +CONFIG_SYN_COOKIES=y
  1851. +# CONFIG_INET_XFRM_MODE_TRANSPORT is not set
  1852. +# CONFIG_INET_XFRM_MODE_TUNNEL is not set
  1853. +# CONFIG_INET_XFRM_MODE_BEET is not set
  1854. +# CONFIG_INET_LRO is not set
  1855. +# CONFIG_INET_DIAG is not set
  1856. +# CONFIG_IPV6 is not set
  1857. +# CONFIG_WIRELESS is not set
  1858. +CONFIG_DEVTMPFS=y
  1859. +CONFIG_DEVTMPFS_MOUNT=y
  1860. +CONFIG_BLK_DEV_LOOP=y
  1861. +CONFIG_BLK_DEV_RAM=y
  1862. +CONFIG_SCSI=y
  1863. +# CONFIG_SCSI_PROC_FS is not set
  1864. +# CONFIG_SCSI_LOWLEVEL is not set
  1865. +CONFIG_NETDEVICES=y
  1866. +CONFIG_MII=y
  1867. +# CONFIG_NET_VENDOR_BROADCOM is not set
  1868. +# CONFIG_NET_VENDOR_CIRRUS is not set
  1869. +# CONFIG_NET_VENDOR_FARADAY is not set
  1870. +# CONFIG_NET_VENDOR_INTEL is not set
  1871. +# CONFIG_NET_VENDOR_MARVELL is not set
  1872. +# CONFIG_NET_VENDOR_MICREL is not set
  1873. +# CONFIG_NET_VENDOR_NATSEMI is not set
  1874. +# CONFIG_NET_VENDOR_SEEQ is not set
  1875. +# CONFIG_NET_VENDOR_STMICRO is not set
  1876. +# CONFIG_NET_VENDOR_WIZNET is not set
  1877. +CONFIG_PHYLIB=y
  1878. +# CONFIG_WLAN is not set
  1879. +# CONFIG_INPUT_MOUSEDEV is not set
  1880. +CONFIG_INPUT_EVDEV=y
  1881. +# CONFIG_INPUT_KEYBOARD is not set
  1882. +# CONFIG_INPUT_MOUSE is not set
  1883. +# CONFIG_SERIO is not set
  1884. +CONFIG_VT_HW_CONSOLE_BINDING=y
  1885. +# CONFIG_LEGACY_PTYS is not set
  1886. +# CONFIG_DEVKMEM is not set
  1887. +CONFIG_SERIAL_AMBA_PL011=y
  1888. +CONFIG_SERIAL_AMBA_PL011_CONSOLE=y
  1889. +CONFIG_TTY_PRINTK=y
  1890. +CONFIG_RAW_DRIVER=y
  1891. +CONFIG_WATCHDOG=y
  1892. +CONFIG_REGULATOR=y
  1893. +CONFIG_REGULATOR_DEBUG=y
  1894. +CONFIG_REGULATOR_FIXED_VOLTAGE=y
  1895. +CONFIG_REGULATOR_VIRTUAL_CONSUMER=y
  1896. +CONFIG_REGULATOR_USERSPACE_CONSUMER=y
  1897. +CONFIG_FB=y
  1898. +CONFIG_FRAMEBUFFER_CONSOLE=y
  1899. +CONFIG_LOGO=y
  1900. +# CONFIG_LOGO_LINUX_MONO is not set
  1901. +# CONFIG_LOGO_LINUX_VGA16 is not set
  1902. +CONFIG_SOUND=y
  1903. +CONFIG_SND=y
  1904. +CONFIG_MMC=y
  1905. +CONFIG_MMC_SDHCI=y
  1906. +CONFIG_MMC_SDHCI_PLTFM=y
  1907. +CONFIG_MMC_SDHCI_BCM2708=y
  1908. +CONFIG_MMC_SDHCI_BCM2708_DMA=y
  1909. +CONFIG_NEW_LEDS=y
  1910. +CONFIG_LEDS_CLASS=y
  1911. +CONFIG_LEDS_TRIGGERS=y
  1912. +# CONFIG_IOMMU_SUPPORT is not set
  1913. +CONFIG_EXT4_FS=y
  1914. +CONFIG_EXT4_FS_POSIX_ACL=y
  1915. +CONFIG_EXT4_FS_SECURITY=y
  1916. +CONFIG_AUTOFS4_FS=y
  1917. +CONFIG_FSCACHE=y
  1918. +CONFIG_CACHEFILES=y
  1919. +CONFIG_MSDOS_FS=y
  1920. +CONFIG_VFAT_FS=y
  1921. +CONFIG_FAT_DEFAULT_IOCHARSET="ascii"
  1922. +CONFIG_TMPFS=y
  1923. +CONFIG_TMPFS_POSIX_ACL=y
  1924. +CONFIG_CONFIGFS_FS=y
  1925. +# CONFIG_MISC_FILESYSTEMS is not set
  1926. +CONFIG_NFS_FS=y
  1927. +CONFIG_NFS_V3_ACL=y
  1928. +CONFIG_NFS_V4=y
  1929. +CONFIG_ROOT_NFS=y
  1930. +CONFIG_NFS_FSCACHE=y
  1931. +CONFIG_NLS_DEFAULT="utf8"
  1932. +CONFIG_NLS_CODEPAGE_437=y
  1933. +CONFIG_NLS_CODEPAGE_737=y
  1934. +CONFIG_NLS_CODEPAGE_775=y
  1935. +CONFIG_NLS_CODEPAGE_850=y
  1936. +CONFIG_NLS_CODEPAGE_852=y
  1937. +CONFIG_NLS_CODEPAGE_855=y
  1938. +CONFIG_NLS_CODEPAGE_857=y
  1939. +CONFIG_NLS_CODEPAGE_860=y
  1940. +CONFIG_NLS_CODEPAGE_861=y
  1941. +CONFIG_NLS_CODEPAGE_862=y
  1942. +CONFIG_NLS_CODEPAGE_863=y
  1943. +CONFIG_NLS_CODEPAGE_864=y
  1944. +CONFIG_NLS_CODEPAGE_865=y
  1945. +CONFIG_NLS_CODEPAGE_866=y
  1946. +CONFIG_NLS_CODEPAGE_869=y
  1947. +CONFIG_NLS_CODEPAGE_936=y
  1948. +CONFIG_NLS_CODEPAGE_950=y
  1949. +CONFIG_NLS_CODEPAGE_932=y
  1950. +CONFIG_NLS_CODEPAGE_949=y
  1951. +CONFIG_NLS_CODEPAGE_874=y
  1952. +CONFIG_NLS_ISO8859_8=y
  1953. +CONFIG_NLS_CODEPAGE_1250=y
  1954. +CONFIG_NLS_CODEPAGE_1251=y
  1955. +CONFIG_NLS_ASCII=y
  1956. +CONFIG_NLS_ISO8859_1=y
  1957. +CONFIG_NLS_ISO8859_2=y
  1958. +CONFIG_NLS_ISO8859_3=y
  1959. +CONFIG_NLS_ISO8859_4=y
  1960. +CONFIG_NLS_ISO8859_5=y
  1961. +CONFIG_NLS_ISO8859_6=y
  1962. +CONFIG_NLS_ISO8859_7=y
  1963. +CONFIG_NLS_ISO8859_9=y
  1964. +CONFIG_NLS_ISO8859_13=y
  1965. +CONFIG_NLS_ISO8859_14=y
  1966. +CONFIG_NLS_ISO8859_15=y
  1967. +CONFIG_NLS_UTF8=y
  1968. +CONFIG_PRINTK_TIME=y
  1969. +CONFIG_DEBUG_FS=y
  1970. +# CONFIG_DEBUG_PREEMPT is not set
  1971. +# CONFIG_DEBUG_BUGVERBOSE is not set
  1972. +# CONFIG_FTRACE is not set
  1973. +CONFIG_KGDB=y
  1974. +CONFIG_KGDB_KDB=y
  1975. +# CONFIG_ARM_UNWIND is not set
  1976. +CONFIG_CRYPTO_CBC=y
  1977. +CONFIG_CRYPTO_HMAC=y
  1978. +CONFIG_CRYPTO_MD5=y
  1979. +CONFIG_CRYPTO_SHA1=y
  1980. +CONFIG_CRYPTO_DES=y
  1981. +# CONFIG_CRYPTO_ANSI_CPRNG is not set
  1982. +# CONFIG_CRYPTO_HW is not set
  1983. +CONFIG_CRC_ITU_T=y
  1984. +CONFIG_LIBCRC32C=y
  1985. --- /dev/null
  1986. +++ b/arch/arm/configs/bcmrpi_sdcard_defconfig
  1987. @@ -0,0 +1,176 @@
  1988. +# CONFIG_ARM_PATCH_PHYS_VIRT is not set
  1989. +CONFIG_LOCALVERSION="-quick"
  1990. +# CONFIG_LOCALVERSION_AUTO is not set
  1991. +# CONFIG_SWAP is not set
  1992. +CONFIG_SYSVIPC=y
  1993. +CONFIG_POSIX_MQUEUE=y
  1994. +CONFIG_NO_HZ=y
  1995. +CONFIG_HIGH_RES_TIMERS=y
  1996. +CONFIG_IKCONFIG=y
  1997. +CONFIG_IKCONFIG_PROC=y
  1998. +CONFIG_KALLSYMS_ALL=y
  1999. +CONFIG_EMBEDDED=y
  2000. +CONFIG_PERF_EVENTS=y
  2001. +# CONFIG_COMPAT_BRK is not set
  2002. +CONFIG_SLAB=y
  2003. +# CONFIG_BLK_DEV_BSG is not set
  2004. +CONFIG_ARCH_BCM2708=y
  2005. +CONFIG_PREEMPT=y
  2006. +CONFIG_AEABI=y
  2007. +CONFIG_UACCESS_WITH_MEMCPY=y
  2008. +CONFIG_ZBOOT_ROM_TEXT=0x0
  2009. +CONFIG_ZBOOT_ROM_BSS=0x0
  2010. +CONFIG_CMDLINE="dwc_otg.lpm_enable=0 console=ttyAMA0,115200 kgdboc=ttyAMA0,115200 root=/dev/mmcblk0p2 rootfstype=ext4 rootwait"
  2011. +CONFIG_CPU_FREQ=y
  2012. +CONFIG_CPU_FREQ_DEFAULT_GOV_POWERSAVE=y
  2013. +CONFIG_CPU_FREQ_GOV_PERFORMANCE=y
  2014. +CONFIG_CPU_FREQ_GOV_USERSPACE=y
  2015. +CONFIG_CPU_FREQ_GOV_ONDEMAND=y
  2016. +CONFIG_CPU_FREQ_GOV_CONSERVATIVE=y
  2017. +CONFIG_CPU_IDLE=y
  2018. +CONFIG_VFP=y
  2019. +CONFIG_BINFMT_MISC=y
  2020. +CONFIG_NET=y
  2021. +CONFIG_PACKET=y
  2022. +CONFIG_UNIX=y
  2023. +CONFIG_INET=y
  2024. +CONFIG_IP_MULTICAST=y
  2025. +CONFIG_IP_PNP=y
  2026. +CONFIG_IP_PNP_DHCP=y
  2027. +CONFIG_IP_PNP_RARP=y
  2028. +CONFIG_SYN_COOKIES=y
  2029. +# CONFIG_INET_XFRM_MODE_TRANSPORT is not set
  2030. +# CONFIG_INET_XFRM_MODE_TUNNEL is not set
  2031. +# CONFIG_INET_XFRM_MODE_BEET is not set
  2032. +# CONFIG_INET_LRO is not set
  2033. +# CONFIG_INET_DIAG is not set
  2034. +# CONFIG_IPV6 is not set
  2035. +# CONFIG_WIRELESS is not set
  2036. +CONFIG_DEVTMPFS=y
  2037. +CONFIG_DEVTMPFS_MOUNT=y
  2038. +CONFIG_BLK_DEV_LOOP=y
  2039. +CONFIG_BLK_DEV_RAM=y
  2040. +CONFIG_SCSI=y
  2041. +# CONFIG_SCSI_PROC_FS is not set
  2042. +# CONFIG_SCSI_LOWLEVEL is not set
  2043. +CONFIG_NETDEVICES=y
  2044. +CONFIG_MII=y
  2045. +# CONFIG_NET_VENDOR_BROADCOM is not set
  2046. +# CONFIG_NET_VENDOR_CIRRUS is not set
  2047. +# CONFIG_NET_VENDOR_FARADAY is not set
  2048. +# CONFIG_NET_VENDOR_INTEL is not set
  2049. +# CONFIG_NET_VENDOR_MARVELL is not set
  2050. +# CONFIG_NET_VENDOR_MICREL is not set
  2051. +# CONFIG_NET_VENDOR_NATSEMI is not set
  2052. +# CONFIG_NET_VENDOR_SEEQ is not set
  2053. +# CONFIG_NET_VENDOR_STMICRO is not set
  2054. +# CONFIG_NET_VENDOR_WIZNET is not set
  2055. +CONFIG_PHYLIB=y
  2056. +# CONFIG_WLAN is not set
  2057. +# CONFIG_INPUT_MOUSEDEV is not set
  2058. +CONFIG_INPUT_EVDEV=y
  2059. +# CONFIG_INPUT_KEYBOARD is not set
  2060. +# CONFIG_INPUT_MOUSE is not set
  2061. +# CONFIG_SERIO is not set
  2062. +CONFIG_VT_HW_CONSOLE_BINDING=y
  2063. +# CONFIG_LEGACY_PTYS is not set
  2064. +# CONFIG_DEVKMEM is not set
  2065. +CONFIG_SERIAL_AMBA_PL011=y
  2066. +CONFIG_SERIAL_AMBA_PL011_CONSOLE=y
  2067. +CONFIG_TTY_PRINTK=y
  2068. +CONFIG_RAW_DRIVER=y
  2069. +CONFIG_WATCHDOG=y
  2070. +CONFIG_REGULATOR=y
  2071. +CONFIG_REGULATOR_DEBUG=y
  2072. +CONFIG_REGULATOR_FIXED_VOLTAGE=y
  2073. +CONFIG_REGULATOR_VIRTUAL_CONSUMER=y
  2074. +CONFIG_REGULATOR_USERSPACE_CONSUMER=y
  2075. +CONFIG_FB=y
  2076. +CONFIG_FRAMEBUFFER_CONSOLE=y
  2077. +CONFIG_LOGO=y
  2078. +# CONFIG_LOGO_LINUX_MONO is not set
  2079. +# CONFIG_LOGO_LINUX_VGA16 is not set
  2080. +CONFIG_SOUND=y
  2081. +CONFIG_SND=y
  2082. +CONFIG_MMC=y
  2083. +CONFIG_MMC_SDHCI=y
  2084. +CONFIG_MMC_SDHCI_PLTFM=y
  2085. +CONFIG_MMC_SDHCI_BCM2708=y
  2086. +CONFIG_MMC_SDHCI_BCM2708_DMA=y
  2087. +CONFIG_NEW_LEDS=y
  2088. +CONFIG_LEDS_CLASS=y
  2089. +CONFIG_LEDS_TRIGGERS=y
  2090. +# CONFIG_IOMMU_SUPPORT is not set
  2091. +CONFIG_EXT4_FS=y
  2092. +CONFIG_EXT4_FS_POSIX_ACL=y
  2093. +CONFIG_EXT4_FS_SECURITY=y
  2094. +CONFIG_AUTOFS4_FS=y
  2095. +CONFIG_FSCACHE=y
  2096. +CONFIG_CACHEFILES=y
  2097. +CONFIG_MSDOS_FS=y
  2098. +CONFIG_VFAT_FS=y
  2099. +CONFIG_FAT_DEFAULT_IOCHARSET="ascii"
  2100. +CONFIG_TMPFS=y
  2101. +CONFIG_TMPFS_POSIX_ACL=y
  2102. +CONFIG_CONFIGFS_FS=y
  2103. +# CONFIG_MISC_FILESYSTEMS is not set
  2104. +CONFIG_NFS_FS=y
  2105. +CONFIG_NFS_V3_ACL=y
  2106. +CONFIG_NFS_V4=y
  2107. +CONFIG_ROOT_NFS=y
  2108. +CONFIG_NFS_FSCACHE=y
  2109. +CONFIG_NLS_DEFAULT="utf8"
  2110. +CONFIG_NLS_CODEPAGE_437=y
  2111. +CONFIG_NLS_CODEPAGE_737=y
  2112. +CONFIG_NLS_CODEPAGE_775=y
  2113. +CONFIG_NLS_CODEPAGE_850=y
  2114. +CONFIG_NLS_CODEPAGE_852=y
  2115. +CONFIG_NLS_CODEPAGE_855=y
  2116. +CONFIG_NLS_CODEPAGE_857=y
  2117. +CONFIG_NLS_CODEPAGE_860=y
  2118. +CONFIG_NLS_CODEPAGE_861=y
  2119. +CONFIG_NLS_CODEPAGE_862=y
  2120. +CONFIG_NLS_CODEPAGE_863=y
  2121. +CONFIG_NLS_CODEPAGE_864=y
  2122. +CONFIG_NLS_CODEPAGE_865=y
  2123. +CONFIG_NLS_CODEPAGE_866=y
  2124. +CONFIG_NLS_CODEPAGE_869=y
  2125. +CONFIG_NLS_CODEPAGE_936=y
  2126. +CONFIG_NLS_CODEPAGE_950=y
  2127. +CONFIG_NLS_CODEPAGE_932=y
  2128. +CONFIG_NLS_CODEPAGE_949=y
  2129. +CONFIG_NLS_CODEPAGE_874=y
  2130. +CONFIG_NLS_ISO8859_8=y
  2131. +CONFIG_NLS_CODEPAGE_1250=y
  2132. +CONFIG_NLS_CODEPAGE_1251=y
  2133. +CONFIG_NLS_ASCII=y
  2134. +CONFIG_NLS_ISO8859_1=y
  2135. +CONFIG_NLS_ISO8859_2=y
  2136. +CONFIG_NLS_ISO8859_3=y
  2137. +CONFIG_NLS_ISO8859_4=y
  2138. +CONFIG_NLS_ISO8859_5=y
  2139. +CONFIG_NLS_ISO8859_6=y
  2140. +CONFIG_NLS_ISO8859_7=y
  2141. +CONFIG_NLS_ISO8859_9=y
  2142. +CONFIG_NLS_ISO8859_13=y
  2143. +CONFIG_NLS_ISO8859_14=y
  2144. +CONFIG_NLS_ISO8859_15=y
  2145. +CONFIG_NLS_UTF8=y
  2146. +CONFIG_PRINTK_TIME=y
  2147. +CONFIG_DEBUG_FS=y
  2148. +CONFIG_DETECT_HUNG_TASK=y
  2149. +# CONFIG_DEBUG_PREEMPT is not set
  2150. +# CONFIG_DEBUG_BUGVERBOSE is not set
  2151. +# CONFIG_FTRACE is not set
  2152. +CONFIG_KGDB=y
  2153. +CONFIG_KGDB_KDB=y
  2154. +# CONFIG_ARM_UNWIND is not set
  2155. +CONFIG_CRYPTO_CBC=y
  2156. +CONFIG_CRYPTO_HMAC=y
  2157. +CONFIG_CRYPTO_MD5=y
  2158. +CONFIG_CRYPTO_SHA1=y
  2159. +CONFIG_CRYPTO_DES=y
  2160. +# CONFIG_CRYPTO_ANSI_CPRNG is not set
  2161. +# CONFIG_CRYPTO_HW is not set
  2162. +CONFIG_CRC_ITU_T=y
  2163. +CONFIG_LIBCRC32C=y
  2164. --- /dev/null
  2165. +++ b/arch/arm/configs/bcmrpi_small_defconfig
  2166. @@ -0,0 +1,103 @@
  2167. +CONFIG_LOCALVERSION="-quick"
  2168. +# CONFIG_LOCALVERSION_AUTO is not set
  2169. +# CONFIG_SWAP is not set
  2170. +CONFIG_SYSVIPC=y
  2171. +CONFIG_NO_HZ=y
  2172. +CONFIG_HIGH_RES_TIMERS=y
  2173. +CONFIG_IKCONFIG=y
  2174. +CONFIG_IKCONFIG_PROC=y
  2175. +CONFIG_KALLSYMS_ALL=y
  2176. +CONFIG_PERF_EVENTS=y
  2177. +# CONFIG_COMPAT_BRK is not set
  2178. +# CONFIG_BLK_DEV_BSG is not set
  2179. +CONFIG_ARCH_BCM2836=y
  2180. +# CONFIG_BCM2708_GPIO is not set
  2181. +# CONFIG_BCM2708_VCMEM is not set
  2182. +# CONFIG_CACHE_L2X0 is not set
  2183. +CONFIG_SMP=y
  2184. +CONFIG_HAVE_ARM_ARCH_TIMER=y
  2185. +CONFIG_PREEMPT=y
  2186. +CONFIG_AEABI=y
  2187. +CONFIG_ZBOOT_ROM_TEXT=0x0
  2188. +CONFIG_ZBOOT_ROM_BSS=0x0
  2189. +CONFIG_CMDLINE="console=ttyAMA0,115200 kgdboc=ttyAMA0,115200 root=/dev/mmcblk0p2 rootfstype=ext4 rootwait"
  2190. +CONFIG_CPU_IDLE=y
  2191. +# CONFIG_SUSPEND is not set
  2192. +CONFIG_DEVTMPFS=y
  2193. +CONFIG_DEVTMPFS_MOUNT=y
  2194. +CONFIG_BLK_DEV_LOOP=y
  2195. +CONFIG_BLK_DEV_RAM=y
  2196. +# CONFIG_BCM2708_VCHIQ is not set
  2197. +# CONFIG_INPUT_MOUSEDEV is not set
  2198. +CONFIG_INPUT_EVDEV=y
  2199. +# CONFIG_INPUT_KEYBOARD is not set
  2200. +# CONFIG_INPUT_MOUSE is not set
  2201. +# CONFIG_SERIO is not set
  2202. +# CONFIG_LEGACY_PTYS is not set
  2203. +# CONFIG_DEVKMEM is not set
  2204. +CONFIG_SERIAL_AMBA_PL011=y
  2205. +CONFIG_SERIAL_AMBA_PL011_CONSOLE=y
  2206. +CONFIG_RAW_DRIVER=y
  2207. +# CONFIG_HID is not set
  2208. +CONFIG_DMADEVICES=y
  2209. +# CONFIG_IOMMU_SUPPORT is not set
  2210. +CONFIG_TMPFS=y
  2211. +CONFIG_TMPFS_POSIX_ACL=y
  2212. +# CONFIG_MISC_FILESYSTEMS is not set
  2213. +CONFIG_NLS=y
  2214. +CONFIG_NLS_DEFAULT="utf8"
  2215. +CONFIG_NLS_CODEPAGE_437=y
  2216. +CONFIG_NLS_CODEPAGE_737=y
  2217. +CONFIG_NLS_CODEPAGE_775=y
  2218. +CONFIG_NLS_CODEPAGE_850=y
  2219. +CONFIG_NLS_CODEPAGE_852=y
  2220. +CONFIG_NLS_CODEPAGE_855=y
  2221. +CONFIG_NLS_CODEPAGE_857=y
  2222. +CONFIG_NLS_CODEPAGE_860=y
  2223. +CONFIG_NLS_CODEPAGE_861=y
  2224. +CONFIG_NLS_CODEPAGE_862=y
  2225. +CONFIG_NLS_CODEPAGE_863=y
  2226. +CONFIG_NLS_CODEPAGE_864=y
  2227. +CONFIG_NLS_CODEPAGE_865=y
  2228. +CONFIG_NLS_CODEPAGE_866=y
  2229. +CONFIG_NLS_CODEPAGE_869=y
  2230. +CONFIG_NLS_CODEPAGE_936=y
  2231. +CONFIG_NLS_CODEPAGE_950=y
  2232. +CONFIG_NLS_CODEPAGE_932=y
  2233. +CONFIG_NLS_CODEPAGE_949=y
  2234. +CONFIG_NLS_CODEPAGE_874=y
  2235. +CONFIG_NLS_ISO8859_8=y
  2236. +CONFIG_NLS_CODEPAGE_1250=y
  2237. +CONFIG_NLS_CODEPAGE_1251=y
  2238. +CONFIG_NLS_ASCII=y
  2239. +CONFIG_NLS_ISO8859_1=y
  2240. +CONFIG_NLS_ISO8859_2=y
  2241. +CONFIG_NLS_ISO8859_3=y
  2242. +CONFIG_NLS_ISO8859_4=y
  2243. +CONFIG_NLS_ISO8859_5=y
  2244. +CONFIG_NLS_ISO8859_6=y
  2245. +CONFIG_NLS_ISO8859_7=y
  2246. +CONFIG_NLS_ISO8859_9=y
  2247. +CONFIG_NLS_ISO8859_13=y
  2248. +CONFIG_NLS_ISO8859_14=y
  2249. +CONFIG_NLS_ISO8859_15=y
  2250. +CONFIG_NLS_UTF8=y
  2251. +CONFIG_PRINTK_TIME=y
  2252. +CONFIG_DEBUG_KERNEL=y
  2253. +# CONFIG_DEBUG_PREEMPT is not set
  2254. +# CONFIG_FTRACE is not set
  2255. +CONFIG_KGDB=y
  2256. +CONFIG_KGDB_KDB=y
  2257. +# CONFIG_ARM_UNWIND is not set
  2258. +CONFIG_DEBUG_LL=y
  2259. +CONFIG_EARLY_PRINTK=y
  2260. +CONFIG_CRYPTO_CBC=y
  2261. +CONFIG_CRYPTO_HMAC=y
  2262. +CONFIG_CRYPTO_MD5=y
  2263. +CONFIG_CRYPTO_SHA1=y
  2264. +CONFIG_CRYPTO_DES=y
  2265. +# CONFIG_CRYPTO_ANSI_CPRNG is not set
  2266. +# CONFIG_CRYPTO_HW is not set
  2267. +CONFIG_CRC16=y
  2268. +CONFIG_CRC_ITU_T=y
  2269. +CONFIG_LIBCRC32C=y
  2270. --- a/arch/arm/kernel/head.S
  2271. +++ b/arch/arm/kernel/head.S
  2272. @@ -673,6 +673,14 @@ ARM_BE8(rev16 ip, ip)
  2273. ldrcc r7, [r4], #4 @ use branch for delay slot
  2274. bcc 1b
  2275. ret lr
  2276. + nop
  2277. + nop
  2278. + nop
  2279. + nop
  2280. + nop
  2281. + nop
  2282. + nop
  2283. + nop
  2284. #endif
  2285. ENDPROC(__fixup_a_pv_table)
  2286. --- /dev/null
  2287. +++ b/arch/arm/mach-bcm2709/Kconfig
  2288. @@ -0,0 +1,49 @@
  2289. +menu "Broadcom BCM2709 Implementations"
  2290. + depends on ARCH_BCM2709
  2291. +
  2292. +config MACH_BCM2709
  2293. + bool "Broadcom BCM2709 Development Platform"
  2294. + help
  2295. + Include support for the Broadcom(R) BCM2709 platform.
  2296. +
  2297. +config BCM2709_DT
  2298. + bool "BCM2709 Device Tree support"
  2299. + depends on MACH_BCM2709
  2300. + default n
  2301. + select USE_OF
  2302. + select ARCH_REQUIRE_GPIOLIB
  2303. + select PINCTRL
  2304. + select PINCTRL_BCM2835
  2305. + help
  2306. + Enable Device Tree support for BCM2709
  2307. +
  2308. +config BCM2708_GPIO
  2309. + bool "BCM2709 gpio support"
  2310. + depends on MACH_BCM2709
  2311. + select ARCH_REQUIRE_GPIOLIB
  2312. + default y
  2313. + help
  2314. + Include support for the Broadcom(R) BCM2709 gpio.
  2315. +
  2316. +config BCM2708_VCMEM
  2317. + bool "Videocore Memory"
  2318. + depends on MACH_BCM2709
  2319. + default y
  2320. + help
  2321. + Helper for videocore memory access and total size allocation.
  2322. +
  2323. +config BCM2708_NOL2CACHE
  2324. + bool "Videocore L2 cache disable"
  2325. + depends on MACH_BCM2709
  2326. + default y
  2327. + help
  2328. + Do not allow ARM to use GPU's L2 cache. Requires disable_l2cache in config.txt.
  2329. +
  2330. +config BCM2708_SPIDEV
  2331. + bool "Bind spidev to SPI0 master"
  2332. + depends on MACH_BCM2709
  2333. + depends on SPI
  2334. + default y
  2335. + help
  2336. + Binds spidev driver to the SPI0 master
  2337. +endmenu
  2338. --- /dev/null
  2339. +++ b/arch/arm/mach-bcm2709/Makefile
  2340. @@ -0,0 +1,7 @@
  2341. +#
  2342. +# Makefile for the linux kernel.
  2343. +#
  2344. +
  2345. +obj-$(CONFIG_MACH_BCM2709) += bcm2709.o armctrl.o vcio.o power.o dma.o
  2346. +obj-$(CONFIG_BCM2708_GPIO) += bcm2708_gpio.o
  2347. +obj-$(CONFIG_BCM2708_VCMEM) += vc_mem.o
  2348. --- /dev/null
  2349. +++ b/arch/arm/mach-bcm2709/Makefile.boot
  2350. @@ -0,0 +1,3 @@
  2351. + zreladdr-y := 0x00008000
  2352. +params_phys-y := 0x00000100
  2353. +initrd_phys-y := 0x00800000
  2354. --- /dev/null
  2355. +++ b/arch/arm/mach-bcm2709/armctrl.c
  2356. @@ -0,0 +1,357 @@
  2357. +/*
  2358. + * linux/arch/arm/mach-bcm2708/armctrl.c
  2359. + *
  2360. + * Copyright (C) 2010 Broadcom
  2361. + *
  2362. + * This program is free software; you can redistribute it and/or modify
  2363. + * it under the terms of the GNU General Public License as published by
  2364. + * the Free Software Foundation; either version 2 of the License, or
  2365. + * (at your option) any later version.
  2366. + *
  2367. + * This program is distributed in the hope that it will be useful,
  2368. + * but WITHOUT ANY WARRANTY; without even the implied warranty of
  2369. + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  2370. + * GNU General Public License for more details.
  2371. + *
  2372. + * You should have received a copy of the GNU General Public License
  2373. + * along with this program; if not, write to the Free Software
  2374. + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
  2375. + */
  2376. +#include <linux/init.h>
  2377. +#include <linux/list.h>
  2378. +#include <linux/io.h>
  2379. +#include <linux/version.h>
  2380. +#include <linux/syscore_ops.h>
  2381. +#include <linux/interrupt.h>
  2382. +#include <linux/irqdomain.h>
  2383. +#include <linux/of.h>
  2384. +
  2385. +#include <asm/mach/irq.h>
  2386. +#include <mach/hardware.h>
  2387. +#include "armctrl.h"
  2388. +
  2389. +/* For support of kernels >= 3.0 assume only one VIC for now*/
  2390. +static unsigned int remap_irqs[(INTERRUPT_ARASANSDIO + 1) - INTERRUPT_JPEG] = {
  2391. + INTERRUPT_VC_JPEG,
  2392. + INTERRUPT_VC_USB,
  2393. + INTERRUPT_VC_3D,
  2394. + INTERRUPT_VC_DMA2,
  2395. + INTERRUPT_VC_DMA3,
  2396. + INTERRUPT_VC_I2C,
  2397. + INTERRUPT_VC_SPI,
  2398. + INTERRUPT_VC_I2SPCM,
  2399. + INTERRUPT_VC_SDIO,
  2400. + INTERRUPT_VC_UART,
  2401. + INTERRUPT_VC_ARASANSDIO
  2402. +};
  2403. +
  2404. +static void armctrl_mask_irq(struct irq_data *d)
  2405. +{
  2406. + static const unsigned int disables[4] = {
  2407. + ARM_IRQ_DIBL1,
  2408. + ARM_IRQ_DIBL2,
  2409. + ARM_IRQ_DIBL3,
  2410. + 0
  2411. + };
  2412. + int i;
  2413. + if (d->irq >= FIQ_START) {
  2414. + writel(0, __io_address(ARM_IRQ_FAST));
  2415. + } else if (d->irq >= IRQ_ARM_LOCAL_CNTPSIRQ && d->irq < IRQ_ARM_LOCAL_CNTPSIRQ + 4) {
  2416. +#if 1
  2417. + unsigned int data = (unsigned int)irq_get_chip_data(d->irq) - IRQ_ARM_LOCAL_CNTPSIRQ;
  2418. + for (i=0; i<4; i++) // i = raw_smp_processor_id(); //
  2419. + {
  2420. + unsigned int val = readl(__io_address(ARM_LOCAL_TIMER_INT_CONTROL0 + 4*i));
  2421. + writel(val &~ (1 << data), __io_address(ARM_LOCAL_TIMER_INT_CONTROL0 + 4*i));
  2422. + }
  2423. +#endif
  2424. + } else if (d->irq >= IRQ_ARM_LOCAL_MAILBOX0 && d->irq < IRQ_ARM_LOCAL_MAILBOX0 + 4) {
  2425. +#if 0
  2426. + unsigned int data = (unsigned int)irq_get_chip_data(d->irq) - IRQ_ARM_LOCAL_MAILBOX0;
  2427. + for (i=0; i<4; i++) {
  2428. + unsigned int val = readl(__io_address(ARM_LOCAL_MAILBOX_INT_CONTROL0 + 4*i));
  2429. + writel(val &~ (1 << data), __io_address(ARM_LOCAL_MAILBOX_INT_CONTROL0 + 4*i));
  2430. + }
  2431. +#endif
  2432. + } else if (d->irq >= ARM_IRQ1_BASE && d->irq < ARM_IRQ_LOCAL_BASE) {
  2433. + unsigned int data = (unsigned int)irq_get_chip_data(d->irq);
  2434. + writel(1 << (data & 0x1f), __io_address(disables[(data >> 5) & 0x3]));
  2435. + } else { printk("%s: %d\n", __func__, d->irq); BUG(); }
  2436. +}
  2437. +
  2438. +static void armctrl_unmask_irq(struct irq_data *d)
  2439. +{
  2440. + static const unsigned int enables[4] = {
  2441. + ARM_IRQ_ENBL1,
  2442. + ARM_IRQ_ENBL2,
  2443. + ARM_IRQ_ENBL3,
  2444. + 0
  2445. + };
  2446. + int i;
  2447. + if (d->irq >= FIQ_START) {
  2448. + unsigned int data = (unsigned int)irq_get_chip_data(d->irq) - FIQ_START;
  2449. + writel(0x80 | data, __io_address(ARM_IRQ_FAST));
  2450. + } else if (d->irq >= IRQ_ARM_LOCAL_CNTPSIRQ && d->irq < IRQ_ARM_LOCAL_CNTPSIRQ + 4) {
  2451. +#if 1
  2452. + unsigned int data = (unsigned int)irq_get_chip_data(d->irq) - IRQ_ARM_LOCAL_CNTPSIRQ;
  2453. + for (i=0; i<4; i++) // i = raw_smp_processor_id();
  2454. + {
  2455. + unsigned int val = readl(__io_address(ARM_LOCAL_TIMER_INT_CONTROL0 + 4*i));
  2456. + writel(val | (1 << data), __io_address(ARM_LOCAL_TIMER_INT_CONTROL0 + 4*i));
  2457. + }
  2458. +#endif
  2459. + } else if (d->irq >= IRQ_ARM_LOCAL_MAILBOX0 && d->irq < IRQ_ARM_LOCAL_MAILBOX0 + 4) {
  2460. +#if 0
  2461. + unsigned int data = (unsigned int)irq_get_chip_data(d->irq) - IRQ_ARM_LOCAL_MAILBOX0;
  2462. + for (i=0; i<4; i++) {
  2463. + unsigned int val = readl(__io_address(ARM_LOCAL_MAILBOX_INT_CONTROL0 + 4*i));
  2464. + writel(val | (1 << data), __io_address(ARM_LOCAL_MAILBOX_INT_CONTROL0 + 4*i));
  2465. + }
  2466. +#endif
  2467. + } else if (d->irq >= ARM_IRQ1_BASE && d->irq < ARM_IRQ_LOCAL_BASE) {
  2468. + unsigned int data = (unsigned int)irq_get_chip_data(d->irq);
  2469. + writel(1 << (data & 0x1f), __io_address(enables[(data >> 5) & 0x3]));
  2470. + } else { printk("%s: %d\n", __func__, d->irq); BUG(); }
  2471. +}
  2472. +
  2473. +#ifdef CONFIG_OF
  2474. +
  2475. +#define NR_IRQS_BANK0 21
  2476. +#define NR_BANKS 4
  2477. +#define IRQS_PER_BANK 32
  2478. +
  2479. +/* from drivers/irqchip/irq-bcm2835.c */
  2480. +static int armctrl_xlate(struct irq_domain *d, struct device_node *ctrlr,
  2481. + const u32 *intspec, unsigned int intsize,
  2482. + unsigned long *out_hwirq, unsigned int *out_type)
  2483. +{
  2484. + if (WARN_ON(intsize != 2))
  2485. + return -EINVAL;
  2486. +
  2487. + if (WARN_ON(intspec[0] >= NR_BANKS))
  2488. + return -EINVAL;
  2489. +
  2490. + if (WARN_ON(intspec[1] >= IRQS_PER_BANK))
  2491. + return -EINVAL;
  2492. +
  2493. + if (WARN_ON(intspec[0] == 0 && intspec[1] >= NR_IRQS_BANK0))
  2494. + return -EINVAL;
  2495. +
  2496. + if (WARN_ON(intspec[0] == 3 && intspec[1] > 3 && intspec[1] != 5))
  2497. + return -EINVAL;
  2498. +
  2499. + if (intspec[0] == 0)
  2500. + *out_hwirq = ARM_IRQ0_BASE + intspec[1];
  2501. + else if (intspec[0] == 1)
  2502. + *out_hwirq = ARM_IRQ1_BASE + intspec[1];
  2503. + else if (intspec[0] == 2)
  2504. + *out_hwirq = ARM_IRQ2_BASE + intspec[1];
  2505. + else
  2506. + *out_hwirq = ARM_IRQ_LOCAL_BASE + intspec[1];
  2507. +
  2508. + /* reverse remap_irqs[] */
  2509. + switch (*out_hwirq) {
  2510. + case INTERRUPT_VC_JPEG:
  2511. + *out_hwirq = INTERRUPT_JPEG;
  2512. + break;
  2513. + case INTERRUPT_VC_USB:
  2514. + *out_hwirq = INTERRUPT_USB;
  2515. + break;
  2516. + case INTERRUPT_VC_3D:
  2517. + *out_hwirq = INTERRUPT_3D;
  2518. + break;
  2519. + case INTERRUPT_VC_DMA2:
  2520. + *out_hwirq = INTERRUPT_DMA2;
  2521. + break;
  2522. + case INTERRUPT_VC_DMA3:
  2523. + *out_hwirq = INTERRUPT_DMA3;
  2524. + break;
  2525. + case INTERRUPT_VC_I2C:
  2526. + *out_hwirq = INTERRUPT_I2C;
  2527. + break;
  2528. + case INTERRUPT_VC_SPI:
  2529. + *out_hwirq = INTERRUPT_SPI;
  2530. + break;
  2531. + case INTERRUPT_VC_I2SPCM:
  2532. + *out_hwirq = INTERRUPT_I2SPCM;
  2533. + break;
  2534. + case INTERRUPT_VC_SDIO:
  2535. + *out_hwirq = INTERRUPT_SDIO;
  2536. + break;
  2537. + case INTERRUPT_VC_UART:
  2538. + *out_hwirq = INTERRUPT_UART;
  2539. + break;
  2540. + case INTERRUPT_VC_ARASANSDIO:
  2541. + *out_hwirq = INTERRUPT_ARASANSDIO;
  2542. + break;
  2543. + }
  2544. +
  2545. + *out_type = IRQ_TYPE_NONE;
  2546. + return 0;
  2547. +}
  2548. +
  2549. +static struct irq_domain_ops armctrl_ops = {
  2550. + .xlate = armctrl_xlate
  2551. +};
  2552. +
  2553. +void __init armctrl_dt_init(void)
  2554. +{
  2555. + struct device_node *np;
  2556. + struct irq_domain *domain;
  2557. +
  2558. + np = of_find_compatible_node(NULL, NULL, "brcm,bcm2708-armctrl-ic");
  2559. + if (!np)
  2560. + return;
  2561. +
  2562. + domain = irq_domain_add_legacy(np, BCM2708_ALLOC_IRQS,
  2563. + IRQ_ARMCTRL_START, 0,
  2564. + &armctrl_ops, NULL);
  2565. + WARN_ON(!domain);
  2566. +}
  2567. +#else
  2568. +void __init armctrl_dt_init(void) { }
  2569. +#endif /* CONFIG_OF */
  2570. +
  2571. +#if defined(CONFIG_PM)
  2572. +
  2573. +/* for kernels 3.xx use the new syscore_ops apis but for older kernels use the sys dev class */
  2574. +
  2575. +/* Static defines
  2576. + * struct armctrl_device - VIC PM device (< 3.xx)
  2577. + * @sysdev: The system device which is registered. (< 3.xx)
  2578. + * @irq: The IRQ number for the base of the VIC.
  2579. + * @base: The register base for the VIC.
  2580. + * @resume_sources: A bitmask of interrupts for resume.
  2581. + * @resume_irqs: The IRQs enabled for resume.
  2582. + * @int_select: Save for VIC_INT_SELECT.
  2583. + * @int_enable: Save for VIC_INT_ENABLE.
  2584. + * @soft_int: Save for VIC_INT_SOFT.
  2585. + * @protect: Save for VIC_PROTECT.
  2586. + */
  2587. +struct armctrl_info {
  2588. + void __iomem *base;
  2589. + int irq;
  2590. + u32 resume_sources;
  2591. + u32 resume_irqs;
  2592. + u32 int_select;
  2593. + u32 int_enable;
  2594. + u32 soft_int;
  2595. + u32 protect;
  2596. +} armctrl;
  2597. +
  2598. +static int armctrl_suspend(void)
  2599. +{
  2600. + return 0;
  2601. +}
  2602. +
  2603. +static void armctrl_resume(void)
  2604. +{
  2605. + return;
  2606. +}
  2607. +
  2608. +/**
  2609. + * armctrl_pm_register - Register a VIC for later power management control
  2610. + * @base: The base address of the VIC.
  2611. + * @irq: The base IRQ for the VIC.
  2612. + * @resume_sources: bitmask of interrupts allowed for resume sources.
  2613. + *
  2614. + * For older kernels (< 3.xx) do -
  2615. + * Register the VIC with the system device tree so that it can be notified
  2616. + * of suspend and resume requests and ensure that the correct actions are
  2617. + * taken to re-instate the settings on resume.
  2618. + */
  2619. +static void __init armctrl_pm_register(void __iomem * base, unsigned int irq,
  2620. + u32 resume_sources)
  2621. +{
  2622. + armctrl.base = base;
  2623. + armctrl.resume_sources = resume_sources;
  2624. + armctrl.irq = irq;
  2625. +}
  2626. +
  2627. +static int armctrl_set_wake(struct irq_data *d, unsigned int on)
  2628. +{
  2629. + unsigned int off = d->irq & 31;
  2630. + u32 bit = 1 << off;
  2631. +
  2632. + if (!(bit & armctrl.resume_sources))
  2633. + return -EINVAL;
  2634. +
  2635. + if (on)
  2636. + armctrl.resume_irqs |= bit;
  2637. + else
  2638. + armctrl.resume_irqs &= ~bit;
  2639. +
  2640. + return 0;
  2641. +}
  2642. +
  2643. +#else
  2644. +static inline void armctrl_pm_register(void __iomem * base, unsigned int irq,
  2645. + u32 arg1)
  2646. +{
  2647. +}
  2648. +
  2649. +#define armctrl_suspend NULL
  2650. +#define armctrl_resume NULL
  2651. +#define armctrl_set_wake NULL
  2652. +#endif /* CONFIG_PM */
  2653. +
  2654. +static struct syscore_ops armctrl_syscore_ops = {
  2655. + .suspend = armctrl_suspend,
  2656. + .resume = armctrl_resume,
  2657. +};
  2658. +
  2659. +/**
  2660. + * armctrl_syscore_init - initicall to register VIC pm functions
  2661. + *
  2662. + * This is called via late_initcall() to register
  2663. + * the resources for the VICs due to the early
  2664. + * nature of the VIC's registration.
  2665. +*/
  2666. +static int __init armctrl_syscore_init(void)
  2667. +{
  2668. + register_syscore_ops(&armctrl_syscore_ops);
  2669. + return 0;
  2670. +}
  2671. +
  2672. +late_initcall(armctrl_syscore_init);
  2673. +
  2674. +static struct irq_chip armctrl_chip = {
  2675. + .name = "ARMCTRL",
  2676. + .irq_ack = NULL,
  2677. + .irq_mask = armctrl_mask_irq,
  2678. + .irq_unmask = armctrl_unmask_irq,
  2679. + .irq_set_wake = armctrl_set_wake,
  2680. +};
  2681. +
  2682. +/**
  2683. + * armctrl_init - initialise a vectored interrupt controller
  2684. + * @base: iomem base address
  2685. + * @irq_start: starting interrupt number, must be muliple of 32
  2686. + * @armctrl_sources: bitmask of interrupt sources to allow
  2687. + * @resume_sources: bitmask of interrupt sources to allow for resume
  2688. + */
  2689. +int __init armctrl_init(void __iomem * base, unsigned int irq_start,
  2690. + u32 armctrl_sources, u32 resume_sources)
  2691. +{
  2692. + unsigned int irq;
  2693. +
  2694. + for (irq = 0; irq < BCM2708_ALLOC_IRQS; irq++) {
  2695. + unsigned int data = irq;
  2696. + if (irq >= INTERRUPT_JPEG && irq <= INTERRUPT_ARASANSDIO)
  2697. + data = remap_irqs[irq - INTERRUPT_JPEG];
  2698. + if (irq >= IRQ_ARM_LOCAL_CNTPSIRQ && irq <= IRQ_ARM_LOCAL_TIMER) {
  2699. + irq_set_percpu_devid(irq);
  2700. + irq_set_chip_and_handler(irq, &armctrl_chip, handle_percpu_devid_irq);
  2701. + set_irq_flags(irq, IRQF_VALID | IRQF_NOAUTOEN);
  2702. + } else {
  2703. + irq_set_chip_and_handler(irq, &armctrl_chip, handle_level_irq);
  2704. + set_irq_flags(irq, IRQF_VALID | IRQF_PROBE | IRQF_DISABLED);
  2705. + }
  2706. + irq_set_chip_data(irq, (void *)data);
  2707. + }
  2708. +
  2709. + armctrl_pm_register(base, irq_start, resume_sources);
  2710. + init_FIQ(FIQ_START);
  2711. + armctrl_dt_init();
  2712. + return 0;
  2713. +}
  2714. --- /dev/null
  2715. +++ b/arch/arm/mach-bcm2709/armctrl.h
  2716. @@ -0,0 +1,27 @@
  2717. +/*
  2718. + * linux/arch/arm/mach-bcm2708/armctrl.h
  2719. + *
  2720. + * Copyright (C) 2010 Broadcom
  2721. + *
  2722. + * This program is free software; you can redistribute it and/or modify
  2723. + * it under the terms of the GNU General Public License as published by
  2724. + * the Free Software Foundation; either version 2 of the License, or
  2725. + * (at your option) any later version.
  2726. + *
  2727. + * This program is distributed in the hope that it will be useful,
  2728. + * but WITHOUT ANY WARRANTY; without even the implied warranty of
  2729. + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  2730. + * GNU General Public License for more details.
  2731. + *
  2732. + * You should have received a copy of the GNU General Public License
  2733. + * along with this program; if not, write to the Free Software
  2734. + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
  2735. + */
  2736. +
  2737. +#ifndef __BCM2708_ARMCTRL_H
  2738. +#define __BCM2708_ARMCTRL_H
  2739. +
  2740. +extern int __init armctrl_init(void __iomem * base, unsigned int irq_start,
  2741. + u32 armctrl_sources, u32 resume_sources);
  2742. +
  2743. +#endif
  2744. --- /dev/null
  2745. +++ b/arch/arm/mach-bcm2709/bcm2708_gpio.c
  2746. @@ -0,0 +1,426 @@
  2747. +/*
  2748. + * linux/arch/arm/mach-bcm2708/bcm2708_gpio.c
  2749. + *
  2750. + * Copyright (C) 2010 Broadcom
  2751. + *
  2752. + * This program is free software; you can redistribute it and/or modify
  2753. + * it under the terms of the GNU General Public License version 2 as
  2754. + * published by the Free Software Foundation.
  2755. + *
  2756. + */
  2757. +
  2758. +#include <linux/spinlock.h>
  2759. +#include <linux/module.h>
  2760. +#include <linux/delay.h>
  2761. +#include <linux/list.h>
  2762. +#include <linux/io.h>
  2763. +#include <linux/irq.h>
  2764. +#include <linux/interrupt.h>
  2765. +#include <linux/slab.h>
  2766. +#include <mach/gpio.h>
  2767. +#include <linux/gpio.h>
  2768. +#include <linux/platform_device.h>
  2769. +#include <mach/platform.h>
  2770. +#include <linux/pinctrl/consumer.h>
  2771. +
  2772. +#include <linux/platform_data/bcm2708.h>
  2773. +
  2774. +#define BCM_GPIO_DRIVER_NAME "bcm2708_gpio"
  2775. +#define DRIVER_NAME BCM_GPIO_DRIVER_NAME
  2776. +#define BCM_GPIO_USE_IRQ 1
  2777. +
  2778. +#define GPIOFSEL(x) (0x00+(x)*4)
  2779. +#define GPIOSET(x) (0x1c+(x)*4)
  2780. +#define GPIOCLR(x) (0x28+(x)*4)
  2781. +#define GPIOLEV(x) (0x34+(x)*4)
  2782. +#define GPIOEDS(x) (0x40+(x)*4)
  2783. +#define GPIOREN(x) (0x4c+(x)*4)
  2784. +#define GPIOFEN(x) (0x58+(x)*4)
  2785. +#define GPIOHEN(x) (0x64+(x)*4)
  2786. +#define GPIOLEN(x) (0x70+(x)*4)
  2787. +#define GPIOAREN(x) (0x7c+(x)*4)
  2788. +#define GPIOAFEN(x) (0x88+(x)*4)
  2789. +#define GPIOUD(x) (0x94+(x)*4)
  2790. +#define GPIOUDCLK(x) (0x98+(x)*4)
  2791. +
  2792. +#define GPIO_BANKS 2
  2793. +
  2794. +enum { GPIO_FSEL_INPUT, GPIO_FSEL_OUTPUT,
  2795. + GPIO_FSEL_ALT5, GPIO_FSEL_ALT_4,
  2796. + GPIO_FSEL_ALT0, GPIO_FSEL_ALT1,
  2797. + GPIO_FSEL_ALT2, GPIO_FSEL_ALT3,
  2798. +};
  2799. +
  2800. + /* Each of the two spinlocks protects a different set of hardware
  2801. + * regiters and data structurs. This decouples the code of the IRQ from
  2802. + * the GPIO code. This also makes the case of a GPIO routine call from
  2803. + * the IRQ code simpler.
  2804. + */
  2805. +static DEFINE_SPINLOCK(lock); /* GPIO registers */
  2806. +
  2807. +struct bcm2708_gpio {
  2808. + struct list_head list;
  2809. + void __iomem *base;
  2810. + struct gpio_chip gc;
  2811. + unsigned long rising[(BCM2708_NR_GPIOS + 31) / 32];
  2812. + unsigned long falling[(BCM2708_NR_GPIOS + 31) / 32];
  2813. + unsigned long high[(BCM2708_NR_GPIOS + 31) / 32];
  2814. + unsigned long low[(BCM2708_NR_GPIOS + 31) / 32];
  2815. +};
  2816. +
  2817. +static int bcm2708_set_function(struct gpio_chip *gc, unsigned offset,
  2818. + int function)
  2819. +{
  2820. + struct bcm2708_gpio *gpio = container_of(gc, struct bcm2708_gpio, gc);
  2821. + unsigned long flags;
  2822. + unsigned gpiodir;
  2823. + unsigned gpio_bank = offset / 10;
  2824. + unsigned gpio_field_offset = (offset - 10 * gpio_bank) * 3;
  2825. +
  2826. +//printk(KERN_ERR DRIVER_NAME ": bcm2708_gpio_set_function %p (%d,%d)\n", gc, offset, function);
  2827. + if (offset >= BCM2708_NR_GPIOS)
  2828. + return -EINVAL;
  2829. +
  2830. + spin_lock_irqsave(&lock, flags);
  2831. +
  2832. + gpiodir = readl(gpio->base + GPIOFSEL(gpio_bank));
  2833. + gpiodir &= ~(7 << gpio_field_offset);
  2834. + gpiodir |= function << gpio_field_offset;
  2835. + writel(gpiodir, gpio->base + GPIOFSEL(gpio_bank));
  2836. + spin_unlock_irqrestore(&lock, flags);
  2837. + gpiodir = readl(gpio->base + GPIOFSEL(gpio_bank));
  2838. +
  2839. + return 0;
  2840. +}
  2841. +
  2842. +static int bcm2708_gpio_dir_in(struct gpio_chip *gc, unsigned offset)
  2843. +{
  2844. + return bcm2708_set_function(gc, offset, GPIO_FSEL_INPUT);
  2845. +}
  2846. +
  2847. +static void bcm2708_gpio_set(struct gpio_chip *gc, unsigned offset, int value);
  2848. +static int bcm2708_gpio_dir_out(struct gpio_chip *gc, unsigned offset,
  2849. + int value)
  2850. +{
  2851. + int ret;
  2852. + ret = bcm2708_set_function(gc, offset, GPIO_FSEL_OUTPUT);
  2853. + if (ret >= 0)
  2854. + bcm2708_gpio_set(gc, offset, value);
  2855. + return ret;
  2856. +}
  2857. +
  2858. +static int bcm2708_gpio_get(struct gpio_chip *gc, unsigned offset)
  2859. +{
  2860. + struct bcm2708_gpio *gpio = container_of(gc, struct bcm2708_gpio, gc);
  2861. + unsigned gpio_bank = offset / 32;
  2862. + unsigned gpio_field_offset = (offset - 32 * gpio_bank);
  2863. + unsigned lev;
  2864. +
  2865. + if (offset >= BCM2708_NR_GPIOS)
  2866. + return 0;
  2867. + lev = readl(gpio->base + GPIOLEV(gpio_bank));
  2868. +//printk(KERN_ERR DRIVER_NAME ": bcm2708_gpio_get %p (%d)=%d\n", gc, offset, 0x1 & (lev>>gpio_field_offset));
  2869. + return 0x1 & (lev >> gpio_field_offset);
  2870. +}
  2871. +
  2872. +static void bcm2708_gpio_set(struct gpio_chip *gc, unsigned offset, int value)
  2873. +{
  2874. + struct bcm2708_gpio *gpio = container_of(gc, struct bcm2708_gpio, gc);
  2875. + unsigned gpio_bank = offset / 32;
  2876. + unsigned gpio_field_offset = (offset - 32 * gpio_bank);
  2877. +//printk(KERN_ERR DRIVER_NAME ": bcm2708_gpio_set %p (%d=%d)\n", gc, offset, value);
  2878. + if (offset >= BCM2708_NR_GPIOS)
  2879. + return;
  2880. + if (value)
  2881. + writel(1 << gpio_field_offset, gpio->base + GPIOSET(gpio_bank));
  2882. + else
  2883. + writel(1 << gpio_field_offset, gpio->base + GPIOCLR(gpio_bank));
  2884. +}
  2885. +
  2886. +/**********************
  2887. + * extension to configure pullups
  2888. + */
  2889. +int bcm2708_gpio_setpull(struct gpio_chip *gc, unsigned offset,
  2890. + bcm2708_gpio_pull_t value)
  2891. +{
  2892. + struct bcm2708_gpio *gpio = container_of(gc, struct bcm2708_gpio, gc);
  2893. + unsigned gpio_bank = offset / 32;
  2894. + unsigned gpio_field_offset = (offset - 32 * gpio_bank);
  2895. +
  2896. + if (offset >= BCM2708_NR_GPIOS)
  2897. + return -EINVAL;
  2898. +
  2899. + switch (value) {
  2900. + case BCM2708_PULL_UP:
  2901. + writel(2, gpio->base + GPIOUD(0));
  2902. + break;
  2903. + case BCM2708_PULL_DOWN:
  2904. + writel(1, gpio->base + GPIOUD(0));
  2905. + break;
  2906. + case BCM2708_PULL_OFF:
  2907. + writel(0, gpio->base + GPIOUD(0));
  2908. + break;
  2909. + }
  2910. +
  2911. + udelay(5);
  2912. + writel(1 << gpio_field_offset, gpio->base + GPIOUDCLK(gpio_bank));
  2913. + udelay(5);
  2914. + writel(0, gpio->base + GPIOUD(0));
  2915. + writel(0 << gpio_field_offset, gpio->base + GPIOUDCLK(gpio_bank));
  2916. +
  2917. + return 0;
  2918. +}
  2919. +EXPORT_SYMBOL(bcm2708_gpio_setpull);
  2920. +
  2921. +/*************************************************************************************************************************
  2922. + * bcm2708 GPIO IRQ
  2923. + */
  2924. +
  2925. +#if BCM_GPIO_USE_IRQ
  2926. +
  2927. +static int bcm2708_gpio_to_irq(struct gpio_chip *chip, unsigned gpio)
  2928. +{
  2929. + return gpio_to_irq(gpio);
  2930. +}
  2931. +
  2932. +static int bcm2708_gpio_irq_set_type(struct irq_data *d, unsigned type)
  2933. +{
  2934. + unsigned irq = d->irq;
  2935. + struct bcm2708_gpio *gpio = irq_get_chip_data(irq);
  2936. + unsigned gn = irq_to_gpio(irq);
  2937. + unsigned gb = gn / 32;
  2938. + unsigned go = gn % 32;
  2939. +
  2940. + gpio->rising[gb] &= ~(1 << go);
  2941. + gpio->falling[gb] &= ~(1 << go);
  2942. + gpio->high[gb] &= ~(1 << go);
  2943. + gpio->low[gb] &= ~(1 << go);
  2944. +
  2945. + if (type & ~(IRQ_TYPE_EDGE_FALLING | IRQ_TYPE_EDGE_RISING | IRQ_TYPE_LEVEL_LOW | IRQ_TYPE_LEVEL_HIGH))
  2946. + return -EINVAL;
  2947. +
  2948. + if (type & IRQ_TYPE_EDGE_RISING)
  2949. + gpio->rising[gb] |= (1 << go);
  2950. + if (type & IRQ_TYPE_EDGE_FALLING)
  2951. + gpio->falling[gb] |= (1 << go);
  2952. + if (type & IRQ_TYPE_LEVEL_HIGH)
  2953. + gpio->high[gb] |= (1 << go);
  2954. + if (type & IRQ_TYPE_LEVEL_LOW)
  2955. + gpio->low[gb] |= (1 << go);
  2956. + return 0;
  2957. +}
  2958. +
  2959. +static void bcm2708_gpio_irq_mask(struct irq_data *d)
  2960. +{
  2961. + unsigned irq = d->irq;
  2962. + struct bcm2708_gpio *gpio = irq_get_chip_data(irq);
  2963. + unsigned gn = irq_to_gpio(irq);
  2964. + unsigned gb = gn / 32;
  2965. + unsigned long rising = readl(gpio->base + GPIOREN(gb));
  2966. + unsigned long falling = readl(gpio->base + GPIOFEN(gb));
  2967. + unsigned long high = readl(gpio->base + GPIOHEN(gb));
  2968. + unsigned long low = readl(gpio->base + GPIOLEN(gb));
  2969. +
  2970. + gn = gn % 32;
  2971. +
  2972. + writel(rising & ~(1 << gn), gpio->base + GPIOREN(gb));
  2973. + writel(falling & ~(1 << gn), gpio->base + GPIOFEN(gb));
  2974. + writel(high & ~(1 << gn), gpio->base + GPIOHEN(gb));
  2975. + writel(low & ~(1 << gn), gpio->base + GPIOLEN(gb));
  2976. +}
  2977. +
  2978. +static void bcm2708_gpio_irq_unmask(struct irq_data *d)
  2979. +{
  2980. + unsigned irq = d->irq;
  2981. + struct bcm2708_gpio *gpio = irq_get_chip_data(irq);
  2982. + unsigned gn = irq_to_gpio(irq);
  2983. + unsigned gb = gn / 32;
  2984. + unsigned go = gn % 32;
  2985. + unsigned long rising = readl(gpio->base + GPIOREN(gb));
  2986. + unsigned long falling = readl(gpio->base + GPIOFEN(gb));
  2987. + unsigned long high = readl(gpio->base + GPIOHEN(gb));
  2988. + unsigned long low = readl(gpio->base + GPIOLEN(gb));
  2989. +
  2990. + if (gpio->rising[gb] & (1 << go)) {
  2991. + writel(rising | (1 << go), gpio->base + GPIOREN(gb));
  2992. + } else {
  2993. + writel(rising & ~(1 << go), gpio->base + GPIOREN(gb));
  2994. + }
  2995. +
  2996. + if (gpio->falling[gb] & (1 << go)) {
  2997. + writel(falling | (1 << go), gpio->base + GPIOFEN(gb));
  2998. + } else {
  2999. + writel(falling & ~(1 << go), gpio->base + GPIOFEN(gb));
  3000. + }
  3001. +
  3002. + if (gpio->high[gb] & (1 << go)) {
  3003. + writel(high | (1 << go), gpio->base + GPIOHEN(gb));
  3004. + } else {
  3005. + writel(high & ~(1 << go), gpio->base + GPIOHEN(gb));
  3006. + }
  3007. +
  3008. + if (gpio->low[gb] & (1 << go)) {
  3009. + writel(low | (1 << go), gpio->base + GPIOLEN(gb));
  3010. + } else {
  3011. + writel(low & ~(1 << go), gpio->base + GPIOLEN(gb));
  3012. + }
  3013. +}
  3014. +
  3015. +static struct irq_chip bcm2708_irqchip = {
  3016. + .name = "GPIO",
  3017. + .irq_enable = bcm2708_gpio_irq_unmask,
  3018. + .irq_disable = bcm2708_gpio_irq_mask,
  3019. + .irq_unmask = bcm2708_gpio_irq_unmask,
  3020. + .irq_mask = bcm2708_gpio_irq_mask,
  3021. + .irq_set_type = bcm2708_gpio_irq_set_type,
  3022. +};
  3023. +
  3024. +static irqreturn_t bcm2708_gpio_interrupt(int irq, void *dev_id)
  3025. +{
  3026. + unsigned long edsr;
  3027. + unsigned bank;
  3028. + int i;
  3029. + unsigned gpio;
  3030. + unsigned level_bits;
  3031. + struct bcm2708_gpio *gpio_data = dev_id;
  3032. +
  3033. + for (bank = 0; bank < GPIO_BANKS; bank++) {
  3034. + edsr = readl(__io_address(GPIO_BASE) + GPIOEDS(bank));
  3035. + level_bits = gpio_data->high[bank] | gpio_data->low[bank];
  3036. +
  3037. + for_each_set_bit(i, &edsr, 32) {
  3038. + gpio = i + bank * 32;
  3039. + /* ack edge triggered IRQs immediately */
  3040. + if (!(level_bits & (1<<i)))
  3041. + writel(1<<i,
  3042. + __io_address(GPIO_BASE) + GPIOEDS(bank));
  3043. + generic_handle_irq(gpio_to_irq(gpio));
  3044. + /* ack level triggered IRQ after handling them */
  3045. + if (level_bits & (1<<i))
  3046. + writel(1<<i,
  3047. + __io_address(GPIO_BASE) + GPIOEDS(bank));
  3048. + }
  3049. + }
  3050. + return IRQ_HANDLED;
  3051. +}
  3052. +
  3053. +static struct irqaction bcm2708_gpio_irq = {
  3054. + .name = "BCM2708 GPIO catchall handler",
  3055. + .flags = IRQF_DISABLED | IRQF_TIMER | IRQF_IRQPOLL,
  3056. + .handler = bcm2708_gpio_interrupt,
  3057. +};
  3058. +
  3059. +static void bcm2708_gpio_irq_init(struct bcm2708_gpio *ucb)
  3060. +{
  3061. + unsigned irq;
  3062. +
  3063. + ucb->gc.to_irq = bcm2708_gpio_to_irq;
  3064. +
  3065. + for (irq = GPIO_IRQ_START; irq < (GPIO_IRQ_START + GPIO_IRQS); irq++) {
  3066. + irq_set_chip_data(irq, ucb);
  3067. + irq_set_chip_and_handler(irq, &bcm2708_irqchip,
  3068. + handle_simple_irq);
  3069. + set_irq_flags(irq, IRQF_VALID);
  3070. + }
  3071. +
  3072. + bcm2708_gpio_irq.dev_id = ucb;
  3073. + setup_irq(IRQ_GPIO3, &bcm2708_gpio_irq);
  3074. +}
  3075. +
  3076. +#else
  3077. +
  3078. +static void bcm2708_gpio_irq_init(struct bcm2708_gpio *ucb)
  3079. +{
  3080. +}
  3081. +
  3082. +#endif /* #if BCM_GPIO_USE_IRQ ***************************************************************************************************************** */
  3083. +
  3084. +static int bcm2708_gpio_probe(struct platform_device *dev)
  3085. +{
  3086. + struct bcm2708_gpio *ucb;
  3087. + struct resource *res;
  3088. + int bank;
  3089. + int err = 0;
  3090. +
  3091. + printk(KERN_INFO DRIVER_NAME ": bcm2708_gpio_probe %p\n", dev);
  3092. +
  3093. + ucb = kzalloc(sizeof(*ucb), GFP_KERNEL);
  3094. + if (NULL == ucb) {
  3095. + printk(KERN_ERR DRIVER_NAME ": failed to allocate "
  3096. + "mailbox memory\n");
  3097. + err = -ENOMEM;
  3098. + goto err;
  3099. + }
  3100. +
  3101. + res = platform_get_resource(dev, IORESOURCE_MEM, 0);
  3102. +
  3103. + platform_set_drvdata(dev, ucb);
  3104. + ucb->base = __io_address(GPIO_BASE);
  3105. +
  3106. + ucb->gc.label = "bcm2708_gpio";
  3107. + ucb->gc.base = 0;
  3108. + ucb->gc.ngpio = BCM2708_NR_GPIOS;
  3109. + ucb->gc.owner = THIS_MODULE;
  3110. +
  3111. + ucb->gc.direction_input = bcm2708_gpio_dir_in;
  3112. + ucb->gc.direction_output = bcm2708_gpio_dir_out;
  3113. + ucb->gc.get = bcm2708_gpio_get;
  3114. + ucb->gc.set = bcm2708_gpio_set;
  3115. + ucb->gc.can_sleep = 0;
  3116. +
  3117. + for (bank = 0; bank < GPIO_BANKS; bank++) {
  3118. + writel(0, ucb->base + GPIOREN(bank));
  3119. + writel(0, ucb->base + GPIOFEN(bank));
  3120. + writel(0, ucb->base + GPIOHEN(bank));
  3121. + writel(0, ucb->base + GPIOLEN(bank));
  3122. + writel(0, ucb->base + GPIOAREN(bank));
  3123. + writel(0, ucb->base + GPIOAFEN(bank));
  3124. + writel(~0, ucb->base + GPIOEDS(bank));
  3125. + }
  3126. +
  3127. + bcm2708_gpio_irq_init(ucb);
  3128. +
  3129. + err = gpiochip_add(&ucb->gc);
  3130. +
  3131. +err:
  3132. + return err;
  3133. +
  3134. +}
  3135. +
  3136. +static int bcm2708_gpio_remove(struct platform_device *dev)
  3137. +{
  3138. + int err = 0;
  3139. + struct bcm2708_gpio *ucb = platform_get_drvdata(dev);
  3140. +
  3141. + printk(KERN_ERR DRIVER_NAME ": bcm2708_gpio_remove %p\n", dev);
  3142. +
  3143. + gpiochip_remove(&ucb->gc);
  3144. +
  3145. + platform_set_drvdata(dev, NULL);
  3146. + kfree(ucb);
  3147. +
  3148. + return err;
  3149. +}
  3150. +
  3151. +static struct platform_driver bcm2708_gpio_driver = {
  3152. + .probe = bcm2708_gpio_probe,
  3153. + .remove = bcm2708_gpio_remove,
  3154. + .driver = {
  3155. + .name = "bcm2708_gpio"},
  3156. +};
  3157. +
  3158. +static int __init bcm2708_gpio_init(void)
  3159. +{
  3160. + return platform_driver_register(&bcm2708_gpio_driver);
  3161. +}
  3162. +
  3163. +static void __exit bcm2708_gpio_exit(void)
  3164. +{
  3165. + platform_driver_unregister(&bcm2708_gpio_driver);
  3166. +}
  3167. +
  3168. +module_init(bcm2708_gpio_init);
  3169. +module_exit(bcm2708_gpio_exit);
  3170. +
  3171. +MODULE_DESCRIPTION("Broadcom BCM2708 GPIO driver");
  3172. +MODULE_LICENSE("GPL");
  3173. --- /dev/null
  3174. +++ b/arch/arm/mach-bcm2709/bcm2709.c
  3175. @@ -0,0 +1,1237 @@
  3176. +/*
  3177. + * linux/arch/arm/mach-bcm2709/bcm2709.c
  3178. + *
  3179. + * Copyright (C) 2010 Broadcom
  3180. + *
  3181. + * This program is free software; you can redistribute it and/or modify
  3182. + * it under the terms of the GNU General Public License as published by
  3183. + * the Free Software Foundation; either version 2 of the License, or
  3184. + * (at your option) any later version.
  3185. + *
  3186. + * This program is distributed in the hope that it will be useful,
  3187. + * but WITHOUT ANY WARRANTY; without even the implied warranty of
  3188. + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  3189. + * GNU General Public License for more details.
  3190. + *
  3191. + * You should have received a copy of the GNU General Public License
  3192. + * along with this program; if not, write to the Free Software
  3193. + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
  3194. + */
  3195. +
  3196. +#include <linux/init.h>
  3197. +#include <linux/device.h>
  3198. +#include <linux/dma-mapping.h>
  3199. +#include <linux/serial_8250.h>
  3200. +#include <linux/platform_device.h>
  3201. +#include <linux/syscore_ops.h>
  3202. +#include <linux/interrupt.h>
  3203. +#include <linux/amba/bus.h>
  3204. +#include <linux/amba/clcd.h>
  3205. +#include <linux/clk-provider.h>
  3206. +#include <linux/clkdev.h>
  3207. +#include <linux/clockchips.h>
  3208. +#include <linux/cnt32_to_63.h>
  3209. +#include <linux/io.h>
  3210. +#include <linux/module.h>
  3211. +#include <linux/of_platform.h>
  3212. +#include <linux/spi/spi.h>
  3213. +#include <linux/gpio/machine.h>
  3214. +#include <linux/w1-gpio.h>
  3215. +
  3216. +#include <linux/version.h>
  3217. +#include <linux/clkdev.h>
  3218. +#include <asm/system_info.h>
  3219. +#include <mach/hardware.h>
  3220. +#include <asm/irq.h>
  3221. +#include <linux/leds.h>
  3222. +#include <asm/mach-types.h>
  3223. +#include <asm/cputype.h>
  3224. +#include <linux/sched_clock.h>
  3225. +
  3226. +#include <asm/mach/arch.h>
  3227. +#include <asm/mach/flash.h>
  3228. +#include <asm/mach/irq.h>
  3229. +#include <asm/mach/time.h>
  3230. +#include <asm/mach/map.h>
  3231. +
  3232. +#include <mach/timex.h>
  3233. +#include <mach/dma.h>
  3234. +#include <mach/vcio.h>
  3235. +#include <mach/system.h>
  3236. +
  3237. +#include <linux/delay.h>
  3238. +
  3239. +#include "bcm2709.h"
  3240. +#include "armctrl.h"
  3241. +
  3242. +#ifdef CONFIG_BCM_VC_CMA
  3243. +#include <linux/broadcom/vc_cma.h>
  3244. +#endif
  3245. +
  3246. +//#define SYSTEM_TIMER
  3247. +
  3248. +/* Effectively we have an IOMMU (ARM<->VideoCore map) that is set up to
  3249. + * give us IO access only to 64Mbytes of physical memory (26 bits). We could
  3250. + * represent this window by setting our dmamasks to 26 bits but, in fact
  3251. + * we're not going to use addresses outside this range (they're not in real
  3252. + * memory) so we don't bother.
  3253. + *
  3254. + * In the future we might include code to use this IOMMU to remap other
  3255. + * physical addresses onto VideoCore memory then the use of 32-bits would be
  3256. + * more legitimate.
  3257. + */
  3258. +#define DMA_MASK_BITS_COMMON 32
  3259. +
  3260. +// use GPIO 4 for the one-wire GPIO pin, if enabled
  3261. +#define W1_GPIO 4
  3262. +// ensure one-wire GPIO pullup is disabled by default
  3263. +#define W1_PULLUP -1
  3264. +
  3265. +/* command line parameters */
  3266. +static unsigned boardrev, serial;
  3267. +static unsigned uart_clock = UART0_CLOCK;
  3268. +static unsigned disk_led_gpio = 16;
  3269. +static unsigned disk_led_active_low = 1;
  3270. +static unsigned reboot_part = 0;
  3271. +static unsigned w1_gpio_pin = W1_GPIO;
  3272. +static unsigned w1_gpio_pullup = W1_PULLUP;
  3273. +
  3274. +static unsigned use_dt = 0;
  3275. +
  3276. +static void __init bcm2709_init_led(void);
  3277. +
  3278. +void __init bcm2709_init_irq(void)
  3279. +{
  3280. + armctrl_init(__io_address(ARMCTRL_IC_BASE), 0, 0, 0);
  3281. +}
  3282. +
  3283. +static struct map_desc bcm2709_io_desc[] __initdata = {
  3284. + {
  3285. + .virtual = IO_ADDRESS(ARMCTRL_BASE),
  3286. + .pfn = __phys_to_pfn(ARMCTRL_BASE),
  3287. + .length = SZ_4K,
  3288. + .type = MT_DEVICE},
  3289. + {
  3290. + .virtual = IO_ADDRESS(UART0_BASE),
  3291. + .pfn = __phys_to_pfn(UART0_BASE),
  3292. + .length = SZ_4K,
  3293. + .type = MT_DEVICE},
  3294. + {
  3295. + .virtual = IO_ADDRESS(UART1_BASE),
  3296. + .pfn = __phys_to_pfn(UART1_BASE),
  3297. + .length = SZ_4K,
  3298. + .type = MT_DEVICE},
  3299. + {
  3300. + .virtual = IO_ADDRESS(DMA_BASE),
  3301. + .pfn = __phys_to_pfn(DMA_BASE),
  3302. + .length = SZ_4K,
  3303. + .type = MT_DEVICE},
  3304. + {
  3305. + .virtual = IO_ADDRESS(MCORE_BASE),
  3306. + .pfn = __phys_to_pfn(MCORE_BASE),
  3307. + .length = SZ_4K,
  3308. + .type = MT_DEVICE},
  3309. + {
  3310. + .virtual = IO_ADDRESS(ST_BASE),
  3311. + .pfn = __phys_to_pfn(ST_BASE),
  3312. + .length = SZ_4K,
  3313. + .type = MT_DEVICE},
  3314. + {
  3315. + .virtual = IO_ADDRESS(USB_BASE),
  3316. + .pfn = __phys_to_pfn(USB_BASE),
  3317. + .length = SZ_128K,
  3318. + .type = MT_DEVICE},
  3319. + {
  3320. + .virtual = IO_ADDRESS(PM_BASE),
  3321. + .pfn = __phys_to_pfn(PM_BASE),
  3322. + .length = SZ_4K,
  3323. + .type = MT_DEVICE},
  3324. + {
  3325. + .virtual = IO_ADDRESS(GPIO_BASE),
  3326. + .pfn = __phys_to_pfn(GPIO_BASE),
  3327. + .length = SZ_4K,
  3328. + .type = MT_DEVICE},
  3329. + {
  3330. + .virtual = IO_ADDRESS(ARM_LOCAL_BASE),
  3331. + .pfn = __phys_to_pfn(ARM_LOCAL_BASE),
  3332. + .length = SZ_4K,
  3333. + .type = MT_DEVICE},
  3334. +};
  3335. +
  3336. +void __init bcm2709_map_io(void)
  3337. +{
  3338. + iotable_init(bcm2709_io_desc, ARRAY_SIZE(bcm2709_io_desc));
  3339. +}
  3340. +
  3341. +#ifdef SYSTEM_TIMER
  3342. +
  3343. +/* The STC is a free running counter that increments at the rate of 1MHz */
  3344. +#define STC_FREQ_HZ 1000000
  3345. +
  3346. +static inline uint32_t timer_read(void)
  3347. +{
  3348. + /* STC: a free running counter that increments at the rate of 1MHz */
  3349. + return readl(__io_address(ST_BASE + 0x04));
  3350. +}
  3351. +
  3352. +static unsigned long bcm2709_read_current_timer(void)
  3353. +{
  3354. + return timer_read();
  3355. +}
  3356. +
  3357. +static u64 notrace bcm2709_read_sched_clock(void)
  3358. +{
  3359. + return timer_read();
  3360. +}
  3361. +
  3362. +static cycle_t clksrc_read(struct clocksource *cs)
  3363. +{
  3364. + return timer_read();
  3365. +}
  3366. +
  3367. +static struct clocksource clocksource_stc = {
  3368. + .name = "stc",
  3369. + .rating = 300,
  3370. + .read = clksrc_read,
  3371. + .mask = CLOCKSOURCE_MASK(32),
  3372. + .flags = CLOCK_SOURCE_IS_CONTINUOUS,
  3373. +};
  3374. +
  3375. +unsigned long frc_clock_ticks32(void)
  3376. +{
  3377. + return timer_read();
  3378. +}
  3379. +
  3380. +static void __init bcm2709_clocksource_init(void)
  3381. +{
  3382. + if (clocksource_register_hz(&clocksource_stc, STC_FREQ_HZ)) {
  3383. + printk(KERN_ERR "timer: failed to initialize clock "
  3384. + "source %s\n", clocksource_stc.name);
  3385. + }
  3386. +}
  3387. +#endif
  3388. +
  3389. +struct clk __init *bcm2709_clk_register(const char *name, unsigned long fixed_rate)
  3390. +{
  3391. + struct clk *clk;
  3392. +
  3393. + clk = clk_register_fixed_rate(NULL, name, NULL, CLK_IS_ROOT,
  3394. + fixed_rate);
  3395. + if (IS_ERR(clk))
  3396. + pr_err("%s not registered\n", name);
  3397. +
  3398. + return clk;
  3399. +}
  3400. +
  3401. +void __init bcm2709_register_clkdev(struct clk *clk, const char *name)
  3402. +{
  3403. + int ret;
  3404. +
  3405. + ret = clk_register_clkdev(clk, NULL, name);
  3406. + if (ret)
  3407. + pr_err("%s alias not registered\n", name);
  3408. +}
  3409. +
  3410. +void __init bcm2709_init_clocks(void)
  3411. +{
  3412. + struct clk *clk;
  3413. +
  3414. + clk = bcm2709_clk_register("uart0_clk", uart_clock);
  3415. + bcm2709_register_clkdev(clk, "dev:f1");
  3416. +
  3417. + clk = bcm2709_clk_register("sdhost_clk", 250000000);
  3418. + bcm2709_register_clkdev(clk, "bcm2708_spi.0");
  3419. + bcm2709_register_clkdev(clk, "bcm2708_i2c.0");
  3420. + bcm2709_register_clkdev(clk, "bcm2708_i2c.1");
  3421. +}
  3422. +
  3423. +#define UART0_IRQ { IRQ_UART, 0 /*NO_IRQ*/ }
  3424. +#define UART0_DMA { 15, 14 }
  3425. +
  3426. +AMBA_DEVICE(uart0, "dev:f1", UART0, NULL);
  3427. +
  3428. +static struct amba_device *amba_devs[] __initdata = {
  3429. + &uart0_device,
  3430. +};
  3431. +
  3432. +static struct resource bcm2708_dmaman_resources[] = {
  3433. + {
  3434. + .start = DMA_BASE,
  3435. + .end = DMA_BASE + SZ_4K - 1,
  3436. + .flags = IORESOURCE_MEM,
  3437. + }
  3438. +};
  3439. +
  3440. +static struct platform_device bcm2708_dmaman_device = {
  3441. + .name = BCM_DMAMAN_DRIVER_NAME,
  3442. + .id = 0, /* first bcm2708_dma */
  3443. + .resource = bcm2708_dmaman_resources,
  3444. + .num_resources = ARRAY_SIZE(bcm2708_dmaman_resources),
  3445. +};
  3446. +
  3447. +#if defined(CONFIG_W1_MASTER_GPIO) || defined(CONFIG_W1_MASTER_GPIO_MODULE)
  3448. +static struct w1_gpio_platform_data w1_gpio_pdata = {
  3449. + .pin = W1_GPIO,
  3450. + .ext_pullup_enable_pin = W1_PULLUP,
  3451. + .is_open_drain = 0,
  3452. +};
  3453. +
  3454. +static struct platform_device w1_device = {
  3455. + .name = "w1-gpio",
  3456. + .id = -1,
  3457. + .dev.platform_data = &w1_gpio_pdata,
  3458. +};
  3459. +#endif
  3460. +
  3461. +static u64 fb_dmamask = DMA_BIT_MASK(DMA_MASK_BITS_COMMON);
  3462. +
  3463. +static struct platform_device bcm2708_fb_device = {
  3464. + .name = "bcm2708_fb",
  3465. + .id = -1, /* only one bcm2708_fb */
  3466. + .resource = NULL,
  3467. + .num_resources = 0,
  3468. + .dev = {
  3469. + .dma_mask = &fb_dmamask,
  3470. + .coherent_dma_mask = DMA_BIT_MASK(DMA_MASK_BITS_COMMON),
  3471. + },
  3472. +};
  3473. +
  3474. +static struct plat_serial8250_port bcm2708_uart1_platform_data[] = {
  3475. + {
  3476. + .mapbase = UART1_BASE + 0x40,
  3477. + .irq = IRQ_AUX,
  3478. + .uartclk = 125000000,
  3479. + .regshift = 2,
  3480. + .iotype = UPIO_MEM,
  3481. + .flags = UPF_FIXED_TYPE | UPF_IOREMAP | UPF_SKIP_TEST,
  3482. + .type = PORT_8250,
  3483. + },
  3484. + {},
  3485. +};
  3486. +
  3487. +static struct platform_device bcm2708_uart1_device = {
  3488. + .name = "serial8250",
  3489. + .id = PLAT8250_DEV_PLATFORM,
  3490. + .dev = {
  3491. + .platform_data = bcm2708_uart1_platform_data,
  3492. + },
  3493. +};
  3494. +
  3495. +static struct resource bcm2708_usb_resources[] = {
  3496. + [0] = {
  3497. + .start = USB_BASE,
  3498. + .end = USB_BASE + SZ_128K - 1,
  3499. + .flags = IORESOURCE_MEM,
  3500. + },
  3501. + [1] = {
  3502. + .start = MPHI_BASE,
  3503. + .end = MPHI_BASE + SZ_4K - 1,
  3504. + .flags = IORESOURCE_MEM,
  3505. + },
  3506. + [2] = {
  3507. + .start = IRQ_HOSTPORT,
  3508. + .end = IRQ_HOSTPORT,
  3509. + .flags = IORESOURCE_IRQ,
  3510. + },
  3511. + [3] = {
  3512. + .start = IRQ_USB,
  3513. + .end = IRQ_USB,
  3514. + .flags = IORESOURCE_IRQ,
  3515. + },
  3516. +};
  3517. +
  3518. +
  3519. +static u64 usb_dmamask = DMA_BIT_MASK(DMA_MASK_BITS_COMMON);
  3520. +
  3521. +static struct platform_device bcm2708_usb_device = {
  3522. + .name = "bcm2708_usb",
  3523. + .id = -1, /* only one bcm2708_usb */
  3524. + .resource = bcm2708_usb_resources,
  3525. + .num_resources = ARRAY_SIZE(bcm2708_usb_resources),
  3526. + .dev = {
  3527. + .dma_mask = &usb_dmamask,
  3528. + .coherent_dma_mask = DMA_BIT_MASK(DMA_MASK_BITS_COMMON),
  3529. + },
  3530. +};
  3531. +
  3532. +static struct resource bcm2708_vcio_resources[] = {
  3533. + [0] = { /* mailbox/semaphore/doorbell access */
  3534. + .start = MCORE_BASE,
  3535. + .end = MCORE_BASE + SZ_4K - 1,
  3536. + .flags = IORESOURCE_MEM,
  3537. + },
  3538. +};
  3539. +
  3540. +static u64 vcio_dmamask = DMA_BIT_MASK(DMA_MASK_BITS_COMMON);
  3541. +
  3542. +static struct platform_device bcm2708_vcio_device = {
  3543. + .name = BCM_VCIO_DRIVER_NAME,
  3544. + .id = -1, /* only one VideoCore I/O area */
  3545. + .resource = bcm2708_vcio_resources,
  3546. + .num_resources = ARRAY_SIZE(bcm2708_vcio_resources),
  3547. + .dev = {
  3548. + .dma_mask = &vcio_dmamask,
  3549. + .coherent_dma_mask = DMA_BIT_MASK(DMA_MASK_BITS_COMMON),
  3550. + },
  3551. +};
  3552. +
  3553. +#ifdef CONFIG_BCM2708_GPIO
  3554. +#define BCM_GPIO_DRIVER_NAME "bcm2708_gpio"
  3555. +
  3556. +static struct resource bcm2708_gpio_resources[] = {
  3557. + [0] = { /* general purpose I/O */
  3558. + .start = GPIO_BASE,
  3559. + .end = GPIO_BASE + SZ_4K - 1,
  3560. + .flags = IORESOURCE_MEM,
  3561. + },
  3562. +};
  3563. +
  3564. +static u64 gpio_dmamask = DMA_BIT_MASK(DMA_MASK_BITS_COMMON);
  3565. +
  3566. +static struct platform_device bcm2708_gpio_device = {
  3567. + .name = BCM_GPIO_DRIVER_NAME,
  3568. + .id = -1, /* only one VideoCore I/O area */
  3569. + .resource = bcm2708_gpio_resources,
  3570. + .num_resources = ARRAY_SIZE(bcm2708_gpio_resources),
  3571. + .dev = {
  3572. + .dma_mask = &gpio_dmamask,
  3573. + .coherent_dma_mask = DMA_BIT_MASK(DMA_MASK_BITS_COMMON),
  3574. + },
  3575. +};
  3576. +#endif
  3577. +
  3578. +#ifdef SYSTEM_TIMER
  3579. +static struct resource bcm2708_systemtimer_resources[] = {
  3580. + [0] = { /* system timer access */
  3581. + .start = ST_BASE,
  3582. + .end = ST_BASE + SZ_4K - 1,
  3583. + .flags = IORESOURCE_MEM,
  3584. + },
  3585. + {
  3586. + .start = IRQ_TIMER3,
  3587. + .end = IRQ_TIMER3,
  3588. + .flags = IORESOURCE_IRQ,
  3589. + }
  3590. +
  3591. +};
  3592. +
  3593. +static u64 systemtimer_dmamask = DMA_BIT_MASK(DMA_MASK_BITS_COMMON);
  3594. +
  3595. +static struct platform_device bcm2708_systemtimer_device = {
  3596. + .name = "bcm2708_systemtimer",
  3597. + .id = -1, /* only one VideoCore I/O area */
  3598. + .resource = bcm2708_systemtimer_resources,
  3599. + .num_resources = ARRAY_SIZE(bcm2708_systemtimer_resources),
  3600. + .dev = {
  3601. + .dma_mask = &systemtimer_dmamask,
  3602. + .coherent_dma_mask = DMA_BIT_MASK(DMA_MASK_BITS_COMMON),
  3603. + },
  3604. +};
  3605. +#endif
  3606. +
  3607. +#ifdef CONFIG_MMC_BCM2835 /* Arasan emmc SD (new) */
  3608. +static struct resource bcm2835_emmc_resources[] = {
  3609. + [0] = {
  3610. + .start = EMMC_BASE,
  3611. + .end = EMMC_BASE + SZ_256 - 1, /* we only need this area */
  3612. + /* the memory map actually makes SZ_4K available */
  3613. + .flags = IORESOURCE_MEM,
  3614. + },
  3615. + [1] = {
  3616. + .start = IRQ_ARASANSDIO,
  3617. + .end = IRQ_ARASANSDIO,
  3618. + .flags = IORESOURCE_IRQ,
  3619. + },
  3620. +};
  3621. +
  3622. +static u64 bcm2835_emmc_dmamask = 0xffffffffUL;
  3623. +
  3624. +struct platform_device bcm2835_emmc_device = {
  3625. + .name = "mmc-bcm2835",
  3626. + .id = 0,
  3627. + .num_resources = ARRAY_SIZE(bcm2835_emmc_resources),
  3628. + .resource = bcm2835_emmc_resources,
  3629. + .dev = {
  3630. + .dma_mask = &bcm2835_emmc_dmamask,
  3631. + .coherent_dma_mask = 0xffffffffUL},
  3632. +};
  3633. +#endif /* CONFIG_MMC_BCM2835 */
  3634. +
  3635. +static struct resource bcm2708_powerman_resources[] = {
  3636. + [0] = {
  3637. + .start = PM_BASE,
  3638. + .end = PM_BASE + SZ_256 - 1,
  3639. + .flags = IORESOURCE_MEM,
  3640. + },
  3641. +};
  3642. +
  3643. +static u64 powerman_dmamask = DMA_BIT_MASK(DMA_MASK_BITS_COMMON);
  3644. +
  3645. +struct platform_device bcm2708_powerman_device = {
  3646. + .name = "bcm2708_powerman",
  3647. + .id = 0,
  3648. + .num_resources = ARRAY_SIZE(bcm2708_powerman_resources),
  3649. + .resource = bcm2708_powerman_resources,
  3650. + .dev = {
  3651. + .dma_mask = &powerman_dmamask,
  3652. + .coherent_dma_mask = 0xffffffffUL},
  3653. +};
  3654. +
  3655. +
  3656. +static struct platform_device bcm2708_alsa_devices[] = {
  3657. + [0] = {
  3658. + .name = "bcm2835_AUD0",
  3659. + .id = 0, /* first audio device */
  3660. + .resource = 0,
  3661. + .num_resources = 0,
  3662. + },
  3663. + [1] = {
  3664. + .name = "bcm2835_AUD1",
  3665. + .id = 1, /* second audio device */
  3666. + .resource = 0,
  3667. + .num_resources = 0,
  3668. + },
  3669. + [2] = {
  3670. + .name = "bcm2835_AUD2",
  3671. + .id = 2, /* third audio device */
  3672. + .resource = 0,
  3673. + .num_resources = 0,
  3674. + },
  3675. + [3] = {
  3676. + .name = "bcm2835_AUD3",
  3677. + .id = 3, /* forth audio device */
  3678. + .resource = 0,
  3679. + .num_resources = 0,
  3680. + },
  3681. + [4] = {
  3682. + .name = "bcm2835_AUD4",
  3683. + .id = 4, /* fifth audio device */
  3684. + .resource = 0,
  3685. + .num_resources = 0,
  3686. + },
  3687. + [5] = {
  3688. + .name = "bcm2835_AUD5",
  3689. + .id = 5, /* sixth audio device */
  3690. + .resource = 0,
  3691. + .num_resources = 0,
  3692. + },
  3693. + [6] = {
  3694. + .name = "bcm2835_AUD6",
  3695. + .id = 6, /* seventh audio device */
  3696. + .resource = 0,
  3697. + .num_resources = 0,
  3698. + },
  3699. + [7] = {
  3700. + .name = "bcm2835_AUD7",
  3701. + .id = 7, /* eighth audio device */
  3702. + .resource = 0,
  3703. + .num_resources = 0,
  3704. + },
  3705. +};
  3706. +
  3707. +static struct resource bcm2708_spi_resources[] = {
  3708. + {
  3709. + .start = SPI0_BASE,
  3710. + .end = SPI0_BASE + SZ_256 - 1,
  3711. + .flags = IORESOURCE_MEM,
  3712. + }, {
  3713. + .start = IRQ_SPI,
  3714. + .end = IRQ_SPI,
  3715. + .flags = IORESOURCE_IRQ,
  3716. + }
  3717. +};
  3718. +
  3719. +
  3720. +static u64 bcm2708_spi_dmamask = DMA_BIT_MASK(DMA_MASK_BITS_COMMON);
  3721. +static struct platform_device bcm2708_spi_device = {
  3722. + .name = "bcm2708_spi",
  3723. + .id = 0,
  3724. + .num_resources = ARRAY_SIZE(bcm2708_spi_resources),
  3725. + .resource = bcm2708_spi_resources,
  3726. + .dev = {
  3727. + .dma_mask = &bcm2708_spi_dmamask,
  3728. + .coherent_dma_mask = DMA_BIT_MASK(DMA_MASK_BITS_COMMON)},
  3729. +};
  3730. +
  3731. +#ifdef CONFIG_BCM2708_SPIDEV
  3732. +static struct spi_board_info bcm2708_spi_devices[] = {
  3733. +#ifdef CONFIG_SPI_SPIDEV
  3734. + {
  3735. + .modalias = "spidev",
  3736. + .max_speed_hz = 500000,
  3737. + .bus_num = 0,
  3738. + .chip_select = 0,
  3739. + .mode = SPI_MODE_0,
  3740. + }, {
  3741. + .modalias = "spidev",
  3742. + .max_speed_hz = 500000,
  3743. + .bus_num = 0,
  3744. + .chip_select = 1,
  3745. + .mode = SPI_MODE_0,
  3746. + }
  3747. +#endif
  3748. +};
  3749. +#endif
  3750. +
  3751. +static struct resource bcm2708_bsc0_resources[] = {
  3752. + {
  3753. + .start = BSC0_BASE,
  3754. + .end = BSC0_BASE + SZ_256 - 1,
  3755. + .flags = IORESOURCE_MEM,
  3756. + }, {
  3757. + .start = INTERRUPT_I2C,
  3758. + .end = INTERRUPT_I2C,
  3759. + .flags = IORESOURCE_IRQ,
  3760. + }
  3761. +};
  3762. +
  3763. +static struct platform_device bcm2708_bsc0_device = {
  3764. + .name = "bcm2708_i2c",
  3765. + .id = 0,
  3766. + .num_resources = ARRAY_SIZE(bcm2708_bsc0_resources),
  3767. + .resource = bcm2708_bsc0_resources,
  3768. +};
  3769. +
  3770. +
  3771. +static struct resource bcm2708_bsc1_resources[] = {
  3772. + {
  3773. + .start = BSC1_BASE,
  3774. + .end = BSC1_BASE + SZ_256 - 1,
  3775. + .flags = IORESOURCE_MEM,
  3776. + }, {
  3777. + .start = INTERRUPT_I2C,
  3778. + .end = INTERRUPT_I2C,
  3779. + .flags = IORESOURCE_IRQ,
  3780. + }
  3781. +};
  3782. +
  3783. +static struct platform_device bcm2708_bsc1_device = {
  3784. + .name = "bcm2708_i2c",
  3785. + .id = 1,
  3786. + .num_resources = ARRAY_SIZE(bcm2708_bsc1_resources),
  3787. + .resource = bcm2708_bsc1_resources,
  3788. +};
  3789. +
  3790. +static struct platform_device bcm2835_hwmon_device = {
  3791. + .name = "bcm2835_hwmon",
  3792. +};
  3793. +
  3794. +static struct platform_device bcm2835_thermal_device = {
  3795. + .name = "bcm2835_thermal",
  3796. +};
  3797. +
  3798. +#if defined(CONFIG_SND_BCM2708_SOC_I2S) || defined(CONFIG_SND_BCM2708_SOC_I2S_MODULE)
  3799. +static struct resource bcm2708_i2s_resources[] = {
  3800. + {
  3801. + .start = I2S_BASE,
  3802. + .end = I2S_BASE + 0x20,
  3803. + .flags = IORESOURCE_MEM,
  3804. + },
  3805. + {
  3806. + .start = PCM_CLOCK_BASE,
  3807. + .end = PCM_CLOCK_BASE + 0x02,
  3808. + .flags = IORESOURCE_MEM,
  3809. + }
  3810. +};
  3811. +
  3812. +static struct platform_device bcm2708_i2s_device = {
  3813. + .name = "bcm2708-i2s",
  3814. + .id = 0,
  3815. + .num_resources = ARRAY_SIZE(bcm2708_i2s_resources),
  3816. + .resource = bcm2708_i2s_resources,
  3817. +};
  3818. +#endif
  3819. +
  3820. +#if defined(CONFIG_SND_BCM2708_SOC_HIFIBERRY_DAC) || defined(CONFIG_SND_BCM2708_SOC_HIFIBERRY_DAC_MODULE)
  3821. +static struct platform_device snd_hifiberry_dac_device = {
  3822. + .name = "snd-hifiberry-dac",
  3823. + .id = 0,
  3824. + .num_resources = 0,
  3825. +};
  3826. +
  3827. +static struct platform_device snd_pcm5102a_codec_device = {
  3828. + .name = "pcm5102a-codec",
  3829. + .id = -1,
  3830. + .num_resources = 0,
  3831. +};
  3832. +#endif
  3833. +
  3834. +#if defined(CONFIG_SND_BCM2708_SOC_HIFIBERRY_DACPLUS) || defined(CONFIG_SND_BCM2708_SOC_HIFIBERRY_DACPLUS_MODULE)
  3835. +static struct platform_device snd_rpi_hifiberry_dacplus_device = {
  3836. + .name = "snd-rpi-hifiberry-dacplus",
  3837. + .id = 0,
  3838. + .num_resources = 0,
  3839. +};
  3840. +
  3841. +static struct i2c_board_info __initdata snd_pcm512x_hbdacplus_i2c_devices[] = {
  3842. + {
  3843. + I2C_BOARD_INFO("pcm5122", 0x4d)
  3844. + },
  3845. +};
  3846. +#endif
  3847. +
  3848. +#if defined(CONFIG_SND_BCM2708_SOC_HIFIBERRY_DIGI) || defined(CONFIG_SND_BCM2708_SOC_HIFIBERRY_DIGI_MODULE)
  3849. +static struct platform_device snd_hifiberry_digi_device = {
  3850. + .name = "snd-hifiberry-digi",
  3851. + .id = 0,
  3852. + .num_resources = 0,
  3853. +};
  3854. +
  3855. +static struct i2c_board_info __initdata snd_wm8804_i2c_devices[] = {
  3856. + {
  3857. + I2C_BOARD_INFO("wm8804", 0x3b)
  3858. + },
  3859. +};
  3860. +
  3861. +#endif
  3862. +
  3863. +#if defined(CONFIG_SND_BCM2708_SOC_HIFIBERRY_AMP) || defined(CONFIG_SND_BCM2708_SOC_HIFIBERRY_AMP_MODULE)
  3864. +static struct platform_device snd_hifiberry_amp_device = {
  3865. + .name = "snd-hifiberry-amp",
  3866. + .id = 0,
  3867. + .num_resources = 0,
  3868. +};
  3869. +
  3870. +static struct i2c_board_info __initdata snd_tas5713_i2c_devices[] = {
  3871. + {
  3872. + I2C_BOARD_INFO("tas5713", 0x1b)
  3873. + },
  3874. +};
  3875. +#endif
  3876. +
  3877. +#if defined(CONFIG_SND_BCM2708_SOC_RPI_DAC) || defined(CONFIG_SND_BCM2708_SOC_RPI_DAC_MODULE)
  3878. +static struct platform_device snd_rpi_dac_device = {
  3879. + .name = "snd-rpi-dac",
  3880. + .id = 0,
  3881. + .num_resources = 0,
  3882. +};
  3883. +
  3884. +static struct platform_device snd_pcm1794a_codec_device = {
  3885. + .name = "pcm1794a-codec",
  3886. + .id = -1,
  3887. + .num_resources = 0,
  3888. +};
  3889. +#endif
  3890. +
  3891. +
  3892. +#if defined(CONFIG_SND_BCM2708_SOC_IQAUDIO_DAC) || defined(CONFIG_SND_BCM2708_SOC_IQAUDIO_DAC_MODULE)
  3893. +static struct platform_device snd_rpi_iqaudio_dac_device = {
  3894. + .name = "snd-rpi-iqaudio-dac",
  3895. + .id = 0,
  3896. + .num_resources = 0,
  3897. +};
  3898. +
  3899. +// Use the actual device name rather than generic driver name
  3900. +static struct i2c_board_info __initdata snd_pcm512x_i2c_devices[] = {
  3901. + {
  3902. + I2C_BOARD_INFO("pcm5122", 0x4c)
  3903. + },
  3904. +};
  3905. +#endif
  3906. +
  3907. +int __init bcm_register_device(struct platform_device *pdev)
  3908. +{
  3909. + int ret;
  3910. +
  3911. + ret = platform_device_register(pdev);
  3912. + if (ret)
  3913. + pr_debug("Unable to register platform device '%s': %d\n",
  3914. + pdev->name, ret);
  3915. +
  3916. + return ret;
  3917. +}
  3918. +
  3919. +/*
  3920. + * Use these macros for platform and i2c devices that are present in the
  3921. + * Device Tree. This way the devices are only added on non-DT systems.
  3922. + */
  3923. +#define bcm_register_device_dt(pdev) \
  3924. + if (!use_dt) bcm_register_device(pdev)
  3925. +
  3926. +#define i2c_register_board_info_dt(busnum, info, n) \
  3927. + if (!use_dt) i2c_register_board_info(busnum, info, n)
  3928. +
  3929. +int calc_rsts(int partition)
  3930. +{
  3931. + return PM_PASSWORD |
  3932. + ((partition & (1 << 0)) << 0) |
  3933. + ((partition & (1 << 1)) << 1) |
  3934. + ((partition & (1 << 2)) << 2) |
  3935. + ((partition & (1 << 3)) << 3) |
  3936. + ((partition & (1 << 4)) << 4) |
  3937. + ((partition & (1 << 5)) << 5);
  3938. +}
  3939. +
  3940. +static void bcm2709_restart(enum reboot_mode mode, const char *cmd)
  3941. +{
  3942. + extern char bcm2708_reboot_mode;
  3943. + uint32_t pm_rstc, pm_wdog;
  3944. + uint32_t timeout = 10;
  3945. + uint32_t pm_rsts = 0;
  3946. +
  3947. + if(bcm2708_reboot_mode == 'q')
  3948. + {
  3949. + // NOOBS < 1.3 booting with reboot=q
  3950. + pm_rsts = readl(__io_address(PM_RSTS));
  3951. + pm_rsts = PM_PASSWORD | pm_rsts | PM_RSTS_HADWRQ_SET;
  3952. + }
  3953. + else if(bcm2708_reboot_mode == 'p')
  3954. + {
  3955. + // NOOBS < 1.3 halting
  3956. + pm_rsts = readl(__io_address(PM_RSTS));
  3957. + pm_rsts = PM_PASSWORD | pm_rsts | PM_RSTS_HADWRH_SET;
  3958. + }
  3959. + else
  3960. + {
  3961. + pm_rsts = calc_rsts(reboot_part);
  3962. + }
  3963. +
  3964. + writel(pm_rsts, __io_address(PM_RSTS));
  3965. +
  3966. + /* Setup watchdog for reset */
  3967. + pm_rstc = readl(__io_address(PM_RSTC));
  3968. +
  3969. + pm_wdog = PM_PASSWORD | (timeout & PM_WDOG_TIME_SET); // watchdog timer = timer clock / 16; need password (31:16) + value (11:0)
  3970. + pm_rstc = PM_PASSWORD | (pm_rstc & PM_RSTC_WRCFG_CLR) | PM_RSTC_WRCFG_FULL_RESET;
  3971. +
  3972. + writel(pm_wdog, __io_address(PM_WDOG));
  3973. + writel(pm_rstc, __io_address(PM_RSTC));
  3974. +}
  3975. +
  3976. +/* We can't really power off, but if we do the normal reset scheme, and indicate to bootcode.bin not to reboot, then most of the chip will be powered off */
  3977. +static void bcm2709_power_off(void)
  3978. +{
  3979. + extern char bcm2708_reboot_mode;
  3980. + if(bcm2708_reboot_mode == 'q')
  3981. + {
  3982. + // NOOBS < v1.3
  3983. + bcm2709_restart('p', "");
  3984. + }
  3985. + else
  3986. + {
  3987. + /* partition 63 is special code for HALT the bootloader knows not to boot*/
  3988. + reboot_part = 63;
  3989. + /* continue with normal reset mechanism */
  3990. + bcm2709_restart(0, "");
  3991. + }
  3992. +}
  3993. +
  3994. +#ifdef CONFIG_OF
  3995. +static void __init bcm2709_dt_init(void)
  3996. +{
  3997. + int ret;
  3998. +
  3999. + ret = of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL);
  4000. + if (ret) {
  4001. + pr_err("of_platform_populate failed: %d\n", ret);
  4002. + use_dt = 0;
  4003. + }
  4004. +}
  4005. +#else
  4006. +static void __init bcm2709_dt_init(void) { }
  4007. +#endif /* CONFIG_OF */
  4008. +
  4009. +void __init bcm2709_init(void)
  4010. +{
  4011. + int i;
  4012. +
  4013. +#if defined(CONFIG_BCM_VC_CMA)
  4014. + vc_cma_early_init();
  4015. +#endif
  4016. + printk("bcm2709.uart_clock = %d\n", uart_clock);
  4017. + pm_power_off = bcm2709_power_off;
  4018. +
  4019. + bcm2709_init_clocks();
  4020. + if (use_dt)
  4021. + bcm2709_dt_init();
  4022. +
  4023. + bcm_register_device(&bcm2708_dmaman_device);
  4024. + bcm_register_device(&bcm2708_vcio_device);
  4025. +#ifdef CONFIG_BCM2708_GPIO
  4026. + bcm_register_device_dt(&bcm2708_gpio_device);
  4027. +#endif
  4028. +#if defined(CONFIG_W1_MASTER_GPIO) || defined(CONFIG_W1_MASTER_GPIO_MODULE)
  4029. + w1_gpio_pdata.pin = w1_gpio_pin;
  4030. + w1_gpio_pdata.ext_pullup_enable_pin = w1_gpio_pullup;
  4031. + bcm_register_device_dt(&w1_device);
  4032. +#endif
  4033. +#ifdef SYSTEM_TIMER
  4034. + bcm_register_device(&bcm2708_systemtimer_device);
  4035. +#endif
  4036. + bcm_register_device(&bcm2708_fb_device);
  4037. + bcm_register_device(&bcm2708_usb_device);
  4038. + bcm_register_device(&bcm2708_uart1_device);
  4039. + bcm_register_device(&bcm2708_powerman_device);
  4040. +
  4041. +#ifdef CONFIG_MMC_BCM2835
  4042. + bcm_register_device(&bcm2835_emmc_device);
  4043. +#endif
  4044. + bcm2709_init_led();
  4045. + for (i = 0; i < ARRAY_SIZE(bcm2708_alsa_devices); i++)
  4046. + bcm_register_device(&bcm2708_alsa_devices[i]);
  4047. +
  4048. + bcm_register_device(&bcm2835_hwmon_device);
  4049. + bcm_register_device(&bcm2835_thermal_device);
  4050. +
  4051. + bcm_register_device_dt(&bcm2708_spi_device);
  4052. + bcm_register_device_dt(&bcm2708_bsc0_device);
  4053. + bcm_register_device_dt(&bcm2708_bsc1_device);
  4054. +
  4055. +#if defined(CONFIG_SND_BCM2708_SOC_I2S) || defined(CONFIG_SND_BCM2708_SOC_I2S_MODULE)
  4056. + bcm_register_device_dt(&bcm2708_i2s_device);
  4057. +#endif
  4058. +
  4059. +#if defined(CONFIG_SND_BCM2708_SOC_HIFIBERRY_DAC) || defined(CONFIG_SND_BCM2708_SOC_HIFIBERRY_DAC_MODULE)
  4060. + bcm_register_device_dt(&snd_hifiberry_dac_device);
  4061. + bcm_register_device_dt(&snd_pcm5102a_codec_device);
  4062. +#endif
  4063. +
  4064. +#if defined(CONFIG_SND_BCM2708_SOC_HIFIBERRY_DACPLUS) || defined(CONFIG_SND_BCM2708_SOC_HIFIBERRY_DACPLUS_MODULE)
  4065. + bcm_register_device_dt(&snd_rpi_hifiberry_dacplus_device);
  4066. + i2c_register_board_info_dt(1, snd_pcm512x_hbdacplus_i2c_devices, ARRAY_SIZE(snd_pcm512x_hbdacplus_i2c_devices));
  4067. +#endif
  4068. +
  4069. +#if defined(CONFIG_SND_BCM2708_SOC_HIFIBERRY_DIGI) || defined(CONFIG_SND_BCM2708_SOC_HIFIBERRY_DIGI_MODULE)
  4070. + bcm_register_device_dt(&snd_hifiberry_digi_device);
  4071. + i2c_register_board_info_dt(1, snd_wm8804_i2c_devices, ARRAY_SIZE(snd_wm8804_i2c_devices));
  4072. +#endif
  4073. +
  4074. +#if defined(CONFIG_SND_BCM2708_SOC_HIFIBERRY_AMP) || defined(CONFIG_SND_BCM2708_SOC_HIFIBERRY_AMP_MODULE)
  4075. + bcm_register_device_dt(&snd_hifiberry_amp_device);
  4076. + i2c_register_board_info_dt(1, snd_tas5713_i2c_devices, ARRAY_SIZE(snd_tas5713_i2c_devices));
  4077. +#endif
  4078. +
  4079. +#if defined(CONFIG_SND_BCM2708_SOC_RPI_DAC) || defined(CONFIG_SND_BCM2708_SOC_RPI_DAC_MODULE)
  4080. + bcm_register_device_dt(&snd_rpi_dac_device);
  4081. + bcm_register_device_dt(&snd_pcm1794a_codec_device);
  4082. +#endif
  4083. +
  4084. +#if defined(CONFIG_SND_BCM2708_SOC_IQAUDIO_DAC) || defined(CONFIG_SND_BCM2708_SOC_IQAUDIO_DAC_MODULE)
  4085. + bcm_register_device_dt(&snd_rpi_iqaudio_dac_device);
  4086. + i2c_register_board_info_dt(1, snd_pcm512x_i2c_devices, ARRAY_SIZE(snd_pcm512x_i2c_devices));
  4087. +#endif
  4088. +
  4089. +
  4090. + for (i = 0; i < ARRAY_SIZE(amba_devs); i++) {
  4091. + struct amba_device *d = amba_devs[i];
  4092. + amba_device_register(d, &iomem_resource);
  4093. + }
  4094. + system_rev = boardrev;
  4095. + system_serial_low = serial;
  4096. +
  4097. +#ifdef CONFIG_BCM2708_SPIDEV
  4098. + if (!use_dt)
  4099. + spi_register_board_info(bcm2708_spi_devices,
  4100. + ARRAY_SIZE(bcm2708_spi_devices));
  4101. +#endif
  4102. +}
  4103. +
  4104. +#ifdef SYSTEM_TIMER
  4105. +static void timer_set_mode(enum clock_event_mode mode,
  4106. + struct clock_event_device *clk)
  4107. +{
  4108. + switch (mode) {
  4109. + case CLOCK_EVT_MODE_ONESHOT: /* Leave the timer disabled, .set_next_event will enable it */
  4110. + case CLOCK_EVT_MODE_SHUTDOWN:
  4111. + break;
  4112. + case CLOCK_EVT_MODE_PERIODIC:
  4113. +
  4114. + case CLOCK_EVT_MODE_UNUSED:
  4115. + case CLOCK_EVT_MODE_RESUME:
  4116. +
  4117. + default:
  4118. + printk(KERN_ERR "timer_set_mode: unhandled mode:%d\n",
  4119. + (int)mode);
  4120. + break;
  4121. + }
  4122. +
  4123. +}
  4124. +
  4125. +static int timer_set_next_event(unsigned long cycles,
  4126. + struct clock_event_device *unused)
  4127. +{
  4128. + unsigned long stc;
  4129. + do {
  4130. + stc = readl(__io_address(ST_BASE + 0x04));
  4131. + /* We could take a FIQ here, which may push ST above STC3 */
  4132. + writel(stc + cycles, __io_address(ST_BASE + 0x18));
  4133. + } while ((signed long) cycles >= 0 &&
  4134. + (signed long) (readl(__io_address(ST_BASE + 0x04)) - stc)
  4135. + >= (signed long) cycles);
  4136. + return 0;
  4137. +}
  4138. +
  4139. +static struct clock_event_device timer0_clockevent = {
  4140. + .name = "timer0",
  4141. + .shift = 32,
  4142. + .features = CLOCK_EVT_FEAT_ONESHOT,
  4143. + .set_mode = timer_set_mode,
  4144. + .set_next_event = timer_set_next_event,
  4145. +};
  4146. +
  4147. +/*
  4148. + * IRQ handler for the timer
  4149. + */
  4150. +static irqreturn_t bcm2709_timer_interrupt(int irq, void *dev_id)
  4151. +{
  4152. + struct clock_event_device *evt = &timer0_clockevent;
  4153. +
  4154. + writel(1 << 3, __io_address(ST_BASE + 0x00)); /* stcs clear timer int */
  4155. +
  4156. + evt->event_handler(evt);
  4157. +
  4158. + return IRQ_HANDLED;
  4159. +}
  4160. +
  4161. +static struct irqaction bcm2709_timer_irq = {
  4162. + .name = "BCM2709 Timer Tick",
  4163. + .flags = IRQF_DISABLED | IRQF_TIMER | IRQF_IRQPOLL,
  4164. + .handler = bcm2709_timer_interrupt,
  4165. +};
  4166. +
  4167. +/*
  4168. + * Set up timer interrupt, and return the current time in seconds.
  4169. + */
  4170. +
  4171. +static struct delay_timer bcm2709_delay_timer = {
  4172. + .read_current_timer = bcm2709_read_current_timer,
  4173. + .freq = STC_FREQ_HZ,
  4174. +};
  4175. +
  4176. +static void __init bcm2709_timer_init(void)
  4177. +{
  4178. + /* init high res timer */
  4179. + bcm2709_clocksource_init();
  4180. +
  4181. + /*
  4182. + * Make irqs happen for the system timer
  4183. + */
  4184. + setup_irq(IRQ_TIMER3, &bcm2708_timer_irq);
  4185. +
  4186. + sched_clock_register(bcm2709_read_sched_clock, 32, STC_FREQ_HZ);
  4187. +
  4188. + timer0_clockevent.mult =
  4189. + div_sc(STC_FREQ_HZ, NSEC_PER_SEC, timer0_clockevent.shift);
  4190. + timer0_clockevent.max_delta_ns =
  4191. + clockevent_delta2ns(0xffffffff, &timer0_clockevent);
  4192. + timer0_clockevent.min_delta_ns =
  4193. + clockevent_delta2ns(0xf, &timer0_clockevent);
  4194. +
  4195. + timer0_clockevent.cpumask = cpumask_of(0);
  4196. + clockevents_register_device(&timer0_clockevent);
  4197. +
  4198. + register_current_timer_delay(&bcm2708_delay_timer);
  4199. +}
  4200. +
  4201. +#else
  4202. +
  4203. +static void __init bcm2709_timer_init(void)
  4204. +{
  4205. + extern void dc4_arch_timer_init(void);
  4206. + // timer control
  4207. + writel(0, __io_address(ARM_LOCAL_CONTROL));
  4208. + // timer pre_scaler
  4209. + writel(0x80000000, __io_address(ARM_LOCAL_PRESCALER)); // 19.2MHz
  4210. + //writel(0x06AAAAAB, __io_address(ARM_LOCAL_PRESCALER)); // 1MHz
  4211. +
  4212. + if (use_dt)
  4213. + {
  4214. + of_clk_init(NULL);
  4215. + clocksource_of_init();
  4216. + }
  4217. + else
  4218. + dc4_arch_timer_init();
  4219. +}
  4220. +
  4221. +#endif
  4222. +
  4223. +#if defined(CONFIG_LEDS_GPIO) || defined(CONFIG_LEDS_GPIO_MODULE)
  4224. +#include <linux/leds.h>
  4225. +
  4226. +static struct gpio_led bcm2709_leds[] = {
  4227. + [0] = {
  4228. + .gpio = 16,
  4229. + .name = "led0",
  4230. + .default_trigger = "mmc0",
  4231. + .active_low = 1,
  4232. + },
  4233. +};
  4234. +
  4235. +static struct gpio_led_platform_data bcm2709_led_pdata = {
  4236. + .num_leds = ARRAY_SIZE(bcm2709_leds),
  4237. + .leds = bcm2709_leds,
  4238. +};
  4239. +
  4240. +static struct platform_device bcm2709_led_device = {
  4241. + .name = "leds-gpio",
  4242. + .id = -1,
  4243. + .dev = {
  4244. + .platform_data = &bcm2709_led_pdata,
  4245. + },
  4246. +};
  4247. +
  4248. +static void __init bcm2709_init_led(void)
  4249. +{
  4250. + bcm2709_leds[0].gpio = disk_led_gpio;
  4251. + bcm2709_leds[0].active_low = disk_led_active_low;
  4252. + bcm_register_device_dt(&bcm2709_led_device);
  4253. +}
  4254. +#else
  4255. +static inline void bcm2709_init_led(void)
  4256. +{
  4257. +}
  4258. +#endif
  4259. +
  4260. +void __init bcm2709_init_early(void)
  4261. +{
  4262. + /*
  4263. + * Some devices allocate their coherent buffers from atomic
  4264. + * context. Increase size of atomic coherent pool to make sure such
  4265. + * the allocations won't fail.
  4266. + */
  4267. + init_dma_coherent_pool_size(SZ_4M);
  4268. +
  4269. +#ifdef CONFIG_OF
  4270. + if (of_allnodes)
  4271. + use_dt = 1;
  4272. +#endif
  4273. +}
  4274. +
  4275. +static void __init board_reserve(void)
  4276. +{
  4277. +#if defined(CONFIG_BCM_VC_CMA)
  4278. + vc_cma_reserve();
  4279. +#endif
  4280. +}
  4281. +
  4282. +
  4283. +#include <linux/smp.h>
  4284. +
  4285. +#include <mach/hardware.h>
  4286. +#include <asm/cacheflush.h>
  4287. +#include <asm/smp_plat.h>
  4288. +int dc4=0;
  4289. +//void dc4_log(unsigned x) { if (dc4) writel((x), __io_address(ST_BASE+10 + raw_smp_processor_id()*4)); }
  4290. +void dc4_log_dead(unsigned x) { if (dc4) writel((readl(__io_address(ST_BASE+0x10 + raw_smp_processor_id()*4)) & 0xffff) | ((x)<<16), __io_address(ST_BASE+0x10 + raw_smp_processor_id()*4)); }
  4291. +
  4292. +static void bcm2835_send_doorbell(const struct cpumask *mask, unsigned int irq)
  4293. +{
  4294. + int cpu;
  4295. + /*
  4296. + * Ensure that stores to Normal memory are visible to the
  4297. + * other CPUs before issuing the IPI.
  4298. + */
  4299. + dsb();
  4300. +
  4301. + /* Convert our logical CPU mask into a physical one. */
  4302. + for_each_cpu(cpu, mask)
  4303. + {
  4304. + /* submit softirq */
  4305. + writel(1<<irq, __io_address(ARM_LOCAL_MAILBOX0_SET0 + 0x10 * MPIDR_AFFINITY_LEVEL(cpu_logical_map(cpu), 0)));
  4306. + }
  4307. +}
  4308. +
  4309. +void __init bcm2709_smp_init_cpus(void)
  4310. +{
  4311. + void secondary_startup(void);
  4312. + unsigned int i, ncores;
  4313. +
  4314. + ncores = 4; // xxx scu_get_core_count(NULL);
  4315. + printk("[%s] enter (%x->%x)\n", __FUNCTION__, (unsigned)virt_to_phys((void *)secondary_startup), (unsigned)__io_address(ST_BASE + 0x10));
  4316. + printk("[%s] ncores=%d\n", __FUNCTION__, ncores);
  4317. +
  4318. + for (i = 0; i < ncores; i++) {
  4319. + set_cpu_possible(i, true);
  4320. + /* enable IRQ (not FIQ) */
  4321. + writel(0x1, __io_address(ARM_LOCAL_MAILBOX_INT_CONTROL0 + 0x4 * i));
  4322. + //writel(0xf, __io_address(ARM_LOCAL_TIMER_INT_CONTROL0 + 0x4 * i));
  4323. + }
  4324. + set_smp_cross_call(bcm2835_send_doorbell);
  4325. +}
  4326. +
  4327. +/*
  4328. + * for arch/arm/kernel/smp.c:smp_prepare_cpus(unsigned int max_cpus)
  4329. + */
  4330. +void __init bcm2709_smp_prepare_cpus(unsigned int max_cpus)
  4331. +{
  4332. + //void __iomem *scu_base;
  4333. +
  4334. + printk("[%s] enter\n", __FUNCTION__);
  4335. + //scu_base = scu_base_addr();
  4336. + //scu_enable(scu_base);
  4337. +}
  4338. +
  4339. +/*
  4340. + * for linux/arch/arm/kernel/smp.c:secondary_start_kernel(void)
  4341. + */
  4342. +void __cpuinit bcm2709_secondary_init(unsigned int cpu)
  4343. +{
  4344. + printk("[%s] enter cpu:%d\n", __FUNCTION__, cpu);
  4345. + //gic_secondary_init(0);
  4346. +}
  4347. +
  4348. +/*
  4349. + * for linux/arch/arm/kernel/smp.c:__cpu_up(..)
  4350. + */
  4351. +int __cpuinit bcm2709_boot_secondary(unsigned int cpu, struct task_struct *idle)
  4352. +{
  4353. + void secondary_startup(void);
  4354. + void *mbox_set = __io_address(ARM_LOCAL_MAILBOX3_SET0 + 0x10 * MPIDR_AFFINITY_LEVEL(cpu_logical_map(cpu), 0));
  4355. + void *mbox_clr = __io_address(ARM_LOCAL_MAILBOX3_CLR0 + 0x10 * MPIDR_AFFINITY_LEVEL(cpu_logical_map(cpu), 0));
  4356. + unsigned secondary_boot = (unsigned)virt_to_phys((void *)secondary_startup);
  4357. + int timeout=20;
  4358. + unsigned t = -1;
  4359. + //printk("[%s] enter cpu:%d (%x->%p) %x\n", __FUNCTION__, cpu, secondary_boot, wake, readl(wake));
  4360. +
  4361. + dsb();
  4362. + BUG_ON(readl(mbox_clr) != 0);
  4363. + writel(secondary_boot, mbox_set);
  4364. +
  4365. + while (--timeout > 0) {
  4366. + t = readl(mbox_clr);
  4367. + if (t == 0) break;
  4368. + cpu_relax();
  4369. + }
  4370. + if (timeout==0)
  4371. + printk("[%s] cpu:%d failed to start (%x)\n", __FUNCTION__, cpu, t);
  4372. + else
  4373. + printk("[%s] cpu:%d started (%x) %d\n", __FUNCTION__, cpu, t, timeout);
  4374. +
  4375. + return 0;
  4376. +}
  4377. +
  4378. +
  4379. +struct smp_operations bcm2709_smp_ops __initdata = {
  4380. + .smp_init_cpus = bcm2709_smp_init_cpus,
  4381. + .smp_prepare_cpus = bcm2709_smp_prepare_cpus,
  4382. + .smp_secondary_init = bcm2709_secondary_init,
  4383. + .smp_boot_secondary = bcm2709_boot_secondary,
  4384. +};
  4385. +
  4386. +static const char * const bcm2709_compat[] = {
  4387. + "brcm,bcm2709",
  4388. + "brcm,bcm2708", /* Could use bcm2708 in a pinch */
  4389. + NULL
  4390. +};
  4391. +
  4392. +MACHINE_START(BCM2709, "BCM2709")
  4393. + /* Maintainer: Broadcom Europe Ltd. */
  4394. + .smp = smp_ops(bcm2709_smp_ops),
  4395. + .map_io = bcm2709_map_io,
  4396. + .init_irq = bcm2709_init_irq,
  4397. + .init_time = bcm2709_timer_init,
  4398. + .init_machine = bcm2709_init,
  4399. + .init_early = bcm2709_init_early,
  4400. + .reserve = board_reserve,
  4401. + .restart = bcm2709_restart,
  4402. + .dt_compat = bcm2709_compat,
  4403. +MACHINE_END
  4404. +
  4405. +module_param(boardrev, uint, 0644);
  4406. +module_param(serial, uint, 0644);
  4407. +module_param(uart_clock, uint, 0644);
  4408. +module_param(disk_led_gpio, uint, 0644);
  4409. +module_param(disk_led_active_low, uint, 0644);
  4410. +module_param(reboot_part, uint, 0644);
  4411. +module_param(w1_gpio_pin, uint, 0644);
  4412. +module_param(w1_gpio_pullup, uint, 0644);
  4413. --- /dev/null
  4414. +++ b/arch/arm/mach-bcm2709/bcm2709.h
  4415. @@ -0,0 +1,49 @@
  4416. +/*
  4417. + * linux/arch/arm/mach-bcm2708/bcm2708.h
  4418. + *
  4419. + * BCM2708 machine support header
  4420. + *
  4421. + * Copyright (C) 2010 Broadcom
  4422. + *
  4423. + * This program is free software; you can redistribute it and/or modify
  4424. + * it under the terms of the GNU General Public License as published by
  4425. + * the Free Software Foundation; either version 2 of the License, or
  4426. + * (at your option) any later version.
  4427. + *
  4428. + * This program is distributed in the hope that it will be useful,
  4429. + * but WITHOUT ANY WARRANTY; without even the implied warranty of
  4430. + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  4431. + * GNU General Public License for more details.
  4432. + *
  4433. + * You should have received a copy of the GNU General Public License
  4434. + * along with this program; if not, write to the Free Software
  4435. + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
  4436. + */
  4437. +
  4438. +#ifndef __BCM2708_BCM2708_H
  4439. +#define __BCM2708_BCM2708_H
  4440. +
  4441. +#include <linux/amba/bus.h>
  4442. +
  4443. +extern void __init bcm2708_init(void);
  4444. +extern void __init bcm2708_init_irq(void);
  4445. +extern void __init bcm2708_map_io(void);
  4446. +extern struct sys_timer bcm2708_timer;
  4447. +extern unsigned int mmc_status(struct device *dev);
  4448. +
  4449. +#define AMBA_DEVICE(name, busid, base, plat) \
  4450. +static struct amba_device name##_device = { \
  4451. + .dev = { \
  4452. + .coherent_dma_mask = ~0, \
  4453. + .init_name = busid, \
  4454. + .platform_data = plat, \
  4455. + }, \
  4456. + .res = { \
  4457. + .start = base##_BASE, \
  4458. + .end = (base##_BASE) + SZ_4K - 1,\
  4459. + .flags = IORESOURCE_MEM, \
  4460. + }, \
  4461. + .irq = base##_IRQ, \
  4462. +}
  4463. +
  4464. +#endif
  4465. --- /dev/null
  4466. +++ b/arch/arm/mach-bcm2709/clock.c
  4467. @@ -0,0 +1,61 @@
  4468. +/*
  4469. + * linux/arch/arm/mach-bcm2708/clock.c
  4470. + *
  4471. + * Copyright (C) 2010 Broadcom
  4472. + *
  4473. + * This program is free software; you can redistribute it and/or modify
  4474. + * it under the terms of the GNU General Public License as published by
  4475. + * the Free Software Foundation; either version 2 of the License, or
  4476. + * (at your option) any later version.
  4477. + *
  4478. + * This program is distributed in the hope that it will be useful,
  4479. + * but WITHOUT ANY WARRANTY; without even the implied warranty of
  4480. + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  4481. + * GNU General Public License for more details.
  4482. + *
  4483. + * You should have received a copy of the GNU General Public License
  4484. + * along with this program; if not, write to the Free Software
  4485. + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
  4486. + */
  4487. +#include <linux/module.h>
  4488. +#include <linux/kernel.h>
  4489. +#include <linux/device.h>
  4490. +#include <linux/list.h>
  4491. +#include <linux/errno.h>
  4492. +#include <linux/err.h>
  4493. +#include <linux/string.h>
  4494. +#include <linux/clk.h>
  4495. +#include <linux/mutex.h>
  4496. +
  4497. +#include <asm/clkdev.h>
  4498. +
  4499. +#include "clock.h"
  4500. +
  4501. +int clk_enable(struct clk *clk)
  4502. +{
  4503. + return 0;
  4504. +}
  4505. +EXPORT_SYMBOL(clk_enable);
  4506. +
  4507. +void clk_disable(struct clk *clk)
  4508. +{
  4509. +}
  4510. +EXPORT_SYMBOL(clk_disable);
  4511. +
  4512. +unsigned long clk_get_rate(struct clk *clk)
  4513. +{
  4514. + return clk->rate;
  4515. +}
  4516. +EXPORT_SYMBOL(clk_get_rate);
  4517. +
  4518. +long clk_round_rate(struct clk *clk, unsigned long rate)
  4519. +{
  4520. + return clk->rate;
  4521. +}
  4522. +EXPORT_SYMBOL(clk_round_rate);
  4523. +
  4524. +int clk_set_rate(struct clk *clk, unsigned long rate)
  4525. +{
  4526. + return -EIO;
  4527. +}
  4528. +EXPORT_SYMBOL(clk_set_rate);
  4529. --- /dev/null
  4530. +++ b/arch/arm/mach-bcm2709/clock.h
  4531. @@ -0,0 +1,24 @@
  4532. +/*
  4533. + * linux/arch/arm/mach-bcm2708/clock.h
  4534. + *
  4535. + * Copyright (C) 2010 Broadcom
  4536. + *
  4537. + * This program is free software; you can redistribute it and/or modify
  4538. + * it under the terms of the GNU General Public License as published by
  4539. + * the Free Software Foundation; either version 2 of the License, or
  4540. + * (at your option) any later version.
  4541. + *
  4542. + * This program is distributed in the hope that it will be useful,
  4543. + * but WITHOUT ANY WARRANTY; without even the implied warranty of
  4544. + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  4545. + * GNU General Public License for more details.
  4546. + *
  4547. + * You should have received a copy of the GNU General Public License
  4548. + * along with this program; if not, write to the Free Software
  4549. + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
  4550. + */
  4551. +struct module;
  4552. +
  4553. +struct clk {
  4554. + unsigned long rate;
  4555. +};
  4556. --- /dev/null
  4557. +++ b/arch/arm/mach-bcm2709/delay.S
  4558. @@ -0,0 +1,21 @@
  4559. +/*
  4560. + * linux/arch/arm/lib/delay.S
  4561. + *
  4562. + * Copyright (C) 1995, 1996 Russell King
  4563. + *
  4564. + * This program is free software; you can redistribute it and/or modify
  4565. + * it under the terms of the GNU General Public License version 2 as
  4566. + * published by the Free Software Foundation.
  4567. + */
  4568. +#include <linux/linkage.h>
  4569. +#include <asm/assembler.h>
  4570. +#include <asm/param.h>
  4571. +
  4572. + .text
  4573. +.align 3 @ 8 byte alignment seems to be needed to avoid fetching stalls
  4574. +@ Delay routine
  4575. +ENTRY(bcm2708_delay)
  4576. + subs r0, r0, #1
  4577. + bhi bcm2708_delay
  4578. + mov pc, lr
  4579. +ENDPROC(bcm2708_delay)
  4580. --- /dev/null
  4581. +++ b/arch/arm/mach-bcm2709/dma.c
  4582. @@ -0,0 +1,409 @@
  4583. +/*
  4584. + * linux/arch/arm/mach-bcm2708/dma.c
  4585. + *
  4586. + * Copyright (C) 2010 Broadcom
  4587. + *
  4588. + * This program is free software; you can redistribute it and/or modify
  4589. + * it under the terms of the GNU General Public License version 2 as
  4590. + * published by the Free Software Foundation.
  4591. + */
  4592. +
  4593. +#include <linux/slab.h>
  4594. +#include <linux/device.h>
  4595. +#include <linux/platform_device.h>
  4596. +#include <linux/module.h>
  4597. +#include <linux/scatterlist.h>
  4598. +
  4599. +#include <mach/dma.h>
  4600. +#include <mach/irqs.h>
  4601. +
  4602. +/*****************************************************************************\
  4603. + * *
  4604. + * Configuration *
  4605. + * *
  4606. +\*****************************************************************************/
  4607. +
  4608. +#define CACHE_LINE_MASK 31
  4609. +#define DRIVER_NAME BCM_DMAMAN_DRIVER_NAME
  4610. +#define DEFAULT_DMACHAN_BITMAP 0x10 /* channel 4 only */
  4611. +
  4612. +/* valid only for channels 0 - 14, 15 has its own base address */
  4613. +#define BCM2708_DMA_CHAN(n) ((n)<<8) /* base address */
  4614. +#define BCM2708_DMA_CHANIO(dma_base, n) \
  4615. + ((void __iomem *)((char *)(dma_base)+BCM2708_DMA_CHAN(n)))
  4616. +
  4617. +
  4618. +/*****************************************************************************\
  4619. + * *
  4620. + * DMA Auxilliary Functions *
  4621. + * *
  4622. +\*****************************************************************************/
  4623. +
  4624. +/* A DMA buffer on an arbitrary boundary may separate a cache line into a
  4625. + section inside the DMA buffer and another section outside it.
  4626. + Even if we flush DMA buffers from the cache there is always the chance that
  4627. + during a DMA someone will access the part of a cache line that is outside
  4628. + the DMA buffer - which will then bring in unwelcome data.
  4629. + Without being able to dictate our own buffer pools we must insist that
  4630. + DMA buffers consist of a whole number of cache lines.
  4631. +*/
  4632. +
  4633. +extern int
  4634. +bcm_sg_suitable_for_dma(struct scatterlist *sg_ptr, int sg_len)
  4635. +{
  4636. + int i;
  4637. +
  4638. + for (i = 0; i < sg_len; i++) {
  4639. + if (sg_ptr[i].offset & CACHE_LINE_MASK ||
  4640. + sg_ptr[i].length & CACHE_LINE_MASK)
  4641. + return 0;
  4642. + }
  4643. +
  4644. + return 1;
  4645. +}
  4646. +EXPORT_SYMBOL_GPL(bcm_sg_suitable_for_dma);
  4647. +
  4648. +extern void
  4649. +bcm_dma_start(void __iomem *dma_chan_base, dma_addr_t control_block)
  4650. +{
  4651. + dsb(); /* ARM data synchronization (push) operation */
  4652. +
  4653. + writel(control_block, dma_chan_base + BCM2708_DMA_ADDR);
  4654. + writel(BCM2708_DMA_ACTIVE, dma_chan_base + BCM2708_DMA_CS);
  4655. +}
  4656. +
  4657. +extern void bcm_dma_wait_idle(void __iomem *dma_chan_base)
  4658. +{
  4659. + dsb();
  4660. +
  4661. + /* ugly busy wait only option for now */
  4662. + while (readl(dma_chan_base + BCM2708_DMA_CS) & BCM2708_DMA_ACTIVE)
  4663. + cpu_relax();
  4664. +}
  4665. +
  4666. +EXPORT_SYMBOL_GPL(bcm_dma_start);
  4667. +
  4668. +extern bool bcm_dma_is_busy(void __iomem *dma_chan_base)
  4669. +{
  4670. + dsb();
  4671. +
  4672. + return readl(dma_chan_base + BCM2708_DMA_CS) & BCM2708_DMA_ACTIVE;
  4673. +}
  4674. +EXPORT_SYMBOL_GPL(bcm_dma_is_busy);
  4675. +
  4676. +/* Complete an ongoing DMA (assuming its results are to be ignored)
  4677. + Does nothing if there is no DMA in progress.
  4678. + This routine waits for the current AXI transfer to complete before
  4679. + terminating the current DMA. If the current transfer is hung on a DREQ used
  4680. + by an uncooperative peripheral the AXI transfer may never complete. In this
  4681. + case the routine times out and return a non-zero error code.
  4682. + Use of this routine doesn't guarantee that the ongoing or aborted DMA
  4683. + does not produce an interrupt.
  4684. +*/
  4685. +extern int
  4686. +bcm_dma_abort(void __iomem *dma_chan_base)
  4687. +{
  4688. + unsigned long int cs;
  4689. + int rc = 0;
  4690. +
  4691. + cs = readl(dma_chan_base + BCM2708_DMA_CS);
  4692. +
  4693. + if (BCM2708_DMA_ACTIVE & cs) {
  4694. + long int timeout = 10000;
  4695. +
  4696. + /* write 0 to the active bit - pause the DMA */
  4697. + writel(0, dma_chan_base + BCM2708_DMA_CS);
  4698. +
  4699. + /* wait for any current AXI transfer to complete */
  4700. + while (0 != (cs & BCM2708_DMA_ISPAUSED) && --timeout >= 0)
  4701. + cs = readl(dma_chan_base + BCM2708_DMA_CS);
  4702. +
  4703. + if (0 != (cs & BCM2708_DMA_ISPAUSED)) {
  4704. + /* we'll un-pause when we set of our next DMA */
  4705. + rc = -ETIMEDOUT;
  4706. +
  4707. + } else if (BCM2708_DMA_ACTIVE & cs) {
  4708. + /* terminate the control block chain */
  4709. + writel(0, dma_chan_base + BCM2708_DMA_NEXTCB);
  4710. +
  4711. + /* abort the whole DMA */
  4712. + writel(BCM2708_DMA_ABORT | BCM2708_DMA_ACTIVE,
  4713. + dma_chan_base + BCM2708_DMA_CS);
  4714. + }
  4715. + }
  4716. +
  4717. + return rc;
  4718. +}
  4719. +EXPORT_SYMBOL_GPL(bcm_dma_abort);
  4720. +
  4721. +
  4722. +/***************************************************************************** \
  4723. + * *
  4724. + * DMA Manager Device Methods *
  4725. + * *
  4726. +\*****************************************************************************/
  4727. +
  4728. +struct vc_dmaman {
  4729. + void __iomem *dma_base;
  4730. + u32 chan_available; /* bitmap of available channels */
  4731. + u32 has_feature[BCM_DMA_FEATURE_COUNT]; /* bitmap of feature presence */
  4732. +};
  4733. +
  4734. +static void vc_dmaman_init(struct vc_dmaman *dmaman, void __iomem *dma_base,
  4735. + u32 chans_available)
  4736. +{
  4737. + dmaman->dma_base = dma_base;
  4738. + dmaman->chan_available = chans_available;
  4739. + dmaman->has_feature[BCM_DMA_FEATURE_FAST_ORD] = 0x0c; /* chans 2 & 3 */
  4740. + dmaman->has_feature[BCM_DMA_FEATURE_BULK_ORD] = 0x01; /* chan 0 */
  4741. + dmaman->has_feature[BCM_DMA_FEATURE_NORMAL_ORD] = 0xfe; /* chans 1 to 7 */
  4742. + dmaman->has_feature[BCM_DMA_FEATURE_LITE_ORD] = 0x7f00; /* chans 8 to 14 */
  4743. +}
  4744. +
  4745. +static int vc_dmaman_chan_alloc(struct vc_dmaman *dmaman,
  4746. + unsigned preferred_feature_set)
  4747. +{
  4748. + u32 chans;
  4749. + int feature;
  4750. +
  4751. + chans = dmaman->chan_available;
  4752. + for (feature = 0; feature < BCM_DMA_FEATURE_COUNT; feature++)
  4753. + /* select the subset of available channels with the desired
  4754. + feature so long as some of the candidate channels have that
  4755. + feature */
  4756. + if ((preferred_feature_set & (1 << feature)) &&
  4757. + (chans & dmaman->has_feature[feature]))
  4758. + chans &= dmaman->has_feature[feature];
  4759. +
  4760. + if (chans) {
  4761. + int chan = 0;
  4762. + /* return the ordinal of the first channel in the bitmap */
  4763. + while (chans != 0 && (chans & 1) == 0) {
  4764. + chans >>= 1;
  4765. + chan++;
  4766. + }
  4767. + /* claim the channel */
  4768. + dmaman->chan_available &= ~(1 << chan);
  4769. + return chan;
  4770. + } else
  4771. + return -ENOMEM;
  4772. +}
  4773. +
  4774. +static int vc_dmaman_chan_free(struct vc_dmaman *dmaman, int chan)
  4775. +{
  4776. + if (chan < 0)
  4777. + return -EINVAL;
  4778. + else if ((1 << chan) & dmaman->chan_available)
  4779. + return -EIDRM;
  4780. + else {
  4781. + dmaman->chan_available |= (1 << chan);
  4782. + return 0;
  4783. + }
  4784. +}
  4785. +
  4786. +/*****************************************************************************\
  4787. + * *
  4788. + * DMA IRQs *
  4789. + * *
  4790. +\*****************************************************************************/
  4791. +
  4792. +static unsigned char bcm_dma_irqs[] = {
  4793. + IRQ_DMA0,
  4794. + IRQ_DMA1,
  4795. + IRQ_DMA2,
  4796. + IRQ_DMA3,
  4797. + IRQ_DMA4,
  4798. + IRQ_DMA5,
  4799. + IRQ_DMA6,
  4800. + IRQ_DMA7,
  4801. + IRQ_DMA8,
  4802. + IRQ_DMA9,
  4803. + IRQ_DMA10,
  4804. + IRQ_DMA11,
  4805. + IRQ_DMA12
  4806. +};
  4807. +
  4808. +
  4809. +/***************************************************************************** \
  4810. + * *
  4811. + * DMA Manager Monitor *
  4812. + * *
  4813. +\*****************************************************************************/
  4814. +
  4815. +static struct device *dmaman_dev; /* we assume there's only one! */
  4816. +
  4817. +extern int bcm_dma_chan_alloc(unsigned preferred_feature_set,
  4818. + void __iomem **out_dma_base, int *out_dma_irq)
  4819. +{
  4820. + if (!dmaman_dev)
  4821. + return -ENODEV;
  4822. + else {
  4823. + struct vc_dmaman *dmaman = dev_get_drvdata(dmaman_dev);
  4824. + int rc;
  4825. +
  4826. + device_lock(dmaman_dev);
  4827. + rc = vc_dmaman_chan_alloc(dmaman, preferred_feature_set);
  4828. + if (rc >= 0) {
  4829. + *out_dma_base = BCM2708_DMA_CHANIO(dmaman->dma_base,
  4830. + rc);
  4831. + *out_dma_irq = bcm_dma_irqs[rc];
  4832. + }
  4833. + device_unlock(dmaman_dev);
  4834. +
  4835. + return rc;
  4836. + }
  4837. +}
  4838. +EXPORT_SYMBOL_GPL(bcm_dma_chan_alloc);
  4839. +
  4840. +extern int bcm_dma_chan_free(int channel)
  4841. +{
  4842. + if (dmaman_dev) {
  4843. + struct vc_dmaman *dmaman = dev_get_drvdata(dmaman_dev);
  4844. + int rc;
  4845. +
  4846. + device_lock(dmaman_dev);
  4847. + rc = vc_dmaman_chan_free(dmaman, channel);
  4848. + device_unlock(dmaman_dev);
  4849. +
  4850. + return rc;
  4851. + } else
  4852. + return -ENODEV;
  4853. +}
  4854. +EXPORT_SYMBOL_GPL(bcm_dma_chan_free);
  4855. +
  4856. +static int dev_dmaman_register(const char *dev_name, struct device *dev)
  4857. +{
  4858. + int rc = dmaman_dev ? -EINVAL : 0;
  4859. + dmaman_dev = dev;
  4860. + return rc;
  4861. +}
  4862. +
  4863. +static void dev_dmaman_deregister(const char *dev_name, struct device *dev)
  4864. +{
  4865. + dmaman_dev = NULL;
  4866. +}
  4867. +
  4868. +/*****************************************************************************\
  4869. + * *
  4870. + * DMA Device *
  4871. + * *
  4872. +\*****************************************************************************/
  4873. +
  4874. +static int dmachans = -1; /* module parameter */
  4875. +
  4876. +static int bcm_dmaman_probe(struct platform_device *pdev)
  4877. +{
  4878. + int ret = 0;
  4879. + struct vc_dmaman *dmaman;
  4880. + struct resource *dma_res = NULL;
  4881. + void __iomem *dma_base = NULL;
  4882. + int have_dma_region = 0;
  4883. +
  4884. + dmaman = kzalloc(sizeof(*dmaman), GFP_KERNEL);
  4885. + if (NULL == dmaman) {
  4886. + printk(KERN_ERR DRIVER_NAME ": failed to allocate "
  4887. + "DMA management memory\n");
  4888. + ret = -ENOMEM;
  4889. + } else {
  4890. +
  4891. + dma_res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
  4892. + if (dma_res == NULL) {
  4893. + printk(KERN_ERR DRIVER_NAME ": failed to obtain memory "
  4894. + "resource\n");
  4895. + ret = -ENODEV;
  4896. + } else if (!request_mem_region(dma_res->start,
  4897. + resource_size(dma_res),
  4898. + DRIVER_NAME)) {
  4899. + dev_err(&pdev->dev, "cannot obtain DMA region\n");
  4900. + ret = -EBUSY;
  4901. + } else {
  4902. + have_dma_region = 1;
  4903. + dma_base = ioremap(dma_res->start,
  4904. + resource_size(dma_res));
  4905. + if (!dma_base) {
  4906. + dev_err(&pdev->dev, "cannot map DMA region\n");
  4907. + ret = -ENOMEM;
  4908. + } else {
  4909. + /* use module parameter if one was provided */
  4910. + if (dmachans > 0)
  4911. + vc_dmaman_init(dmaman, dma_base,
  4912. + dmachans);
  4913. + else
  4914. + vc_dmaman_init(dmaman, dma_base,
  4915. + DEFAULT_DMACHAN_BITMAP);
  4916. +
  4917. + platform_set_drvdata(pdev, dmaman);
  4918. + dev_dmaman_register(DRIVER_NAME, &pdev->dev);
  4919. +
  4920. + printk(KERN_INFO DRIVER_NAME ": DMA manager "
  4921. + "at %p\n", dma_base);
  4922. + }
  4923. + }
  4924. + }
  4925. + if (ret != 0) {
  4926. + if (dma_base)
  4927. + iounmap(dma_base);
  4928. + if (dma_res && have_dma_region)
  4929. + release_mem_region(dma_res->start,
  4930. + resource_size(dma_res));
  4931. + if (dmaman)
  4932. + kfree(dmaman);
  4933. + }
  4934. + return ret;
  4935. +}
  4936. +
  4937. +static int bcm_dmaman_remove(struct platform_device *pdev)
  4938. +{
  4939. + struct vc_dmaman *dmaman = platform_get_drvdata(pdev);
  4940. +
  4941. + platform_set_drvdata(pdev, NULL);
  4942. + dev_dmaman_deregister(DRIVER_NAME, &pdev->dev);
  4943. + kfree(dmaman);
  4944. +
  4945. + return 0;
  4946. +}
  4947. +
  4948. +static struct platform_driver bcm_dmaman_driver = {
  4949. + .probe = bcm_dmaman_probe,
  4950. + .remove = bcm_dmaman_remove,
  4951. +
  4952. + .driver = {
  4953. + .name = DRIVER_NAME,
  4954. + .owner = THIS_MODULE,
  4955. + },
  4956. +};
  4957. +
  4958. +/*****************************************************************************\
  4959. + * *
  4960. + * Driver init/exit *
  4961. + * *
  4962. +\*****************************************************************************/
  4963. +
  4964. +static int __init bcm_dmaman_drv_init(void)
  4965. +{
  4966. + int ret;
  4967. +
  4968. + ret = platform_driver_register(&bcm_dmaman_driver);
  4969. + if (ret != 0) {
  4970. + printk(KERN_ERR DRIVER_NAME ": failed to register "
  4971. + "on platform\n");
  4972. + }
  4973. +
  4974. + return ret;
  4975. +}
  4976. +
  4977. +static void __exit bcm_dmaman_drv_exit(void)
  4978. +{
  4979. + platform_driver_unregister(&bcm_dmaman_driver);
  4980. +}
  4981. +
  4982. +module_init(bcm_dmaman_drv_init);
  4983. +module_exit(bcm_dmaman_drv_exit);
  4984. +
  4985. +module_param(dmachans, int, 0644);
  4986. +
  4987. +MODULE_AUTHOR("Gray Girling <grayg@broadcom.com>");
  4988. +MODULE_DESCRIPTION("DMA channel manager driver");
  4989. +MODULE_LICENSE("GPL");
  4990. +
  4991. +MODULE_PARM_DESC(dmachans, "Bitmap of DMA channels available to the ARM");
  4992. --- /dev/null
  4993. +++ b/arch/arm/mach-bcm2709/dmaer.c
  4994. @@ -0,0 +1,886 @@
  4995. +#include <linux/init.h>
  4996. +#include <linux/sched.h>
  4997. +#include <linux/module.h>
  4998. +#include <linux/types.h>
  4999. +#include <linux/kdev_t.h>
  5000. +#include <linux/fs.h>
  5001. +#include <linux/cdev.h>
  5002. +#include <linux/mm.h>
  5003. +#include <linux/slab.h>
  5004. +#include <linux/pagemap.h>
  5005. +#include <linux/device.h>
  5006. +#include <linux/jiffies.h>
  5007. +#include <linux/timex.h>
  5008. +#include <linux/dma-mapping.h>
  5009. +
  5010. +#include <asm/uaccess.h>
  5011. +#include <asm/atomic.h>
  5012. +#include <asm/cacheflush.h>
  5013. +#include <asm/io.h>
  5014. +
  5015. +#include <mach/dma.h>
  5016. +#include <mach/vc_support.h>
  5017. +
  5018. +#ifdef ECLIPSE_IGNORE
  5019. +
  5020. +#define __user
  5021. +#define __init
  5022. +#define __exit
  5023. +#define __iomem
  5024. +#define KERN_DEBUG
  5025. +#define KERN_ERR
  5026. +#define KERN_WARNING
  5027. +#define KERN_INFO
  5028. +#define _IOWR(a, b, c) b
  5029. +#define _IOW(a, b, c) b
  5030. +#define _IO(a, b) b
  5031. +
  5032. +#endif
  5033. +
  5034. +//#define inline
  5035. +
  5036. +#define PRINTK(args...) printk(args)
  5037. +//#define PRINTK_VERBOSE(args...) printk(args)
  5038. +//#define PRINTK(args...)
  5039. +#define PRINTK_VERBOSE(args...)
  5040. +
  5041. +/***** TYPES ****/
  5042. +#define PAGES_PER_LIST 500
  5043. +struct PageList
  5044. +{
  5045. + struct page *m_pPages[PAGES_PER_LIST];
  5046. + unsigned int m_used;
  5047. + struct PageList *m_pNext;
  5048. +};
  5049. +
  5050. +struct VmaPageList
  5051. +{
  5052. + //each vma has a linked list of pages associated with it
  5053. + struct PageList *m_pPageHead;
  5054. + struct PageList *m_pPageTail;
  5055. + unsigned int m_refCount;
  5056. +};
  5057. +
  5058. +struct DmaControlBlock
  5059. +{
  5060. + unsigned int m_transferInfo;
  5061. + void __user *m_pSourceAddr;
  5062. + void __user *m_pDestAddr;
  5063. + unsigned int m_xferLen;
  5064. + unsigned int m_tdStride;
  5065. + struct DmaControlBlock *m_pNext;
  5066. + unsigned int m_blank1, m_blank2;
  5067. +};
  5068. +
  5069. +/***** DEFINES ******/
  5070. +//magic number defining the module
  5071. +#define DMA_MAGIC 0xdd
  5072. +
  5073. +//do user virtual to physical translation of the CB chain
  5074. +#define DMA_PREPARE _IOWR(DMA_MAGIC, 0, struct DmaControlBlock *)
  5075. +
  5076. +//kick the pre-prepared CB chain
  5077. +#define DMA_KICK _IOW(DMA_MAGIC, 1, struct DmaControlBlock *)
  5078. +
  5079. +//prepare it, kick it, wait for it
  5080. +#define DMA_PREPARE_KICK_WAIT _IOWR(DMA_MAGIC, 2, struct DmaControlBlock *)
  5081. +
  5082. +//prepare it, kick it, don't wait for it
  5083. +#define DMA_PREPARE_KICK _IOWR(DMA_MAGIC, 3, struct DmaControlBlock *)
  5084. +
  5085. +//not currently implemented
  5086. +#define DMA_WAIT_ONE _IO(DMA_MAGIC, 4, struct DmaControlBlock *)
  5087. +
  5088. +//wait on all kicked CB chains
  5089. +#define DMA_WAIT_ALL _IO(DMA_MAGIC, 5)
  5090. +
  5091. +//in order to discover the largest AXI burst that should be programmed into the transfer params
  5092. +#define DMA_MAX_BURST _IO(DMA_MAGIC, 6)
  5093. +
  5094. +//set the address range through which the user address is assumed to already by a physical address
  5095. +#define DMA_SET_MIN_PHYS _IOW(DMA_MAGIC, 7, unsigned long)
  5096. +#define DMA_SET_MAX_PHYS _IOW(DMA_MAGIC, 8, unsigned long)
  5097. +#define DMA_SET_PHYS_OFFSET _IOW(DMA_MAGIC, 9, unsigned long)
  5098. +
  5099. +//used to define the size for the CMA-based allocation *in pages*, can only be done once once the file is opened
  5100. +#define DMA_CMA_SET_SIZE _IOW(DMA_MAGIC, 10, unsigned long)
  5101. +
  5102. +//used to get the version of the module, to test for a capability
  5103. +#define DMA_GET_VERSION _IO(DMA_MAGIC, 99)
  5104. +
  5105. +#define VERSION_NUMBER 1
  5106. +
  5107. +#define VIRT_TO_BUS_CACHE_SIZE 8
  5108. +
  5109. +/***** FILE OPS *****/
  5110. +static int Open(struct inode *pInode, struct file *pFile);
  5111. +static int Release(struct inode *pInode, struct file *pFile);
  5112. +static long Ioctl(struct file *pFile, unsigned int cmd, unsigned long arg);
  5113. +static ssize_t Read(struct file *pFile, char __user *pUser, size_t count, loff_t *offp);
  5114. +static int Mmap(struct file *pFile, struct vm_area_struct *pVma);
  5115. +
  5116. +/***** VMA OPS ****/
  5117. +static void VmaOpen4k(struct vm_area_struct *pVma);
  5118. +static void VmaClose4k(struct vm_area_struct *pVma);
  5119. +static int VmaFault4k(struct vm_area_struct *pVma, struct vm_fault *pVmf);
  5120. +
  5121. +/**** DMA PROTOTYPES */
  5122. +static struct DmaControlBlock __user *DmaPrepare(struct DmaControlBlock __user *pUserCB, int *pError);
  5123. +static int DmaKick(struct DmaControlBlock __user *pUserCB);
  5124. +static void DmaWaitAll(void);
  5125. +
  5126. +/**** GENERIC ****/
  5127. +static int __init dmaer_init(void);
  5128. +static void __exit dmaer_exit(void);
  5129. +
  5130. +/*** OPS ***/
  5131. +static struct vm_operations_struct g_vmOps4k = {
  5132. + .open = VmaOpen4k,
  5133. + .close = VmaClose4k,
  5134. + .fault = VmaFault4k,
  5135. +};
  5136. +
  5137. +static struct file_operations g_fOps = {
  5138. + .owner = THIS_MODULE,
  5139. + .llseek = 0,
  5140. + .read = Read,
  5141. + .write = 0,
  5142. + .unlocked_ioctl = Ioctl,
  5143. + .open = Open,
  5144. + .release = Release,
  5145. + .mmap = Mmap,
  5146. +};
  5147. +
  5148. +/***** GLOBALS ******/
  5149. +static dev_t g_majorMinor;
  5150. +
  5151. +//tracking usage of the two files
  5152. +static atomic_t g_oneLock4k = ATOMIC_INIT(1);
  5153. +
  5154. +//device operations
  5155. +static struct cdev g_cDev;
  5156. +static int g_trackedPages = 0;
  5157. +
  5158. +//dma control
  5159. +static unsigned int *g_pDmaChanBase;
  5160. +static int g_dmaIrq;
  5161. +static int g_dmaChan;
  5162. +
  5163. +//cma allocation
  5164. +static int g_cmaHandle;
  5165. +
  5166. +//user virtual to bus address translation acceleration
  5167. +static unsigned long g_virtAddr[VIRT_TO_BUS_CACHE_SIZE];
  5168. +static unsigned long g_busAddr[VIRT_TO_BUS_CACHE_SIZE];
  5169. +static unsigned long g_cbVirtAddr;
  5170. +static unsigned long g_cbBusAddr;
  5171. +static int g_cacheInsertAt;
  5172. +static int g_cacheHit, g_cacheMiss;
  5173. +
  5174. +//off by default
  5175. +static void __user *g_pMinPhys;
  5176. +static void __user *g_pMaxPhys;
  5177. +static unsigned long g_physOffset;
  5178. +
  5179. +/****** CACHE OPERATIONS ********/
  5180. +static inline void FlushAddrCache(void)
  5181. +{
  5182. + int count = 0;
  5183. + for (count = 0; count < VIRT_TO_BUS_CACHE_SIZE; count++)
  5184. + g_virtAddr[count] = 0xffffffff; //never going to match as we always chop the bottom bits anyway
  5185. +
  5186. + g_cbVirtAddr = 0xffffffff;
  5187. +
  5188. + g_cacheInsertAt = 0;
  5189. +}
  5190. +
  5191. +//translate from a user virtual address to a bus address by mapping the page
  5192. +//NB this won't lock a page in memory, so to avoid potential paging issues using kernel logical addresses
  5193. +static inline void __iomem *UserVirtualToBus(void __user *pUser)
  5194. +{
  5195. + int mapped;
  5196. + struct page *pPage;
  5197. + void *phys;
  5198. +
  5199. + //map it (requiring that the pointer points to something that does not hang off the page boundary)
  5200. + mapped = get_user_pages(current, current->mm,
  5201. + (unsigned long)pUser, 1,
  5202. + 1, 0,
  5203. + &pPage,
  5204. + 0);
  5205. +
  5206. + if (mapped <= 0) //error
  5207. + return 0;
  5208. +
  5209. + PRINTK_VERBOSE(KERN_DEBUG "user virtual %p arm phys %p bus %p\n",
  5210. + pUser, page_address(pPage), (void __iomem *)__virt_to_bus(page_address(pPage)));
  5211. +
  5212. + //get the arm physical address
  5213. + phys = page_address(pPage) + offset_in_page(pUser);
  5214. + page_cache_release(pPage);
  5215. +
  5216. + //and now the bus address
  5217. + return (void __iomem *)__virt_to_bus(phys);
  5218. +}
  5219. +
  5220. +static inline void __iomem *UserVirtualToBusViaCbCache(void __user *pUser)
  5221. +{
  5222. + unsigned long virtual_page = (unsigned long)pUser & ~4095;
  5223. + unsigned long page_offset = (unsigned long)pUser & 4095;
  5224. + unsigned long bus_addr;
  5225. +
  5226. + if (g_cbVirtAddr == virtual_page)
  5227. + {
  5228. + bus_addr = g_cbBusAddr + page_offset;
  5229. + g_cacheHit++;
  5230. + return (void __iomem *)bus_addr;
  5231. + }
  5232. + else
  5233. + {
  5234. + bus_addr = (unsigned long)UserVirtualToBus(pUser);
  5235. +
  5236. + if (!bus_addr)
  5237. + return 0;
  5238. +
  5239. + g_cbVirtAddr = virtual_page;
  5240. + g_cbBusAddr = bus_addr & ~4095;
  5241. + g_cacheMiss++;
  5242. +
  5243. + return (void __iomem *)bus_addr;
  5244. + }
  5245. +}
  5246. +
  5247. +//do the same as above, by query our virt->bus cache
  5248. +static inline void __iomem *UserVirtualToBusViaCache(void __user *pUser)
  5249. +{
  5250. + int count;
  5251. + //get the page and its offset
  5252. + unsigned long virtual_page = (unsigned long)pUser & ~4095;
  5253. + unsigned long page_offset = (unsigned long)pUser & 4095;
  5254. + unsigned long bus_addr;
  5255. +
  5256. + if (pUser >= g_pMinPhys && pUser < g_pMaxPhys)
  5257. + {
  5258. + PRINTK_VERBOSE(KERN_DEBUG "user->phys passthrough on %p\n", pUser);
  5259. + return (void __iomem *)((unsigned long)pUser + g_physOffset);
  5260. + }
  5261. +
  5262. + //check the cache for our entry
  5263. + for (count = 0; count < VIRT_TO_BUS_CACHE_SIZE; count++)
  5264. + if (g_virtAddr[count] == virtual_page)
  5265. + {
  5266. + bus_addr = g_busAddr[count] + page_offset;
  5267. + g_cacheHit++;
  5268. + return (void __iomem *)bus_addr;
  5269. + }
  5270. +
  5271. + //not found, look up manually and then insert its page address
  5272. + bus_addr = (unsigned long)UserVirtualToBus(pUser);
  5273. +
  5274. + if (!bus_addr)
  5275. + return 0;
  5276. +
  5277. + g_virtAddr[g_cacheInsertAt] = virtual_page;
  5278. + g_busAddr[g_cacheInsertAt] = bus_addr & ~4095;
  5279. +
  5280. + //round robin
  5281. + g_cacheInsertAt++;
  5282. + if (g_cacheInsertAt == VIRT_TO_BUS_CACHE_SIZE)
  5283. + g_cacheInsertAt = 0;
  5284. +
  5285. + g_cacheMiss++;
  5286. +
  5287. + return (void __iomem *)bus_addr;
  5288. +}
  5289. +
  5290. +/***** FILE OPERATIONS ****/
  5291. +static int Open(struct inode *pInode, struct file *pFile)
  5292. +{
  5293. + PRINTK(KERN_DEBUG "file opening: %d/%d\n", imajor(pInode), iminor(pInode));
  5294. +
  5295. + //check which device we are
  5296. + if (iminor(pInode) == 0) //4k
  5297. + {
  5298. + //only one at a time
  5299. + if (!atomic_dec_and_test(&g_oneLock4k))
  5300. + {
  5301. + atomic_inc(&g_oneLock4k);
  5302. + return -EBUSY;
  5303. + }
  5304. + }
  5305. + else
  5306. + return -EINVAL;
  5307. +
  5308. + //todo there will be trouble if two different processes open the files
  5309. +
  5310. + //reset after any file is opened
  5311. + g_pMinPhys = (void __user *)-1;
  5312. + g_pMaxPhys = (void __user *)0;
  5313. + g_physOffset = 0;
  5314. + g_cmaHandle = 0;
  5315. +
  5316. + return 0;
  5317. +}
  5318. +
  5319. +static int Release(struct inode *pInode, struct file *pFile)
  5320. +{
  5321. + PRINTK(KERN_DEBUG "file closing, %d pages tracked\n", g_trackedPages);
  5322. + if (g_trackedPages)
  5323. + PRINTK(KERN_ERR "we\'re leaking memory!\n");
  5324. +
  5325. + //wait for any dmas to finish
  5326. + DmaWaitAll();
  5327. +
  5328. + //free this memory on the application closing the file or it crashing (implicitly closing the file)
  5329. + if (g_cmaHandle)
  5330. + {
  5331. + PRINTK(KERN_DEBUG "unlocking vc memory\n");
  5332. + if (UnlockVcMemory(g_cmaHandle))
  5333. + PRINTK(KERN_ERR "uh-oh, unable to unlock vc memory!\n");
  5334. + PRINTK(KERN_DEBUG "releasing vc memory\n");
  5335. + if (ReleaseVcMemory(g_cmaHandle))
  5336. + PRINTK(KERN_ERR "uh-oh, unable to release vc memory!\n");
  5337. + }
  5338. +
  5339. + if (iminor(pInode) == 0)
  5340. + atomic_inc(&g_oneLock4k);
  5341. + else
  5342. + return -EINVAL;
  5343. +
  5344. + return 0;
  5345. +}
  5346. +
  5347. +static struct DmaControlBlock __user *DmaPrepare(struct DmaControlBlock __user *pUserCB, int *pError)
  5348. +{
  5349. + struct DmaControlBlock kernCB;
  5350. + struct DmaControlBlock __user *pUNext;
  5351. + void __iomem *pSourceBus, __iomem *pDestBus;
  5352. +
  5353. + //get the control block into kernel memory so we can work on it
  5354. + if (copy_from_user(&kernCB, pUserCB, sizeof(struct DmaControlBlock)) != 0)
  5355. + {
  5356. + PRINTK(KERN_ERR "copy_from_user failed for user cb %p\n", pUserCB);
  5357. + *pError = 1;
  5358. + return 0;
  5359. + }
  5360. +
  5361. + if (kernCB.m_pSourceAddr == 0 || kernCB.m_pDestAddr == 0)
  5362. + {
  5363. + PRINTK(KERN_ERR "faulty source (%p) dest (%p) addresses for user cb %p\n",
  5364. + kernCB.m_pSourceAddr, kernCB.m_pDestAddr, pUserCB);
  5365. + *pError = 1;
  5366. + return 0;
  5367. + }
  5368. +
  5369. + pSourceBus = UserVirtualToBusViaCache(kernCB.m_pSourceAddr);
  5370. + pDestBus = UserVirtualToBusViaCache(kernCB.m_pDestAddr);
  5371. +
  5372. + if (!pSourceBus || !pDestBus)
  5373. + {
  5374. + PRINTK(KERN_ERR "virtual to bus translation failure for source/dest %p/%p->%p/%p\n",
  5375. + kernCB.m_pSourceAddr, kernCB.m_pDestAddr,
  5376. + pSourceBus, pDestBus);
  5377. + *pError = 1;
  5378. + return 0;
  5379. + }
  5380. +
  5381. + //update the user structure with the new bus addresses
  5382. + kernCB.m_pSourceAddr = pSourceBus;
  5383. + kernCB.m_pDestAddr = pDestBus;
  5384. +
  5385. + PRINTK_VERBOSE(KERN_DEBUG "final source %p dest %p\n", kernCB.m_pSourceAddr, kernCB.m_pDestAddr);
  5386. +
  5387. + //sort out the bus address for the next block
  5388. + pUNext = kernCB.m_pNext;
  5389. +
  5390. + if (kernCB.m_pNext)
  5391. + {
  5392. + void __iomem *pNextBus;
  5393. + pNextBus = UserVirtualToBusViaCbCache(kernCB.m_pNext);
  5394. +
  5395. + if (!pNextBus)
  5396. + {
  5397. + PRINTK(KERN_ERR "virtual to bus translation failure for m_pNext\n");
  5398. + *pError = 1;
  5399. + return 0;
  5400. + }
  5401. +
  5402. + //update the pointer with the bus address
  5403. + kernCB.m_pNext = pNextBus;
  5404. + }
  5405. +
  5406. + //write it back to user space
  5407. + if (copy_to_user(pUserCB, &kernCB, sizeof(struct DmaControlBlock)) != 0)
  5408. + {
  5409. + PRINTK(KERN_ERR "copy_to_user failed for cb %p\n", pUserCB);
  5410. + *pError = 1;
  5411. + return 0;
  5412. + }
  5413. +
  5414. + __cpuc_flush_dcache_area(pUserCB, 32);
  5415. +
  5416. + *pError = 0;
  5417. + return pUNext;
  5418. +}
  5419. +
  5420. +static int DmaKick(struct DmaControlBlock __user *pUserCB)
  5421. +{
  5422. + void __iomem *pBusCB;
  5423. +
  5424. + pBusCB = UserVirtualToBusViaCbCache(pUserCB);
  5425. + if (!pBusCB)
  5426. + {
  5427. + PRINTK(KERN_ERR "virtual to bus translation failure for cb\n");
  5428. + return 1;
  5429. + }
  5430. +
  5431. + //flush_cache_all();
  5432. +
  5433. + bcm_dma_start(g_pDmaChanBase, (dma_addr_t)pBusCB);
  5434. +
  5435. + return 0;
  5436. +}
  5437. +
  5438. +static void DmaWaitAll(void)
  5439. +{
  5440. + int counter = 0;
  5441. + volatile int inner_count;
  5442. + volatile unsigned int cs;
  5443. + unsigned long time_before, time_after;
  5444. +
  5445. + time_before = jiffies;
  5446. + //bcm_dma_wait_idle(g_pDmaChanBase);
  5447. + dsb();
  5448. +
  5449. + cs = readl(g_pDmaChanBase);
  5450. +
  5451. + while ((cs & 1) == 1)
  5452. + {
  5453. + cs = readl(g_pDmaChanBase);
  5454. + counter++;
  5455. +
  5456. + for (inner_count = 0; inner_count < 32; inner_count++);
  5457. +
  5458. + asm volatile ("MCR p15,0,r0,c7,c0,4 \n");
  5459. + //cpu_do_idle();
  5460. + if (counter >= 1000000)
  5461. + {
  5462. + PRINTK(KERN_WARNING "DMA failed to finish in a timely fashion\n");
  5463. + break;
  5464. + }
  5465. + }
  5466. + time_after = jiffies;
  5467. + PRINTK_VERBOSE(KERN_DEBUG "done, counter %d, cs %08x", counter, cs);
  5468. + PRINTK_VERBOSE(KERN_DEBUG "took %ld jiffies, %d HZ\n", time_after - time_before, HZ);
  5469. +}
  5470. +
  5471. +static long Ioctl(struct file *pFile, unsigned int cmd, unsigned long arg)
  5472. +{
  5473. + int error = 0;
  5474. + PRINTK_VERBOSE(KERN_DEBUG "ioctl cmd %x arg %lx\n", cmd, arg);
  5475. +
  5476. + switch (cmd)
  5477. + {
  5478. + case DMA_PREPARE:
  5479. + case DMA_PREPARE_KICK:
  5480. + case DMA_PREPARE_KICK_WAIT:
  5481. + {
  5482. + struct DmaControlBlock __user *pUCB = (struct DmaControlBlock *)arg;
  5483. + int steps = 0;
  5484. + unsigned long start_time = jiffies;
  5485. + (void)start_time;
  5486. +
  5487. + //flush our address cache
  5488. + FlushAddrCache();
  5489. +
  5490. + PRINTK_VERBOSE(KERN_DEBUG "dma prepare\n");
  5491. +
  5492. + //do virtual to bus translation for each entry
  5493. + do
  5494. + {
  5495. + pUCB = DmaPrepare(pUCB, &error);
  5496. + } while (error == 0 && ++steps && pUCB);
  5497. + PRINTK_VERBOSE(KERN_DEBUG "prepare done in %d steps, %ld\n", steps, jiffies - start_time);
  5498. +
  5499. + //carry straight on if we want to kick too
  5500. + if (cmd == DMA_PREPARE || error)
  5501. + {
  5502. + PRINTK_VERBOSE(KERN_DEBUG "falling out\n");
  5503. + return error ? -EINVAL : 0;
  5504. + }
  5505. + }
  5506. + case DMA_KICK:
  5507. + PRINTK_VERBOSE(KERN_DEBUG "dma begin\n");
  5508. +
  5509. + if (cmd == DMA_KICK)
  5510. + FlushAddrCache();
  5511. +
  5512. + DmaKick((struct DmaControlBlock __user *)arg);
  5513. +
  5514. + if (cmd != DMA_PREPARE_KICK_WAIT)
  5515. + break;
  5516. +/* case DMA_WAIT_ONE:
  5517. + //PRINTK(KERN_DEBUG "dma wait one\n");
  5518. + break;*/
  5519. + case DMA_WAIT_ALL:
  5520. + //PRINTK(KERN_DEBUG "dma wait all\n");
  5521. + DmaWaitAll();
  5522. + break;
  5523. + case DMA_MAX_BURST:
  5524. + if (g_dmaChan == 0)
  5525. + return 10;
  5526. + else
  5527. + return 5;
  5528. + case DMA_SET_MIN_PHYS:
  5529. + g_pMinPhys = (void __user *)arg;
  5530. + PRINTK(KERN_DEBUG "min/max user/phys bypass set to %p %p\n", g_pMinPhys, g_pMaxPhys);
  5531. + break;
  5532. + case DMA_SET_MAX_PHYS:
  5533. + g_pMaxPhys = (void __user *)arg;
  5534. + PRINTK(KERN_DEBUG "min/max user/phys bypass set to %p %p\n", g_pMinPhys, g_pMaxPhys);
  5535. + break;
  5536. + case DMA_SET_PHYS_OFFSET:
  5537. + g_physOffset = arg;
  5538. + PRINTK(KERN_DEBUG "user/phys bypass offset set to %ld\n", g_physOffset);
  5539. + break;
  5540. + case DMA_CMA_SET_SIZE:
  5541. + {
  5542. + unsigned int pBusAddr;
  5543. +
  5544. + if (g_cmaHandle)
  5545. + {
  5546. + PRINTK(KERN_ERR "memory has already been allocated (handle %d)\n", g_cmaHandle);
  5547. + return -EINVAL;
  5548. + }
  5549. +
  5550. + PRINTK(KERN_INFO "allocating %ld bytes of VC memory\n", arg * 4096);
  5551. +
  5552. + //get the memory
  5553. + if (AllocateVcMemory(&g_cmaHandle, arg * 4096, 4096, MEM_FLAG_L1_NONALLOCATING | MEM_FLAG_NO_INIT | MEM_FLAG_HINT_PERMALOCK))
  5554. + {
  5555. + PRINTK(KERN_ERR "failed to allocate %ld bytes of VC memory\n", arg * 4096);
  5556. + g_cmaHandle = 0;
  5557. + return -EINVAL;
  5558. + }
  5559. +
  5560. + //get an address for it
  5561. + PRINTK(KERN_INFO "trying to map VC memory\n");
  5562. +
  5563. + if (LockVcMemory(&pBusAddr, g_cmaHandle))
  5564. + {
  5565. + PRINTK(KERN_ERR "failed to map CMA handle %d, releasing memory\n", g_cmaHandle);
  5566. + ReleaseVcMemory(g_cmaHandle);
  5567. + g_cmaHandle = 0;
  5568. + }
  5569. +
  5570. + PRINTK(KERN_INFO "bus address for CMA memory is %x\n", pBusAddr);
  5571. + return pBusAddr;
  5572. + }
  5573. + case DMA_GET_VERSION:
  5574. + PRINTK(KERN_DEBUG "returning version number, %d\n", VERSION_NUMBER);
  5575. + return VERSION_NUMBER;
  5576. + default:
  5577. + PRINTK(KERN_DEBUG "unknown ioctl: %d\n", cmd);
  5578. + return -EINVAL;
  5579. + }
  5580. +
  5581. + return 0;
  5582. +}
  5583. +
  5584. +static ssize_t Read(struct file *pFile, char __user *pUser, size_t count, loff_t *offp)
  5585. +{
  5586. + return -EIO;
  5587. +}
  5588. +
  5589. +static int Mmap(struct file *pFile, struct vm_area_struct *pVma)
  5590. +{
  5591. + struct PageList *pPages;
  5592. + struct VmaPageList *pVmaList;
  5593. +
  5594. + PRINTK_VERBOSE(KERN_DEBUG "MMAP vma %p, length %ld (%s %d)\n",
  5595. + pVma, pVma->vm_end - pVma->vm_start,
  5596. + current->comm, current->pid);
  5597. + PRINTK_VERBOSE(KERN_DEBUG "MMAP %p %d (tracked %d)\n", pVma, current->pid, g_trackedPages);
  5598. +
  5599. + //make a new page list
  5600. + pPages = (struct PageList *)kmalloc(sizeof(struct PageList), GFP_KERNEL);
  5601. + if (!pPages)
  5602. + {
  5603. + PRINTK(KERN_ERR "couldn\'t allocate a new page list (%s %d)\n",
  5604. + current->comm, current->pid);
  5605. + return -ENOMEM;
  5606. + }
  5607. +
  5608. + //clear the page list
  5609. + pPages->m_used = 0;
  5610. + pPages->m_pNext = 0;
  5611. +
  5612. + //insert our vma and new page list somewhere
  5613. + if (!pVma->vm_private_data)
  5614. + {
  5615. + struct VmaPageList *pList;
  5616. +
  5617. + PRINTK_VERBOSE(KERN_DEBUG "new vma list, making new one (%s %d)\n",
  5618. + current->comm, current->pid);
  5619. +
  5620. + //make a new vma list
  5621. + pList = (struct VmaPageList *)kmalloc(sizeof(struct VmaPageList), GFP_KERNEL);
  5622. + if (!pList)
  5623. + {
  5624. + PRINTK(KERN_ERR "couldn\'t allocate vma page list (%s %d)\n",
  5625. + current->comm, current->pid);
  5626. + kfree(pPages);
  5627. + return -ENOMEM;
  5628. + }
  5629. +
  5630. + //clear this list
  5631. + pVma->vm_private_data = (void *)pList;
  5632. + pList->m_refCount = 0;
  5633. + }
  5634. +
  5635. + pVmaList = (struct VmaPageList *)pVma->vm_private_data;
  5636. +
  5637. + //add it to the vma list
  5638. + pVmaList->m_pPageHead = pPages;
  5639. + pVmaList->m_pPageTail = pPages;
  5640. +
  5641. + pVma->vm_ops = &g_vmOps4k;
  5642. + pVma->vm_flags |= VM_IO;
  5643. +
  5644. + VmaOpen4k(pVma);
  5645. +
  5646. + return 0;
  5647. +}
  5648. +
  5649. +/****** VMA OPERATIONS ******/
  5650. +
  5651. +static void VmaOpen4k(struct vm_area_struct *pVma)
  5652. +{
  5653. + struct VmaPageList *pVmaList;
  5654. +
  5655. + PRINTK_VERBOSE(KERN_DEBUG "vma open %p private %p (%s %d), %d live pages\n", pVma, pVma->vm_private_data, current->comm, current->pid, g_trackedPages);
  5656. + PRINTK_VERBOSE(KERN_DEBUG "OPEN %p %d %ld pages (tracked pages %d)\n",
  5657. + pVma, current->pid, (pVma->vm_end - pVma->vm_start) >> 12,
  5658. + g_trackedPages);
  5659. +
  5660. + pVmaList = (struct VmaPageList *)pVma->vm_private_data;
  5661. +
  5662. + if (pVmaList)
  5663. + {
  5664. + pVmaList->m_refCount++;
  5665. + PRINTK_VERBOSE(KERN_DEBUG "ref count is now %d\n", pVmaList->m_refCount);
  5666. + }
  5667. + else
  5668. + {
  5669. + PRINTK_VERBOSE(KERN_DEBUG "err, open but no vma page list\n");
  5670. + }
  5671. +}
  5672. +
  5673. +static void VmaClose4k(struct vm_area_struct *pVma)
  5674. +{
  5675. + struct VmaPageList *pVmaList;
  5676. + int freed = 0;
  5677. +
  5678. + PRINTK_VERBOSE(KERN_DEBUG "vma close %p private %p (%s %d)\n", pVma, pVma->vm_private_data, current->comm, current->pid);
  5679. +
  5680. + //wait for any dmas to finish
  5681. + DmaWaitAll();
  5682. +
  5683. + //find our vma in the list
  5684. + pVmaList = (struct VmaPageList *)pVma->vm_private_data;
  5685. +
  5686. + //may be a fork
  5687. + if (pVmaList)
  5688. + {
  5689. + struct PageList *pPages;
  5690. +
  5691. + pVmaList->m_refCount--;
  5692. +
  5693. + if (pVmaList->m_refCount == 0)
  5694. + {
  5695. + PRINTK_VERBOSE(KERN_DEBUG "found vma, freeing pages (%s %d)\n",
  5696. + current->comm, current->pid);
  5697. +
  5698. + pPages = pVmaList->m_pPageHead;
  5699. +
  5700. + if (!pPages)
  5701. + {
  5702. + PRINTK(KERN_ERR "no page list (%s %d)!\n",
  5703. + current->comm, current->pid);
  5704. + return;
  5705. + }
  5706. +
  5707. + while (pPages)
  5708. + {
  5709. + struct PageList *next;
  5710. + int count;
  5711. +
  5712. + PRINTK_VERBOSE(KERN_DEBUG "page list (%s %d)\n",
  5713. + current->comm, current->pid);
  5714. +
  5715. + next = pPages->m_pNext;
  5716. + for (count = 0; count < pPages->m_used; count++)
  5717. + {
  5718. + PRINTK_VERBOSE(KERN_DEBUG "freeing page %p (%s %d)\n",
  5719. + pPages->m_pPages[count],
  5720. + current->comm, current->pid);
  5721. + __free_pages(pPages->m_pPages[count], 0);
  5722. + g_trackedPages--;
  5723. + freed++;
  5724. + }
  5725. +
  5726. + PRINTK_VERBOSE(KERN_DEBUG "freeing page list (%s %d)\n",
  5727. + current->comm, current->pid);
  5728. + kfree(pPages);
  5729. + pPages = next;
  5730. + }
  5731. +
  5732. + //remove our vma from the list
  5733. + kfree(pVmaList);
  5734. + pVma->vm_private_data = 0;
  5735. + }
  5736. + else
  5737. + {
  5738. + PRINTK_VERBOSE(KERN_DEBUG "ref count is %d, not closing\n", pVmaList->m_refCount);
  5739. + }
  5740. + }
  5741. + else
  5742. + {
  5743. + PRINTK_VERBOSE(KERN_ERR "uh-oh, vma %p not found (%s %d)!\n", pVma, current->comm, current->pid);
  5744. + PRINTK_VERBOSE(KERN_ERR "CLOSE ERR\n");
  5745. + }
  5746. +
  5747. + PRINTK_VERBOSE(KERN_DEBUG "CLOSE %p %d %d pages (tracked pages %d)",
  5748. + pVma, current->pid, freed, g_trackedPages);
  5749. +
  5750. + PRINTK_VERBOSE(KERN_DEBUG "%d pages open\n", g_trackedPages);
  5751. +}
  5752. +
  5753. +static int VmaFault4k(struct vm_area_struct *pVma, struct vm_fault *pVmf)
  5754. +{
  5755. + PRINTK_VERBOSE(KERN_DEBUG "vma fault for vma %p private %p at offset %ld (%s %d)\n", pVma, pVma->vm_private_data, pVmf->pgoff,
  5756. + current->comm, current->pid);
  5757. + PRINTK_VERBOSE(KERN_DEBUG "FAULT\n");
  5758. + pVmf->page = alloc_page(GFP_KERNEL);
  5759. +
  5760. + if (pVmf->page)
  5761. + {
  5762. + PRINTK_VERBOSE(KERN_DEBUG "alloc page virtual %p\n", page_address(pVmf->page));
  5763. + }
  5764. +
  5765. + if (!pVmf->page)
  5766. + {
  5767. + PRINTK(KERN_ERR "vma fault oom (%s %d)\n", current->comm, current->pid);
  5768. + return VM_FAULT_OOM;
  5769. + }
  5770. + else
  5771. + {
  5772. + struct VmaPageList *pVmaList;
  5773. +
  5774. + get_page(pVmf->page);
  5775. + g_trackedPages++;
  5776. +
  5777. + //find our vma in the list
  5778. + pVmaList = (struct VmaPageList *)pVma->vm_private_data;
  5779. +
  5780. + if (pVmaList)
  5781. + {
  5782. + PRINTK_VERBOSE(KERN_DEBUG "vma found (%s %d)\n", current->comm, current->pid);
  5783. +
  5784. + if (pVmaList->m_pPageTail->m_used == PAGES_PER_LIST)
  5785. + {
  5786. + PRINTK_VERBOSE(KERN_DEBUG "making new page list (%s %d)\n", current->comm, current->pid);
  5787. + //making a new page list
  5788. + pVmaList->m_pPageTail->m_pNext = (struct PageList *)kmalloc(sizeof(struct PageList), GFP_KERNEL);
  5789. + if (!pVmaList->m_pPageTail->m_pNext)
  5790. + return -ENOMEM;
  5791. +
  5792. + //update the tail pointer
  5793. + pVmaList->m_pPageTail = pVmaList->m_pPageTail->m_pNext;
  5794. + pVmaList->m_pPageTail->m_used = 0;
  5795. + pVmaList->m_pPageTail->m_pNext = 0;
  5796. + }
  5797. +
  5798. + PRINTK_VERBOSE(KERN_DEBUG "adding page to list (%s %d)\n", current->comm, current->pid);
  5799. +
  5800. + pVmaList->m_pPageTail->m_pPages[pVmaList->m_pPageTail->m_used] = pVmf->page;
  5801. + pVmaList->m_pPageTail->m_used++;
  5802. + }
  5803. + else
  5804. + PRINTK(KERN_ERR "returned page for vma we don\'t know %p (%s %d)\n", pVma, current->comm, current->pid);
  5805. +
  5806. + return 0;
  5807. + }
  5808. +}
  5809. +
  5810. +/****** GENERIC FUNCTIONS ******/
  5811. +static int __init dmaer_init(void)
  5812. +{
  5813. + int result = alloc_chrdev_region(&g_majorMinor, 0, 1, "dmaer");
  5814. + if (result < 0)
  5815. + {
  5816. + PRINTK(KERN_ERR "unable to get major device number\n");
  5817. + return result;
  5818. + }
  5819. + else
  5820. + PRINTK(KERN_DEBUG "major device number %d\n", MAJOR(g_majorMinor));
  5821. +
  5822. + PRINTK(KERN_DEBUG "vma list size %d, page list size %d, page size %ld\n",
  5823. + sizeof(struct VmaPageList), sizeof(struct PageList), PAGE_SIZE);
  5824. +
  5825. + //get a dma channel to work with
  5826. + result = bcm_dma_chan_alloc(BCM_DMA_FEATURE_FAST, (void **)&g_pDmaChanBase, &g_dmaIrq);
  5827. +
  5828. + //uncomment to force to channel 0
  5829. + //result = 0;
  5830. + //g_pDmaChanBase = 0xce808000;
  5831. +
  5832. + if (result < 0)
  5833. + {
  5834. + PRINTK(KERN_ERR "failed to allocate dma channel\n");
  5835. + cdev_del(&g_cDev);
  5836. + unregister_chrdev_region(g_majorMinor, 1);
  5837. + }
  5838. +
  5839. + //reset the channel
  5840. + PRINTK(KERN_DEBUG "allocated dma channel %d (%p), initial state %08x\n", result, g_pDmaChanBase, *g_pDmaChanBase);
  5841. + *g_pDmaChanBase = 1 << 31;
  5842. + PRINTK(KERN_DEBUG "post-reset %08x\n", *g_pDmaChanBase);
  5843. +
  5844. + g_dmaChan = result;
  5845. +
  5846. + //clear the cache stats
  5847. + g_cacheHit = 0;
  5848. + g_cacheMiss = 0;
  5849. +
  5850. + //register our device - after this we are go go go
  5851. + cdev_init(&g_cDev, &g_fOps);
  5852. + g_cDev.owner = THIS_MODULE;
  5853. + g_cDev.ops = &g_fOps;
  5854. +
  5855. + result = cdev_add(&g_cDev, g_majorMinor, 1);
  5856. + if (result < 0)
  5857. + {
  5858. + PRINTK(KERN_ERR "failed to add character device\n");
  5859. + unregister_chrdev_region(g_majorMinor, 1);
  5860. + bcm_dma_chan_free(g_dmaChan);
  5861. + return result;
  5862. + }
  5863. +
  5864. + return 0;
  5865. +}
  5866. +
  5867. +static void __exit dmaer_exit(void)
  5868. +{
  5869. + PRINTK(KERN_INFO "closing dmaer device, cache stats: %d hits %d misses\n", g_cacheHit, g_cacheMiss);
  5870. + //unregister the device
  5871. + cdev_del(&g_cDev);
  5872. + unregister_chrdev_region(g_majorMinor, 1);
  5873. + //free the dma channel
  5874. + bcm_dma_chan_free(g_dmaChan);
  5875. +}
  5876. +
  5877. +MODULE_LICENSE("Dual BSD/GPL");
  5878. +MODULE_AUTHOR("Simon Hall");
  5879. +module_init(dmaer_init);
  5880. +module_exit(dmaer_exit);
  5881. --- /dev/null
  5882. +++ b/arch/arm/mach-bcm2709/include/mach/arm_control.h
  5883. @@ -0,0 +1,493 @@
  5884. +/*
  5885. + * linux/arch/arm/mach-bcm2708/arm_control.h
  5886. + *
  5887. + * Copyright (C) 2010 Broadcom
  5888. + *
  5889. + * This program is free software; you can redistribute it and/or modify
  5890. + * it under the terms of the GNU General Public License as published by
  5891. + * the Free Software Foundation; either version 2 of the License, or
  5892. + * (at your option) any later version.
  5893. + *
  5894. + * This program is distributed in the hope that it will be useful,
  5895. + * but WITHOUT ANY WARRANTY; without even the implied warranty of
  5896. + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  5897. + * GNU General Public License for more details.
  5898. + *
  5899. + * You should have received a copy of the GNU General Public License
  5900. + * along with this program; if not, write to the Free Software
  5901. + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
  5902. + */
  5903. +
  5904. +#ifndef __BCM2708_ARM_CONTROL_H
  5905. +#define __BCM2708_ARM_CONTROL_H
  5906. +
  5907. +/*
  5908. + * Definitions and addresses for the ARM CONTROL logic
  5909. + * This file is manually generated.
  5910. + */
  5911. +
  5912. +#define ARM_BASE 0x7E00B000
  5913. +
  5914. +/* Basic configuration */
  5915. +#define ARM_CONTROL0 HW_REGISTER_RW(ARM_BASE+0x000)
  5916. +#define ARM_C0_SIZ128M 0x00000000
  5917. +#define ARM_C0_SIZ256M 0x00000001
  5918. +#define ARM_C0_SIZ512M 0x00000002
  5919. +#define ARM_C0_SIZ1G 0x00000003
  5920. +#define ARM_C0_BRESP0 0x00000000
  5921. +#define ARM_C0_BRESP1 0x00000004
  5922. +#define ARM_C0_BRESP2 0x00000008
  5923. +#define ARM_C0_BOOTHI 0x00000010
  5924. +#define ARM_C0_UNUSED05 0x00000020 /* free */
  5925. +#define ARM_C0_FULLPERI 0x00000040
  5926. +#define ARM_C0_UNUSED78 0x00000180 /* free */
  5927. +#define ARM_C0_JTAGMASK 0x00000E00
  5928. +#define ARM_C0_JTAGOFF 0x00000000
  5929. +#define ARM_C0_JTAGBASH 0x00000800 /* Debug on GPIO off */
  5930. +#define ARM_C0_JTAGGPIO 0x00000C00 /* Debug on GPIO on */
  5931. +#define ARM_C0_APROTMSK 0x0000F000
  5932. +#define ARM_C0_DBG0SYNC 0x00010000 /* VPU0 halt sync */
  5933. +#define ARM_C0_DBG1SYNC 0x00020000 /* VPU1 halt sync */
  5934. +#define ARM_C0_SWDBGREQ 0x00040000 /* HW debug request */
  5935. +#define ARM_C0_PASSHALT 0x00080000 /* ARM halt passed to debugger */
  5936. +#define ARM_C0_PRIO_PER 0x00F00000 /* per priority mask */
  5937. +#define ARM_C0_PRIO_L2 0x0F000000
  5938. +#define ARM_C0_PRIO_UC 0xF0000000
  5939. +
  5940. +#define ARM_C0_APROTPASS 0x0000A000 /* Translate 1:1 */
  5941. +#define ARM_C0_APROTUSER 0x00000000 /* Only user mode */
  5942. +#define ARM_C0_APROTSYST 0x0000F000 /* Only system mode */
  5943. +
  5944. +
  5945. +#define ARM_CONTROL1 HW_REGISTER_RW(ARM_BASE+0x440)
  5946. +#define ARM_C1_TIMER 0x00000001 /* re-route timer IRQ to VC */
  5947. +#define ARM_C1_MAIL 0x00000002 /* re-route Mail IRQ to VC */
  5948. +#define ARM_C1_BELL0 0x00000004 /* re-route Doorbell 0 to VC */
  5949. +#define ARM_C1_BELL1 0x00000008 /* re-route Doorbell 1 to VC */
  5950. +#define ARM_C1_PERSON 0x00000100 /* peripherals on */
  5951. +#define ARM_C1_REQSTOP 0x00000200 /* ASYNC bridge request stop */
  5952. +
  5953. +#define ARM_STATUS HW_REGISTER_RW(ARM_BASE+0x444)
  5954. +#define ARM_S_ACKSTOP 0x80000000 /* Bridge stopped */
  5955. +#define ARM_S_READPEND 0x000003FF /* pending reads counter */
  5956. +#define ARM_S_WRITPEND 0x000FFC00 /* pending writes counter */
  5957. +
  5958. +#define ARM_ERRHALT HW_REGISTER_RW(ARM_BASE+0x448)
  5959. +#define ARM_EH_PERIBURST 0x00000001 /* Burst write seen on peri bus */
  5960. +#define ARM_EH_ILLADDRS1 0x00000002 /* Address bits 25-27 error */
  5961. +#define ARM_EH_ILLADDRS2 0x00000004 /* Address bits 31-28 error */
  5962. +#define ARM_EH_VPU0HALT 0x00000008 /* VPU0 halted & in debug mode */
  5963. +#define ARM_EH_VPU1HALT 0x00000010 /* VPU1 halted & in debug mode */
  5964. +#define ARM_EH_ARMHALT 0x00000020 /* ARM in halted debug mode */
  5965. +
  5966. +#define ARM_ID_SECURE HW_REGISTER_RW(ARM_BASE+0x00C)
  5967. +#define ARM_ID HW_REGISTER_RW(ARM_BASE+0x44C)
  5968. +#define ARM_IDVAL 0x364D5241
  5969. +
  5970. +/* Translation memory */
  5971. +#define ARM_TRANSLATE HW_REGISTER_RW(ARM_BASE+0x100)
  5972. +/* 32 locations: 0x100.. 0x17F */
  5973. +/* 32 spare means we CAN go to 64 pages.... */
  5974. +
  5975. +
  5976. +/* Interrupts */
  5977. +#define ARM_IRQ_PEND0 HW_REGISTER_RW(ARM_BASE+0x200) /* Top IRQ bits */
  5978. +#define ARM_I0_TIMER 0x00000001 /* timer IRQ */
  5979. +#define ARM_I0_MAIL 0x00000002 /* Mail IRQ */
  5980. +#define ARM_I0_BELL0 0x00000004 /* Doorbell 0 */
  5981. +#define ARM_I0_BELL1 0x00000008 /* Doorbell 1 */
  5982. +#define ARM_I0_BANK1 0x00000100 /* Bank1 IRQ */
  5983. +#define ARM_I0_BANK2 0x00000200 /* Bank2 IRQ */
  5984. +
  5985. +#define ARM_IRQ_PEND1 HW_REGISTER_RW(ARM_BASE+0x204) /* All bank1 IRQ bits */
  5986. +/* todo: all I1_interrupt sources */
  5987. +#define ARM_IRQ_PEND2 HW_REGISTER_RW(ARM_BASE+0x208) /* All bank2 IRQ bits */
  5988. +/* todo: all I2_interrupt sources */
  5989. +
  5990. +#define ARM_IRQ_FAST HW_REGISTER_RW(ARM_BASE+0x20C) /* FIQ control */
  5991. +#define ARM_IF_INDEX 0x0000007F /* FIQ select */
  5992. +#define ARM_IF_ENABLE 0x00000080 /* FIQ enable */
  5993. +#define ARM_IF_VCMASK 0x0000003F /* FIQ = (index from VC source) */
  5994. +#define ARM_IF_TIMER 0x00000040 /* FIQ = ARM timer */
  5995. +#define ARM_IF_MAIL 0x00000041 /* FIQ = ARM Mail */
  5996. +#define ARM_IF_BELL0 0x00000042 /* FIQ = ARM Doorbell 0 */
  5997. +#define ARM_IF_BELL1 0x00000043 /* FIQ = ARM Doorbell 1 */
  5998. +#define ARM_IF_VP0HALT 0x00000044 /* FIQ = VPU0 Halt seen */
  5999. +#define ARM_IF_VP1HALT 0x00000045 /* FIQ = VPU1 Halt seen */
  6000. +#define ARM_IF_ILLEGAL 0x00000046 /* FIQ = Illegal access seen */
  6001. +
  6002. +#define ARM_IRQ_ENBL1 HW_REGISTER_RW(ARM_BASE+0x210) /* Bank1 enable bits */
  6003. +#define ARM_IRQ_ENBL2 HW_REGISTER_RW(ARM_BASE+0x214) /* Bank2 enable bits */
  6004. +#define ARM_IRQ_ENBL3 HW_REGISTER_RW(ARM_BASE+0x218) /* ARM irqs enable bits */
  6005. +#define ARM_IRQ_DIBL1 HW_REGISTER_RW(ARM_BASE+0x21C) /* Bank1 disable bits */
  6006. +#define ARM_IRQ_DIBL2 HW_REGISTER_RW(ARM_BASE+0x220) /* Bank2 disable bits */
  6007. +#define ARM_IRQ_DIBL3 HW_REGISTER_RW(ARM_BASE+0x224) /* ARM irqs disable bits */
  6008. +#define ARM_IE_TIMER 0x00000001 /* Timer IRQ */
  6009. +#define ARM_IE_MAIL 0x00000002 /* Mail IRQ */
  6010. +#define ARM_IE_BELL0 0x00000004 /* Doorbell 0 */
  6011. +#define ARM_IE_BELL1 0x00000008 /* Doorbell 1 */
  6012. +#define ARM_IE_VP0HALT 0x00000010 /* VPU0 Halt */
  6013. +#define ARM_IE_VP1HALT 0x00000020 /* VPU1 Halt */
  6014. +#define ARM_IE_ILLEGAL 0x00000040 /* Illegal access seen */
  6015. +
  6016. +/* Timer */
  6017. +/* For reg. fields see sp804 spec. */
  6018. +#define ARM_T_LOAD HW_REGISTER_RW(ARM_BASE+0x400)
  6019. +#define ARM_T_VALUE HW_REGISTER_RW(ARM_BASE+0x404)
  6020. +#define ARM_T_CONTROL HW_REGISTER_RW(ARM_BASE+0x408)
  6021. +#define ARM_T_IRQCNTL HW_REGISTER_RW(ARM_BASE+0x40C)
  6022. +#define ARM_T_RAWIRQ HW_REGISTER_RW(ARM_BASE+0x410)
  6023. +#define ARM_T_MSKIRQ HW_REGISTER_RW(ARM_BASE+0x414)
  6024. +#define ARM_T_RELOAD HW_REGISTER_RW(ARM_BASE+0x418)
  6025. +#define ARM_T_PREDIV HW_REGISTER_RW(ARM_BASE+0x41c)
  6026. +#define ARM_T_FREECNT HW_REGISTER_RW(ARM_BASE+0x420)
  6027. +
  6028. +#define TIMER_CTRL_ONESHOT (1 << 0)
  6029. +#define TIMER_CTRL_32BIT (1 << 1)
  6030. +#define TIMER_CTRL_DIV1 (0 << 2)
  6031. +#define TIMER_CTRL_DIV16 (1 << 2)
  6032. +#define TIMER_CTRL_DIV256 (2 << 2)
  6033. +#define TIMER_CTRL_IE (1 << 5)
  6034. +#define TIMER_CTRL_PERIODIC (1 << 6)
  6035. +#define TIMER_CTRL_ENABLE (1 << 7)
  6036. +#define TIMER_CTRL_DBGHALT (1 << 8)
  6037. +#define TIMER_CTRL_ENAFREE (1 << 9)
  6038. +#define TIMER_CTRL_FREEDIV_SHIFT 16)
  6039. +#define TIMER_CTRL_FREEDIV_MASK 0xff
  6040. +
  6041. +/* Semaphores, Doorbells, Mailboxes */
  6042. +#define ARM_SBM_OWN0 (ARM_BASE+0x800)
  6043. +#define ARM_SBM_OWN1 (ARM_BASE+0x900)
  6044. +#define ARM_SBM_OWN2 (ARM_BASE+0xA00)
  6045. +#define ARM_SBM_OWN3 (ARM_BASE+0xB00)
  6046. +
  6047. +/* MAILBOXES
  6048. + * Register flags are common across all
  6049. + * owner registers. See end of this section
  6050. + *
  6051. + * Semaphores, Doorbells, Mailboxes Owner 0
  6052. + *
  6053. + */
  6054. +
  6055. +#define ARM_0_SEMS HW_REGISTER_RW(ARM_SBM_OWN0+0x00)
  6056. +#define ARM_0_SEM0 HW_REGISTER_RW(ARM_SBM_OWN0+0x00)
  6057. +#define ARM_0_SEM1 HW_REGISTER_RW(ARM_SBM_OWN0+0x04)
  6058. +#define ARM_0_SEM2 HW_REGISTER_RW(ARM_SBM_OWN0+0x08)
  6059. +#define ARM_0_SEM3 HW_REGISTER_RW(ARM_SBM_OWN0+0x0C)
  6060. +#define ARM_0_SEM4 HW_REGISTER_RW(ARM_SBM_OWN0+0x10)
  6061. +#define ARM_0_SEM5 HW_REGISTER_RW(ARM_SBM_OWN0+0x14)
  6062. +#define ARM_0_SEM6 HW_REGISTER_RW(ARM_SBM_OWN0+0x18)
  6063. +#define ARM_0_SEM7 HW_REGISTER_RW(ARM_SBM_OWN0+0x1C)
  6064. +#define ARM_0_BELL0 HW_REGISTER_RW(ARM_SBM_OWN0+0x40)
  6065. +#define ARM_0_BELL1 HW_REGISTER_RW(ARM_SBM_OWN0+0x44)
  6066. +#define ARM_0_BELL2 HW_REGISTER_RW(ARM_SBM_OWN0+0x48)
  6067. +#define ARM_0_BELL3 HW_REGISTER_RW(ARM_SBM_OWN0+0x4C)
  6068. +/* MAILBOX 0 access in Owner 0 area */
  6069. +/* Some addresses should ONLY be used by owner 0 */
  6070. +#define ARM_0_MAIL0_WRT HW_REGISTER_RW(ARM_SBM_OWN0+0x80) /* .. 0x8C (4 locations) */
  6071. +#define ARM_0_MAIL0_RD HW_REGISTER_RW(ARM_SBM_OWN0+0x80) /* .. 0x8C (4 locations) Normal read */
  6072. +#define ARM_0_MAIL0_POL HW_REGISTER_RW(ARM_SBM_OWN0+0x90) /* none-pop read */
  6073. +#define ARM_0_MAIL0_SND HW_REGISTER_RW(ARM_SBM_OWN0+0x94) /* Sender read (only LS 2 bits) */
  6074. +#define ARM_0_MAIL0_STA HW_REGISTER_RW(ARM_SBM_OWN0+0x98) /* Status read */
  6075. +#define ARM_0_MAIL0_CNF HW_REGISTER_RW(ARM_SBM_OWN0+0x9C) /* Config read/write */
  6076. +/* MAILBOX 1 access in Owner 0 area */
  6077. +/* Owner 0 should only WRITE to this mailbox */
  6078. +#define ARM_0_MAIL1_WRT HW_REGISTER_RW(ARM_SBM_OWN0+0xA0) /* .. 0xAC (4 locations) */
  6079. +/*#define ARM_0_MAIL1_RD HW_REGISTER_RW(ARM_SBM_OWN0+0xA0) */ /* DO NOT USE THIS !!!!! */
  6080. +/*#define ARM_0_MAIL1_POL HW_REGISTER_RW(ARM_SBM_OWN0+0xB0) */ /* DO NOT USE THIS !!!!! */
  6081. +/*#define ARM_0_MAIL1_SND HW_REGISTER_RW(ARM_SBM_OWN0+0xB4) */ /* DO NOT USE THIS !!!!! */
  6082. +#define ARM_0_MAIL1_STA HW_REGISTER_RW(ARM_SBM_OWN0+0xB8) /* Status read */
  6083. +/*#define ARM_0_MAIL1_CNF HW_REGISTER_RW(ARM_SBM_OWN0+0xBC) */ /* DO NOT USE THIS !!!!! */
  6084. +/* General SEM, BELL, MAIL config/status */
  6085. +#define ARM_0_SEMCLRDBG HW_REGISTER_RW(ARM_SBM_OWN0+0xE0) /* semaphore clear/debug register */
  6086. +#define ARM_0_BELLCLRDBG HW_REGISTER_RW(ARM_SBM_OWN0+0xE4) /* Doorbells clear/debug register */
  6087. +#define ARM_0_ALL_IRQS HW_REGISTER_RW(ARM_SBM_OWN0+0xF8) /* ALL interrupts */
  6088. +#define ARM_0_MY_IRQS HW_REGISTER_RW(ARM_SBM_OWN0+0xFC) /* IRQS pending for owner 0 */
  6089. +
  6090. +/* Semaphores, Doorbells, Mailboxes Owner 1 */
  6091. +#define ARM_1_SEMS HW_REGISTER_RW(ARM_SBM_OWN1+0x00)
  6092. +#define ARM_1_SEM0 HW_REGISTER_RW(ARM_SBM_OWN1+0x00)
  6093. +#define ARM_1_SEM1 HW_REGISTER_RW(ARM_SBM_OWN1+0x04)
  6094. +#define ARM_1_SEM2 HW_REGISTER_RW(ARM_SBM_OWN1+0x08)
  6095. +#define ARM_1_SEM3 HW_REGISTER_RW(ARM_SBM_OWN1+0x0C)
  6096. +#define ARM_1_SEM4 HW_REGISTER_RW(ARM_SBM_OWN1+0x10)
  6097. +#define ARM_1_SEM5 HW_REGISTER_RW(ARM_SBM_OWN1+0x14)
  6098. +#define ARM_1_SEM6 HW_REGISTER_RW(ARM_SBM_OWN1+0x18)
  6099. +#define ARM_1_SEM7 HW_REGISTER_RW(ARM_SBM_OWN1+0x1C)
  6100. +#define ARM_1_BELL0 HW_REGISTER_RW(ARM_SBM_OWN1+0x40)
  6101. +#define ARM_1_BELL1 HW_REGISTER_RW(ARM_SBM_OWN1+0x44)
  6102. +#define ARM_1_BELL2 HW_REGISTER_RW(ARM_SBM_OWN1+0x48)
  6103. +#define ARM_1_BELL3 HW_REGISTER_RW(ARM_SBM_OWN1+0x4C)
  6104. +/* MAILBOX 0 access in Owner 0 area */
  6105. +/* Owner 1 should only WRITE to this mailbox */
  6106. +#define ARM_1_MAIL0_WRT HW_REGISTER_RW(ARM_SBM_OWN1+0x80) /* .. 0x8C (4 locations) */
  6107. +/*#define ARM_1_MAIL0_RD HW_REGISTER_RW(ARM_SBM_OWN1+0x80) */ /* DO NOT USE THIS !!!!! */
  6108. +/*#define ARM_1_MAIL0_POL HW_REGISTER_RW(ARM_SBM_OWN1+0x90) */ /* DO NOT USE THIS !!!!! */
  6109. +/*#define ARM_1_MAIL0_SND HW_REGISTER_RW(ARM_SBM_OWN1+0x94) */ /* DO NOT USE THIS !!!!! */
  6110. +#define ARM_1_MAIL0_STA HW_REGISTER_RW(ARM_SBM_OWN1+0x98) /* Status read */
  6111. +/*#define ARM_1_MAIL0_CNF HW_REGISTER_RW(ARM_SBM_OWN1+0x9C) */ /* DO NOT USE THIS !!!!! */
  6112. +/* MAILBOX 1 access in Owner 0 area */
  6113. +#define ARM_1_MAIL1_WRT HW_REGISTER_RW(ARM_SBM_OWN1+0xA0) /* .. 0xAC (4 locations) */
  6114. +#define ARM_1_MAIL1_RD HW_REGISTER_RW(ARM_SBM_OWN1+0xA0) /* .. 0xAC (4 locations) Normal read */
  6115. +#define ARM_1_MAIL1_POL HW_REGISTER_RW(ARM_SBM_OWN1+0xB0) /* none-pop read */
  6116. +#define ARM_1_MAIL1_SND HW_REGISTER_RW(ARM_SBM_OWN1+0xB4) /* Sender read (only LS 2 bits) */
  6117. +#define ARM_1_MAIL1_STA HW_REGISTER_RW(ARM_SBM_OWN1+0xB8) /* Status read */
  6118. +#define ARM_1_MAIL1_CNF HW_REGISTER_RW(ARM_SBM_OWN1+0xBC)
  6119. +/* General SEM, BELL, MAIL config/status */
  6120. +#define ARM_1_SEMCLRDBG HW_REGISTER_RW(ARM_SBM_OWN1+0xE0) /* semaphore clear/debug register */
  6121. +#define ARM_1_BELLCLRDBG HW_REGISTER_RW(ARM_SBM_OWN1+0xE4) /* Doorbells clear/debug register */
  6122. +#define ARM_1_MY_IRQS HW_REGISTER_RW(ARM_SBM_OWN1+0xFC) /* IRQS pending for owner 1 */
  6123. +#define ARM_1_ALL_IRQS HW_REGISTER_RW(ARM_SBM_OWN1+0xF8) /* ALL interrupts */
  6124. +
  6125. +/* Semaphores, Doorbells, Mailboxes Owner 2 */
  6126. +#define ARM_2_SEMS HW_REGISTER_RW(ARM_SBM_OWN2+0x00)
  6127. +#define ARM_2_SEM0 HW_REGISTER_RW(ARM_SBM_OWN2+0x00)
  6128. +#define ARM_2_SEM1 HW_REGISTER_RW(ARM_SBM_OWN2+0x04)
  6129. +#define ARM_2_SEM2 HW_REGISTER_RW(ARM_SBM_OWN2+0x08)
  6130. +#define ARM_2_SEM3 HW_REGISTER_RW(ARM_SBM_OWN2+0x0C)
  6131. +#define ARM_2_SEM4 HW_REGISTER_RW(ARM_SBM_OWN2+0x10)
  6132. +#define ARM_2_SEM5 HW_REGISTER_RW(ARM_SBM_OWN2+0x14)
  6133. +#define ARM_2_SEM6 HW_REGISTER_RW(ARM_SBM_OWN2+0x18)
  6134. +#define ARM_2_SEM7 HW_REGISTER_RW(ARM_SBM_OWN2+0x1C)
  6135. +#define ARM_2_BELL0 HW_REGISTER_RW(ARM_SBM_OWN2+0x40)
  6136. +#define ARM_2_BELL1 HW_REGISTER_RW(ARM_SBM_OWN2+0x44)
  6137. +#define ARM_2_BELL2 HW_REGISTER_RW(ARM_SBM_OWN2+0x48)
  6138. +#define ARM_2_BELL3 HW_REGISTER_RW(ARM_SBM_OWN2+0x4C)
  6139. +/* MAILBOX 0 access in Owner 2 area */
  6140. +/* Owner 2 should only WRITE to this mailbox */
  6141. +#define ARM_2_MAIL0_WRT HW_REGISTER_RW(ARM_SBM_OWN2+0x80) /* .. 0x8C (4 locations) */
  6142. +/*#define ARM_2_MAIL0_RD HW_REGISTER_RW(ARM_SBM_OWN2+0x80) */ /* DO NOT USE THIS !!!!! */
  6143. +/*#define ARM_2_MAIL0_POL HW_REGISTER_RW(ARM_SBM_OWN2+0x90) */ /* DO NOT USE THIS !!!!! */
  6144. +/*#define ARM_2_MAIL0_SND HW_REGISTER_RW(ARM_SBM_OWN2+0x94) */ /* DO NOT USE THIS !!!!! */
  6145. +#define ARM_2_MAIL0_STA HW_REGISTER_RW(ARM_SBM_OWN2+0x98) /* Status read */
  6146. +/*#define ARM_2_MAIL0_CNF HW_REGISTER_RW(ARM_SBM_OWN2+0x9C) */ /* DO NOT USE THIS !!!!! */
  6147. +/* MAILBOX 1 access in Owner 2 area */
  6148. +/* Owner 2 should only WRITE to this mailbox */
  6149. +#define ARM_2_MAIL1_WRT HW_REGISTER_RW(ARM_SBM_OWN2+0xA0) /* .. 0xAC (4 locations) */
  6150. +/*#define ARM_2_MAIL1_RD HW_REGISTER_RW(ARM_SBM_OWN2+0xA0) */ /* DO NOT USE THIS !!!!! */
  6151. +/*#define ARM_2_MAIL1_POL HW_REGISTER_RW(ARM_SBM_OWN2+0xB0) */ /* DO NOT USE THIS !!!!! */
  6152. +/*#define ARM_2_MAIL1_SND HW_REGISTER_RW(ARM_SBM_OWN2+0xB4) */ /* DO NOT USE THIS !!!!! */
  6153. +#define ARM_2_MAIL1_STA HW_REGISTER_RW(ARM_SBM_OWN2+0xB8) /* Status read */
  6154. +/*#define ARM_2_MAIL1_CNF HW_REGISTER_RW(ARM_SBM_OWN2+0xBC) */ /* DO NOT USE THIS !!!!! */
  6155. +/* General SEM, BELL, MAIL config/status */
  6156. +#define ARM_2_SEMCLRDBG HW_REGISTER_RW(ARM_SBM_OWN2+0xE0) /* semaphore clear/debug register */
  6157. +#define ARM_2_BELLCLRDBG HW_REGISTER_RW(ARM_SBM_OWN2+0xE4) /* Doorbells clear/debug register */
  6158. +#define ARM_2_MY_IRQS HW_REGISTER_RW(ARM_SBM_OWN2+0xFC) /* IRQS pending for owner 2 */
  6159. +#define ARM_2_ALL_IRQS HW_REGISTER_RW(ARM_SBM_OWN2+0xF8) /* ALL interrupts */
  6160. +
  6161. +/* Semaphores, Doorbells, Mailboxes Owner 3 */
  6162. +#define ARM_3_SEMS HW_REGISTER_RW(ARM_SBM_OWN3+0x00)
  6163. +#define ARM_3_SEM0 HW_REGISTER_RW(ARM_SBM_OWN3+0x00)
  6164. +#define ARM_3_SEM1 HW_REGISTER_RW(ARM_SBM_OWN3+0x04)
  6165. +#define ARM_3_SEM2 HW_REGISTER_RW(ARM_SBM_OWN3+0x08)
  6166. +#define ARM_3_SEM3 HW_REGISTER_RW(ARM_SBM_OWN3+0x0C)
  6167. +#define ARM_3_SEM4 HW_REGISTER_RW(ARM_SBM_OWN3+0x10)
  6168. +#define ARM_3_SEM5 HW_REGISTER_RW(ARM_SBM_OWN3+0x14)
  6169. +#define ARM_3_SEM6 HW_REGISTER_RW(ARM_SBM_OWN3+0x18)
  6170. +#define ARM_3_SEM7 HW_REGISTER_RW(ARM_SBM_OWN3+0x1C)
  6171. +#define ARM_3_BELL0 HW_REGISTER_RW(ARM_SBM_OWN3+0x40)
  6172. +#define ARM_3_BELL1 HW_REGISTER_RW(ARM_SBM_OWN3+0x44)
  6173. +#define ARM_3_BELL2 HW_REGISTER_RW(ARM_SBM_OWN3+0x48)
  6174. +#define ARM_3_BELL3 HW_REGISTER_RW(ARM_SBM_OWN3+0x4C)
  6175. +/* MAILBOX 0 access in Owner 3 area */
  6176. +/* Owner 3 should only WRITE to this mailbox */
  6177. +#define ARM_3_MAIL0_WRT HW_REGISTER_RW(ARM_SBM_OWN3+0x80) /* .. 0x8C (4 locations) */
  6178. +/*#define ARM_3_MAIL0_RD HW_REGISTER_RW(ARM_SBM_OWN3+0x80) */ /* DO NOT USE THIS !!!!! */
  6179. +/*#define ARM_3_MAIL0_POL HW_REGISTER_RW(ARM_SBM_OWN3+0x90) */ /* DO NOT USE THIS !!!!! */
  6180. +/*#define ARM_3_MAIL0_SND HW_REGISTER_RW(ARM_SBM_OWN3+0x94) */ /* DO NOT USE THIS !!!!! */
  6181. +#define ARM_3_MAIL0_STA HW_REGISTER_RW(ARM_SBM_OWN3+0x98) /* Status read */
  6182. +/*#define ARM_3_MAIL0_CNF HW_REGISTER_RW(ARM_SBM_OWN3+0x9C) */ /* DO NOT USE THIS !!!!! */
  6183. +/* MAILBOX 1 access in Owner 3 area */
  6184. +/* Owner 3 should only WRITE to this mailbox */
  6185. +#define ARM_3_MAIL1_WRT HW_REGISTER_RW(ARM_SBM_OWN3+0xA0) /* .. 0xAC (4 locations) */
  6186. +/*#define ARM_3_MAIL1_RD HW_REGISTER_RW(ARM_SBM_OWN3+0xA0) */ /* DO NOT USE THIS !!!!! */
  6187. +/*#define ARM_3_MAIL1_POL HW_REGISTER_RW(ARM_SBM_OWN3+0xB0) */ /* DO NOT USE THIS !!!!! */
  6188. +/*#define ARM_3_MAIL1_SND HW_REGISTER_RW(ARM_SBM_OWN3+0xB4) */ /* DO NOT USE THIS !!!!! */
  6189. +#define ARM_3_MAIL1_STA HW_REGISTER_RW(ARM_SBM_OWN3+0xB8) /* Status read */
  6190. +/*#define ARM_3_MAIL1_CNF HW_REGISTER_RW(ARM_SBM_OWN3+0xBC) */ /* DO NOT USE THIS !!!!! */
  6191. +/* General SEM, BELL, MAIL config/status */
  6192. +#define ARM_3_SEMCLRDBG HW_REGISTER_RW(ARM_SBM_OWN3+0xE0) /* semaphore clear/debug register */
  6193. +#define ARM_3_BELLCLRDBG HW_REGISTER_RW(ARM_SBM_OWN3+0xE4) /* Doorbells clear/debug register */
  6194. +#define ARM_3_MY_IRQS HW_REGISTER_RW(ARM_SBM_OWN3+0xFC) /* IRQS pending for owner 3 */
  6195. +#define ARM_3_ALL_IRQS HW_REGISTER_RW(ARM_SBM_OWN3+0xF8) /* ALL interrupts */
  6196. +
  6197. +
  6198. +
  6199. +/* Mailbox flags. Valid for all owners */
  6200. +
  6201. +/* Mailbox status register (...0x98) */
  6202. +#define ARM_MS_FULL 0x80000000
  6203. +#define ARM_MS_EMPTY 0x40000000
  6204. +#define ARM_MS_LEVEL 0x400000FF /* Max. value depdnds on mailbox depth parameter */
  6205. +
  6206. +/* MAILBOX config/status register (...0x9C) */
  6207. +/* ANY write to this register clears the error bits! */
  6208. +#define ARM_MC_IHAVEDATAIRQEN 0x00000001 /* mailbox irq enable: has data */
  6209. +#define ARM_MC_IHAVESPACEIRQEN 0x00000002 /* mailbox irq enable: has space */
  6210. +#define ARM_MC_OPPISEMPTYIRQEN 0x00000004 /* mailbox irq enable: Opp. is empty */
  6211. +#define ARM_MC_MAIL_CLEAR 0x00000008 /* mailbox clear write 1, then 0 */
  6212. +#define ARM_MC_IHAVEDATAIRQPEND 0x00000010 /* mailbox irq pending: has space */
  6213. +#define ARM_MC_IHAVESPACEIRQPEND 0x00000020 /* mailbox irq pending: Opp. is empty */
  6214. +#define ARM_MC_OPPISEMPTYIRQPEND 0x00000040 /* mailbox irq pending */
  6215. +/* Bit 7 is unused */
  6216. +#define ARM_MC_ERRNOOWN 0x00000100 /* error : none owner read from mailbox */
  6217. +#define ARM_MC_ERROVERFLW 0x00000200 /* error : write to fill mailbox */
  6218. +#define ARM_MC_ERRUNDRFLW 0x00000400 /* error : read from empty mailbox */
  6219. +
  6220. +/* Semaphore clear/debug register (...0xE0) */
  6221. +#define ARM_SD_OWN0 0x00000003 /* Owner of sem 0 */
  6222. +#define ARM_SD_OWN1 0x0000000C /* Owner of sem 1 */
  6223. +#define ARM_SD_OWN2 0x00000030 /* Owner of sem 2 */
  6224. +#define ARM_SD_OWN3 0x000000C0 /* Owner of sem 3 */
  6225. +#define ARM_SD_OWN4 0x00000300 /* Owner of sem 4 */
  6226. +#define ARM_SD_OWN5 0x00000C00 /* Owner of sem 5 */
  6227. +#define ARM_SD_OWN6 0x00003000 /* Owner of sem 6 */
  6228. +#define ARM_SD_OWN7 0x0000C000 /* Owner of sem 7 */
  6229. +#define ARM_SD_SEM0 0x00010000 /* Status of sem 0 */
  6230. +#define ARM_SD_SEM1 0x00020000 /* Status of sem 1 */
  6231. +#define ARM_SD_SEM2 0x00040000 /* Status of sem 2 */
  6232. +#define ARM_SD_SEM3 0x00080000 /* Status of sem 3 */
  6233. +#define ARM_SD_SEM4 0x00100000 /* Status of sem 4 */
  6234. +#define ARM_SD_SEM5 0x00200000 /* Status of sem 5 */
  6235. +#define ARM_SD_SEM6 0x00400000 /* Status of sem 6 */
  6236. +#define ARM_SD_SEM7 0x00800000 /* Status of sem 7 */
  6237. +
  6238. +/* Doorbells clear/debug register (...0xE4) */
  6239. +#define ARM_BD_OWN0 0x00000003 /* Owner of doorbell 0 */
  6240. +#define ARM_BD_OWN1 0x0000000C /* Owner of doorbell 1 */
  6241. +#define ARM_BD_OWN2 0x00000030 /* Owner of doorbell 2 */
  6242. +#define ARM_BD_OWN3 0x000000C0 /* Owner of doorbell 3 */
  6243. +#define ARM_BD_BELL0 0x00000100 /* Status of doorbell 0 */
  6244. +#define ARM_BD_BELL1 0x00000200 /* Status of doorbell 1 */
  6245. +#define ARM_BD_BELL2 0x00000400 /* Status of doorbell 2 */
  6246. +#define ARM_BD_BELL3 0x00000800 /* Status of doorbell 3 */
  6247. +
  6248. +/* MY IRQS register (...0xF8) */
  6249. +#define ARM_MYIRQ_BELL 0x00000001 /* This owner has a doorbell IRQ */
  6250. +#define ARM_MYIRQ_MAIL 0x00000002 /* This owner has a mailbox IRQ */
  6251. +
  6252. +/* ALL IRQS register (...0xF8) */
  6253. +#define ARM_AIS_BELL0 0x00000001 /* Doorbell 0 IRQ pending */
  6254. +#define ARM_AIS_BELL1 0x00000002 /* Doorbell 1 IRQ pending */
  6255. +#define ARM_AIS_BELL2 0x00000004 /* Doorbell 2 IRQ pending */
  6256. +#define ARM_AIS_BELL3 0x00000008 /* Doorbell 3 IRQ pending */
  6257. +#define ARM_AIS0_HAVEDATA 0x00000010 /* MAIL 0 has data IRQ pending */
  6258. +#define ARM_AIS0_HAVESPAC 0x00000020 /* MAIL 0 has space IRQ pending */
  6259. +#define ARM_AIS0_OPPEMPTY 0x00000040 /* MAIL 0 opposite is empty IRQ */
  6260. +#define ARM_AIS1_HAVEDATA 0x00000080 /* MAIL 1 has data IRQ pending */
  6261. +#define ARM_AIS1_HAVESPAC 0x00000100 /* MAIL 1 has space IRQ pending */
  6262. +#define ARM_AIS1_OPPEMPTY 0x00000200 /* MAIL 1 opposite is empty IRQ */
  6263. +/* Note that bell-0, bell-1 and MAIL0 IRQ go only to the ARM */
  6264. +/* Whilst that bell-2, bell-3 and MAIL1 IRQ go only to the VC */
  6265. +/* */
  6266. +/* ARM JTAG BASH */
  6267. +/* */
  6268. +#define AJB_BASE 0x7e2000c0
  6269. +
  6270. +#define AJBCONF HW_REGISTER_RW(AJB_BASE+0x00)
  6271. +#define AJB_BITS0 0x000000
  6272. +#define AJB_BITS4 0x000004
  6273. +#define AJB_BITS8 0x000008
  6274. +#define AJB_BITS12 0x00000C
  6275. +#define AJB_BITS16 0x000010
  6276. +#define AJB_BITS20 0x000014
  6277. +#define AJB_BITS24 0x000018
  6278. +#define AJB_BITS28 0x00001C
  6279. +#define AJB_BITS32 0x000020
  6280. +#define AJB_BITS34 0x000022
  6281. +#define AJB_OUT_MS 0x000040
  6282. +#define AJB_OUT_LS 0x000000
  6283. +#define AJB_INV_CLK 0x000080
  6284. +#define AJB_D0_RISE 0x000100
  6285. +#define AJB_D0_FALL 0x000000
  6286. +#define AJB_D1_RISE 0x000200
  6287. +#define AJB_D1_FALL 0x000000
  6288. +#define AJB_IN_RISE 0x000400
  6289. +#define AJB_IN_FALL 0x000000
  6290. +#define AJB_ENABLE 0x000800
  6291. +#define AJB_HOLD0 0x000000
  6292. +#define AJB_HOLD1 0x001000
  6293. +#define AJB_HOLD2 0x002000
  6294. +#define AJB_HOLD3 0x003000
  6295. +#define AJB_RESETN 0x004000
  6296. +#define AJB_CLKSHFT 16
  6297. +#define AJB_BUSY 0x80000000
  6298. +#define AJBTMS HW_REGISTER_RW(AJB_BASE+0x04)
  6299. +#define AJBTDI HW_REGISTER_RW(AJB_BASE+0x08)
  6300. +#define AJBTDO HW_REGISTER_RW(AJB_BASE+0x0c)
  6301. +
  6302. +#define ARM_LOCAL_BASE 0x40000000
  6303. +#define ARM_LOCAL_CONTROL HW_REGISTER_RW(ARM_LOCAL_BASE+0x000)
  6304. +#define ARM_LOCAL_PRESCALER HW_REGISTER_RW(ARM_LOCAL_BASE+0x008)
  6305. +#define ARM_LOCAL_GPU_INT_ROUTING HW_REGISTER_RW(ARM_LOCAL_BASE+0x00C)
  6306. +#define ARM_LOCAL_PM_ROUTING_SET HW_REGISTER_RW(ARM_LOCAL_BASE+0x010)
  6307. +#define ARM_LOCAL_PM_ROUTING_CLR HW_REGISTER_RW(ARM_LOCAL_BASE+0x014)
  6308. +#define ARM_LOCAL_TIMER_LS HW_REGISTER_RW(ARM_LOCAL_BASE+0x01C)
  6309. +#define ARM_LOCAL_TIMER_MS HW_REGISTER_RW(ARM_LOCAL_BASE+0x020)
  6310. +#define ARM_LOCAL_INT_ROUTING HW_REGISTER_RW(ARM_LOCAL_BASE+0x024)
  6311. +#define ARM_LOCAL_AXI_COUNT HW_REGISTER_RW(ARM_LOCAL_BASE+0x02C)
  6312. +#define ARM_LOCAL_AXI_IRQ HW_REGISTER_RW(ARM_LOCAL_BASE+0x030)
  6313. +#define ARM_LOCAL_TIMER_CONTROL HW_REGISTER_RW(ARM_LOCAL_BASE+0x034)
  6314. +#define ARM_LOCAL_TIMER_WRITE HW_REGISTER_RW(ARM_LOCAL_BASE+0x038)
  6315. +
  6316. +#define ARM_LOCAL_TIMER_INT_CONTROL0 HW_REGISTER_RW(ARM_LOCAL_BASE+0x040)
  6317. +#define ARM_LOCAL_TIMER_INT_CONTROL1 HW_REGISTER_RW(ARM_LOCAL_BASE+0x044)
  6318. +#define ARM_LOCAL_TIMER_INT_CONTROL2 HW_REGISTER_RW(ARM_LOCAL_BASE+0x048)
  6319. +#define ARM_LOCAL_TIMER_INT_CONTROL3 HW_REGISTER_RW(ARM_LOCAL_BASE+0x04C)
  6320. +
  6321. +#define ARM_LOCAL_MAILBOX_INT_CONTROL0 HW_REGISTER_RW(ARM_LOCAL_BASE+0x050)
  6322. +#define ARM_LOCAL_MAILBOX_INT_CONTROL1 HW_REGISTER_RW(ARM_LOCAL_BASE+0x054)
  6323. +#define ARM_LOCAL_MAILBOX_INT_CONTROL2 HW_REGISTER_RW(ARM_LOCAL_BASE+0x058)
  6324. +#define ARM_LOCAL_MAILBOX_INT_CONTROL3 HW_REGISTER_RW(ARM_LOCAL_BASE+0x05C)
  6325. +
  6326. +#define ARM_LOCAL_IRQ_PENDING0 HW_REGISTER_RW(ARM_LOCAL_BASE+0x060)
  6327. +#define ARM_LOCAL_IRQ_PENDING1 HW_REGISTER_RW(ARM_LOCAL_BASE+0x064)
  6328. +#define ARM_LOCAL_IRQ_PENDING2 HW_REGISTER_RW(ARM_LOCAL_BASE+0x068)
  6329. +#define ARM_LOCAL_IRQ_PENDING3 HW_REGISTER_RW(ARM_LOCAL_BASE+0x06C)
  6330. +
  6331. +#define ARM_LOCAL_FIQ_PENDING0 HW_REGISTER_RW(ARM_LOCAL_BASE+0x070)
  6332. +#define ARM_LOCAL_FIQ_PENDING1 HW_REGISTER_RW(ARM_LOCAL_BASE+0x074)
  6333. +#define ARM_LOCAL_FIQ_PENDING2 HW_REGISTER_RW(ARM_LOCAL_BASE+0x078)
  6334. +#define ARM_LOCAL_FIQ_PENDING3 HW_REGISTER_RW(ARM_LOCAL_BASE+0x07C)
  6335. +
  6336. +#define ARM_LOCAL_MAILBOX0_SET0 HW_REGISTER_RW(ARM_LOCAL_BASE+0x080)
  6337. +#define ARM_LOCAL_MAILBOX1_SET0 HW_REGISTER_RW(ARM_LOCAL_BASE+0x084)
  6338. +#define ARM_LOCAL_MAILBOX2_SET0 HW_REGISTER_RW(ARM_LOCAL_BASE+0x088)
  6339. +#define ARM_LOCAL_MAILBOX3_SET0 HW_REGISTER_RW(ARM_LOCAL_BASE+0x08C)
  6340. +
  6341. +#define ARM_LOCAL_MAILBOX0_SET1 HW_REGISTER_RW(ARM_LOCAL_BASE+0x090)
  6342. +#define ARM_LOCAL_MAILBOX1_SET1 HW_REGISTER_RW(ARM_LOCAL_BASE+0x094)
  6343. +#define ARM_LOCAL_MAILBOX2_SET1 HW_REGISTER_RW(ARM_LOCAL_BASE+0x098)
  6344. +#define ARM_LOCAL_MAILBOX3_SET1 HW_REGISTER_RW(ARM_LOCAL_BASE+0x09C)
  6345. +
  6346. +#define ARM_LOCAL_MAILBOX0_SET2 HW_REGISTER_RW(ARM_LOCAL_BASE+0x0A0)
  6347. +#define ARM_LOCAL_MAILBOX1_SET2 HW_REGISTER_RW(ARM_LOCAL_BASE+0x0A4)
  6348. +#define ARM_LOCAL_MAILBOX2_SET2 HW_REGISTER_RW(ARM_LOCAL_BASE+0x0A8)
  6349. +#define ARM_LOCAL_MAILBOX3_SET2 HW_REGISTER_RW(ARM_LOCAL_BASE+0x0AC)
  6350. +
  6351. +#define ARM_LOCAL_MAILBOX0_SET3 HW_REGISTER_RW(ARM_LOCAL_BASE+0x0B0)
  6352. +#define ARM_LOCAL_MAILBOX1_SET3 HW_REGISTER_RW(ARM_LOCAL_BASE+0x0B4)
  6353. +#define ARM_LOCAL_MAILBOX2_SET3 HW_REGISTER_RW(ARM_LOCAL_BASE+0x0B8)
  6354. +#define ARM_LOCAL_MAILBOX3_SET3 HW_REGISTER_RW(ARM_LOCAL_BASE+0x0BC)
  6355. +
  6356. +#define ARM_LOCAL_MAILBOX0_CLR0 HW_REGISTER_RW(ARM_LOCAL_BASE+0x0C0)
  6357. +#define ARM_LOCAL_MAILBOX1_CLR0 HW_REGISTER_RW(ARM_LOCAL_BASE+0x0C4)
  6358. +#define ARM_LOCAL_MAILBOX2_CLR0 HW_REGISTER_RW(ARM_LOCAL_BASE+0x0C8)
  6359. +#define ARM_LOCAL_MAILBOX3_CLR0 HW_REGISTER_RW(ARM_LOCAL_BASE+0x0CC)
  6360. +
  6361. +#define ARM_LOCAL_MAILBOX0_CLR1 HW_REGISTER_RW(ARM_LOCAL_BASE+0x0D0)
  6362. +#define ARM_LOCAL_MAILBOX1_CLR1 HW_REGISTER_RW(ARM_LOCAL_BASE+0x0D4)
  6363. +#define ARM_LOCAL_MAILBOX2_CLR1 HW_REGISTER_RW(ARM_LOCAL_BASE+0x0D8)
  6364. +#define ARM_LOCAL_MAILBOX3_CLR1 HW_REGISTER_RW(ARM_LOCAL_BASE+0x0DC)
  6365. +
  6366. +#define ARM_LOCAL_MAILBOX0_CLR2 HW_REGISTER_RW(ARM_LOCAL_BASE+0x0E0)
  6367. +#define ARM_LOCAL_MAILBOX1_CLR2 HW_REGISTER_RW(ARM_LOCAL_BASE+0x0E4)
  6368. +#define ARM_LOCAL_MAILBOX2_CLR2 HW_REGISTER_RW(ARM_LOCAL_BASE+0x0E8)
  6369. +#define ARM_LOCAL_MAILBOX3_CLR2 HW_REGISTER_RW(ARM_LOCAL_BASE+0x0EC)
  6370. +
  6371. +#define ARM_LOCAL_MAILBOX0_CLR3 HW_REGISTER_RW(ARM_LOCAL_BASE+0x0F0)
  6372. +#define ARM_LOCAL_MAILBOX1_CLR3 HW_REGISTER_RW(ARM_LOCAL_BASE+0x0F4)
  6373. +#define ARM_LOCAL_MAILBOX2_CLR3 HW_REGISTER_RW(ARM_LOCAL_BASE+0x0F8)
  6374. +#define ARM_LOCAL_MAILBOX3_CLR3 HW_REGISTER_RW(ARM_LOCAL_BASE+0x0FC)
  6375. +
  6376. +#endif
  6377. --- /dev/null
  6378. +++ b/arch/arm/mach-bcm2709/include/mach/arm_power.h
  6379. @@ -0,0 +1,62 @@
  6380. +/*
  6381. + * linux/arch/arm/mach-bcm2708/include/mach/arm_power.h
  6382. + *
  6383. + * Copyright (C) 2010 Broadcom
  6384. + *
  6385. + * This program is free software; you can redistribute it and/or modify
  6386. + * it under the terms of the GNU General Public License as published by
  6387. + * the Free Software Foundation; either version 2 of the License, or
  6388. + * (at your option) any later version.
  6389. + *
  6390. + * This program is distributed in the hope that it will be useful,
  6391. + * but WITHOUT ANY WARRANTY; without even the implied warranty of
  6392. + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  6393. + * GNU General Public License for more details.
  6394. + *
  6395. + * You should have received a copy of the GNU General Public License
  6396. + * along with this program; if not, write to the Free Software
  6397. + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
  6398. + */
  6399. +
  6400. +#ifndef _ARM_POWER_H
  6401. +#define _ARM_POWER_H
  6402. +
  6403. +/* Use meaningful names on each side */
  6404. +#ifdef __VIDEOCORE__
  6405. +#define PREFIX(x) ARM_##x
  6406. +#else
  6407. +#define PREFIX(x) BCM_##x
  6408. +#endif
  6409. +
  6410. +enum {
  6411. + PREFIX(POWER_SDCARD_BIT),
  6412. + PREFIX(POWER_UART_BIT),
  6413. + PREFIX(POWER_MINIUART_BIT),
  6414. + PREFIX(POWER_USB_BIT),
  6415. + PREFIX(POWER_I2C0_BIT),
  6416. + PREFIX(POWER_I2C1_BIT),
  6417. + PREFIX(POWER_I2C2_BIT),
  6418. + PREFIX(POWER_SPI_BIT),
  6419. + PREFIX(POWER_CCP2TX_BIT),
  6420. + PREFIX(POWER_DSI_BIT),
  6421. +
  6422. + PREFIX(POWER_MAX)
  6423. +};
  6424. +
  6425. +enum {
  6426. + PREFIX(POWER_SDCARD) = (1 << PREFIX(POWER_SDCARD_BIT)),
  6427. + PREFIX(POWER_UART) = (1 << PREFIX(POWER_UART_BIT)),
  6428. + PREFIX(POWER_MINIUART) = (1 << PREFIX(POWER_MINIUART_BIT)),
  6429. + PREFIX(POWER_USB) = (1 << PREFIX(POWER_USB_BIT)),
  6430. + PREFIX(POWER_I2C0) = (1 << PREFIX(POWER_I2C0_BIT)),
  6431. + PREFIX(POWER_I2C1_MASK) = (1 << PREFIX(POWER_I2C1_BIT)),
  6432. + PREFIX(POWER_I2C2_MASK) = (1 << PREFIX(POWER_I2C2_BIT)),
  6433. + PREFIX(POWER_SPI_MASK) = (1 << PREFIX(POWER_SPI_BIT)),
  6434. + PREFIX(POWER_CCP2TX_MASK) = (1 << PREFIX(POWER_CCP2TX_BIT)),
  6435. + PREFIX(POWER_DSI) = (1 << PREFIX(POWER_DSI_BIT)),
  6436. +
  6437. + PREFIX(POWER_MASK) = (1 << PREFIX(POWER_MAX)) - 1,
  6438. + PREFIX(POWER_NONE) = 0
  6439. +};
  6440. +
  6441. +#endif
  6442. --- /dev/null
  6443. +++ b/arch/arm/mach-bcm2709/include/mach/barriers.h
  6444. @@ -0,0 +1,3 @@
  6445. +#define mb() dsb()
  6446. +#define rmb() dsb()
  6447. +#define wmb() mb()
  6448. --- /dev/null
  6449. +++ b/arch/arm/mach-bcm2709/include/mach/clkdev.h
  6450. @@ -0,0 +1,7 @@
  6451. +#ifndef __ASM_MACH_CLKDEV_H
  6452. +#define __ASM_MACH_CLKDEV_H
  6453. +
  6454. +#define __clk_get(clk) ({ 1; })
  6455. +#define __clk_put(clk) do { } while (0)
  6456. +
  6457. +#endif
  6458. --- /dev/null
  6459. +++ b/arch/arm/mach-bcm2709/include/mach/debug-macro.S
  6460. @@ -0,0 +1,22 @@
  6461. +/* arch/arm/mach-bcm2708/include/mach/debug-macro.S
  6462. + *
  6463. + * Debugging macro include header
  6464. + *
  6465. + * Copyright (C) 2010 Broadcom
  6466. + * Copyright (C) 1994-1999 Russell King
  6467. + * Moved from linux/arch/arm/kernel/debug.S by Ben Dooks
  6468. + *
  6469. + * This program is free software; you can redistribute it and/or modify
  6470. + * it under the terms of the GNU General Public License version 2 as
  6471. + * published by the Free Software Foundation.
  6472. + *
  6473. +*/
  6474. +
  6475. +#include <mach/platform.h>
  6476. +
  6477. + .macro addruart, rp, rv, tmp
  6478. + ldr \rp, =UART0_BASE
  6479. + ldr \rv, =IO_ADDRESS(UART0_BASE)
  6480. + .endm
  6481. +
  6482. +#include <debug/pl01x.S>
  6483. --- /dev/null
  6484. +++ b/arch/arm/mach-bcm2709/include/mach/dma.h
  6485. @@ -0,0 +1,94 @@
  6486. +/*
  6487. + * linux/arch/arm/mach-bcm2708/include/mach/dma.h
  6488. + *
  6489. + * Copyright (C) 2010 Broadcom
  6490. + *
  6491. + * This program is free software; you can redistribute it and/or modify
  6492. + * it under the terms of the GNU General Public License version 2 as
  6493. + * published by the Free Software Foundation.
  6494. + */
  6495. +
  6496. +
  6497. +#ifndef _MACH_BCM2708_DMA_H
  6498. +#define _MACH_BCM2708_DMA_H
  6499. +
  6500. +#define BCM_DMAMAN_DRIVER_NAME "bcm2708_dma"
  6501. +
  6502. +/* DMA CS Control and Status bits */
  6503. +#define BCM2708_DMA_ACTIVE (1 << 0)
  6504. +#define BCM2708_DMA_INT (1 << 2)
  6505. +#define BCM2708_DMA_ISPAUSED (1 << 4) /* Pause requested or not active */
  6506. +#define BCM2708_DMA_ISHELD (1 << 5) /* Is held by DREQ flow control */
  6507. +#define BCM2708_DMA_ERR (1 << 8)
  6508. +#define BCM2708_DMA_ABORT (1 << 30) /* stop current CB, go to next, WO */
  6509. +#define BCM2708_DMA_RESET (1 << 31) /* WO, self clearing */
  6510. +
  6511. +/* DMA control block "info" field bits */
  6512. +#define BCM2708_DMA_INT_EN (1 << 0)
  6513. +#define BCM2708_DMA_TDMODE (1 << 1)
  6514. +#define BCM2708_DMA_WAIT_RESP (1 << 3)
  6515. +#define BCM2708_DMA_D_INC (1 << 4)
  6516. +#define BCM2708_DMA_D_WIDTH (1 << 5)
  6517. +#define BCM2708_DMA_D_DREQ (1 << 6)
  6518. +#define BCM2708_DMA_S_INC (1 << 8)
  6519. +#define BCM2708_DMA_S_WIDTH (1 << 9)
  6520. +#define BCM2708_DMA_S_DREQ (1 << 10)
  6521. +
  6522. +#define BCM2708_DMA_BURST(x) (((x)&0xf) << 12)
  6523. +#define BCM2708_DMA_PER_MAP(x) ((x) << 16)
  6524. +#define BCM2708_DMA_WAITS(x) (((x)&0x1f) << 21)
  6525. +
  6526. +#define BCM2708_DMA_DREQ_EMMC 11
  6527. +#define BCM2708_DMA_DREQ_SDHOST 13
  6528. +
  6529. +#define BCM2708_DMA_CS 0x00 /* Control and Status */
  6530. +#define BCM2708_DMA_ADDR 0x04
  6531. +/* the current control block appears in the following registers - read only */
  6532. +#define BCM2708_DMA_INFO 0x08
  6533. +#define BCM2708_DMA_SOURCE_AD 0x0c
  6534. +#define BCM2708_DMA_DEST_AD 0x10
  6535. +#define BCM2708_DMA_NEXTCB 0x1C
  6536. +#define BCM2708_DMA_DEBUG 0x20
  6537. +
  6538. +#define BCM2708_DMA4_CS (BCM2708_DMA_CHAN(4)+BCM2708_DMA_CS)
  6539. +#define BCM2708_DMA4_ADDR (BCM2708_DMA_CHAN(4)+BCM2708_DMA_ADDR)
  6540. +
  6541. +#define BCM2708_DMA_TDMODE_LEN(w, h) ((h) << 16 | (w))
  6542. +
  6543. +struct bcm2708_dma_cb {
  6544. + unsigned long info;
  6545. + unsigned long src;
  6546. + unsigned long dst;
  6547. + unsigned long length;
  6548. + unsigned long stride;
  6549. + unsigned long next;
  6550. + unsigned long pad[2];
  6551. +};
  6552. +struct scatterlist;
  6553. +
  6554. +extern int bcm_sg_suitable_for_dma(struct scatterlist *sg_ptr, int sg_len);
  6555. +extern void bcm_dma_start(void __iomem *dma_chan_base,
  6556. + dma_addr_t control_block);
  6557. +extern void bcm_dma_wait_idle(void __iomem *dma_chan_base);
  6558. +extern bool bcm_dma_is_busy(void __iomem *dma_chan_base);
  6559. +extern int /*rc*/ bcm_dma_abort(void __iomem *dma_chan_base);
  6560. +
  6561. +/* When listing features we can ask for when allocating DMA channels give
  6562. + those with higher priority smaller ordinal numbers */
  6563. +#define BCM_DMA_FEATURE_FAST_ORD 0
  6564. +#define BCM_DMA_FEATURE_BULK_ORD 1
  6565. +#define BCM_DMA_FEATURE_NORMAL_ORD 2
  6566. +#define BCM_DMA_FEATURE_LITE_ORD 3
  6567. +#define BCM_DMA_FEATURE_FAST (1<<BCM_DMA_FEATURE_FAST_ORD)
  6568. +#define BCM_DMA_FEATURE_BULK (1<<BCM_DMA_FEATURE_BULK_ORD)
  6569. +#define BCM_DMA_FEATURE_NORMAL (1<<BCM_DMA_FEATURE_NORMAL_ORD)
  6570. +#define BCM_DMA_FEATURE_LITE (1<<BCM_DMA_FEATURE_LITE_ORD)
  6571. +#define BCM_DMA_FEATURE_COUNT 4
  6572. +
  6573. +/* return channel no or -ve error */
  6574. +extern int bcm_dma_chan_alloc(unsigned preferred_feature_set,
  6575. + void __iomem **out_dma_base, int *out_dma_irq);
  6576. +extern int bcm_dma_chan_free(int channel);
  6577. +
  6578. +
  6579. +#endif /* _MACH_BCM2708_DMA_H */
  6580. --- /dev/null
  6581. +++ b/arch/arm/mach-bcm2709/include/mach/entry-macro.S
  6582. @@ -0,0 +1,123 @@
  6583. +/*
  6584. + * arch/arm/mach-bcm2708/include/mach/entry-macro.S
  6585. + *
  6586. + * Low-level IRQ helper macros for BCM2708 platforms
  6587. + *
  6588. + * Copyright (C) 2010 Broadcom
  6589. + *
  6590. + * This program is free software; you can redistribute it and/or modify
  6591. + * it under the terms of the GNU General Public License as published by
  6592. + * the Free Software Foundation; either version 2 of the License, or
  6593. + * (at your option) any later version.
  6594. + *
  6595. + * This program is distributed in the hope that it will be useful,
  6596. + * but WITHOUT ANY WARRANTY; without even the implied warranty of
  6597. + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  6598. + * GNU General Public License for more details.
  6599. + *
  6600. + * You should have received a copy of the GNU General Public License
  6601. + * along with this program; if not, write to the Free Software
  6602. + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
  6603. + */
  6604. +#include <mach/hardware.h>
  6605. +#include <mach/irqs.h>
  6606. +
  6607. + .macro disable_fiq
  6608. + .endm
  6609. +
  6610. + .macro get_irqnr_preamble, base, tmp
  6611. + ldr \base, =IO_ADDRESS(ARMCTRL_IC_BASE)
  6612. + .endm
  6613. +
  6614. + .macro arch_ret_to_user, tmp1, tmp2
  6615. + .endm
  6616. +
  6617. + .macro get_irqnr_and_base, irqnr, irqstat, base, tmp
  6618. + /* get core number */
  6619. + mrc p15, 0, \tmp, c0, c0, 5
  6620. + ubfx \tmp, \tmp, #0, #2
  6621. +
  6622. + /* get core's local interrupt controller */
  6623. + ldr \irqstat, = __io_address(ARM_LOCAL_IRQ_PENDING0) @ local interrupt source
  6624. + add \irqstat, \irqstat, \tmp, lsl #2
  6625. + ldr \tmp, [\irqstat]
  6626. + /* ignore gpu interrupt */
  6627. + bic \tmp, #0x100
  6628. + /* ignore mailbox interrupts */
  6629. + bics \tmp, #0xf0
  6630. + beq 1005f
  6631. +
  6632. + @ For non-zero x, LSB(x) = 31 - CLZ(x^(x-1))
  6633. + @ N.B. CLZ is an ARM5 instruction.
  6634. + mov \irqnr, #(ARM_IRQ_LOCAL_BASE + 31)
  6635. + sub \irqstat, \tmp, #1
  6636. + eor \irqstat, \irqstat, \tmp
  6637. + clz \tmp, \irqstat
  6638. + sub \irqnr, \tmp
  6639. + b 1020f
  6640. +1005:
  6641. + /* get core number */
  6642. + mrc p15, 0, \tmp, c0, c0, 5
  6643. + ubfx \tmp, \tmp, #0, #2
  6644. +
  6645. + cmp \tmp, #1
  6646. + beq 1020f
  6647. + cmp \tmp, #2
  6648. + beq 1020f
  6649. + cmp \tmp, #3
  6650. + beq 1020f
  6651. +
  6652. + /* get masked status */
  6653. + ldr \irqstat, [\base, #(ARM_IRQ_PEND0 - ARMCTRL_IC_BASE)]
  6654. + mov \irqnr, #(ARM_IRQ0_BASE + 31)
  6655. + and \tmp, \irqstat, #0x300 @ save bits 8 and 9
  6656. + /* clear bits 8 and 9, and test */
  6657. + bics \irqstat, \irqstat, #0x300
  6658. + bne 1010f
  6659. +
  6660. + tst \tmp, #0x100
  6661. + ldrne \irqstat, [\base, #(ARM_IRQ_PEND1 - ARMCTRL_IC_BASE)]
  6662. + movne \irqnr, #(ARM_IRQ1_BASE + 31)
  6663. + @ Mask out the interrupts also present in PEND0 - see SW-5809
  6664. + bicne \irqstat, #((1<<7) | (1<<9) | (1<<10))
  6665. + bicne \irqstat, #((1<<18) | (1<<19))
  6666. + bne 1010f
  6667. +
  6668. + tst \tmp, #0x200
  6669. + ldrne \irqstat, [\base, #(ARM_IRQ_PEND2 - ARMCTRL_IC_BASE)]
  6670. + movne \irqnr, #(ARM_IRQ2_BASE + 31)
  6671. + @ Mask out the interrupts also present in PEND0 - see SW-5809
  6672. + bicne \irqstat, #((1<<21) | (1<<22) | (1<<23) | (1<<24) | (1<<25))
  6673. + bicne \irqstat, #((1<<30))
  6674. + beq 1020f
  6675. +
  6676. +1010:
  6677. + @ For non-zero x, LSB(x) = 31 - CLZ(x^(x-1))
  6678. + @ N.B. CLZ is an ARM5 instruction.
  6679. + sub \tmp, \irqstat, #1
  6680. + eor \irqstat, \irqstat, \tmp
  6681. + clz \tmp, \irqstat
  6682. + sub \irqnr, \tmp
  6683. +
  6684. +1020: @ EQ will be set if no irqs pending
  6685. +
  6686. + .endm
  6687. +
  6688. + .macro test_for_ipi, irqnr, irqstat, base, tmp
  6689. + /* get core number */
  6690. + mrc p15, 0, \tmp, c0, c0, 5
  6691. + ubfx \tmp, \tmp, #0, #2
  6692. + /* get core's mailbox interrupt control */
  6693. + ldr \irqstat, = __io_address(ARM_LOCAL_MAILBOX0_CLR0) @ mbox_clr
  6694. + add \irqstat, \irqstat, \tmp, lsl #4
  6695. + ldr \tmp, [\irqstat]
  6696. + cmp \tmp, #0
  6697. + beq 1030f
  6698. + clz \tmp, \tmp
  6699. + rsb \irqnr, \tmp, #31
  6700. + mov \tmp, #1
  6701. + lsl \tmp, \irqnr
  6702. + str \tmp, [\irqstat] @ clear interrupt source
  6703. + dsb
  6704. +1030: @ EQ will be set if no irqs pending
  6705. + .endm
  6706. --- /dev/null
  6707. +++ b/arch/arm/mach-bcm2709/include/mach/frc.h
  6708. @@ -0,0 +1,38 @@
  6709. +/*
  6710. + * arch/arm/mach-bcm2708/include/mach/timex.h
  6711. + *
  6712. + * BCM2708 free running counter (timer)
  6713. + *
  6714. + * Copyright (C) 2010 Broadcom
  6715. + *
  6716. + * This program is free software; you can redistribute it and/or modify
  6717. + * it under the terms of the GNU General Public License as published by
  6718. + * the Free Software Foundation; either version 2 of the License, or
  6719. + * (at your option) any later version.
  6720. + *
  6721. + * This program is distributed in the hope that it will be useful,
  6722. + * but WITHOUT ANY WARRANTY; without even the implied warranty of
  6723. + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  6724. + * GNU General Public License for more details.
  6725. + *
  6726. + * You should have received a copy of the GNU General Public License
  6727. + * along with this program; if not, write to the Free Software
  6728. + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
  6729. + */
  6730. +
  6731. +#ifndef _MACH_FRC_H
  6732. +#define _MACH_FRC_H
  6733. +
  6734. +#define FRC_TICK_RATE (1000000)
  6735. +
  6736. +/*! Free running counter incrementing at the CLOCK_TICK_RATE
  6737. + (slightly faster than frc_clock_ticks63()
  6738. + */
  6739. +extern unsigned long frc_clock_ticks32(void);
  6740. +
  6741. +/*! Free running counter incrementing at the CLOCK_TICK_RATE
  6742. + * Note - top bit should be ignored (see cnt32_to_63)
  6743. + */
  6744. +extern unsigned long long frc_clock_ticks63(void);
  6745. +
  6746. +#endif
  6747. --- /dev/null
  6748. +++ b/arch/arm/mach-bcm2709/include/mach/gpio.h
  6749. @@ -0,0 +1,17 @@
  6750. +/*
  6751. + * arch/arm/mach-bcm2708/include/mach/gpio.h
  6752. + *
  6753. + * This file is licensed under the terms of the GNU General Public
  6754. + * License version 2. This program is licensed "as is" without any
  6755. + * warranty of any kind, whether express or implied.
  6756. + */
  6757. +
  6758. +#ifndef __ASM_ARCH_GPIO_H
  6759. +#define __ASM_ARCH_GPIO_H
  6760. +
  6761. +#define BCM2708_NR_GPIOS 54 // number of gpio lines
  6762. +
  6763. +#define gpio_to_irq(x) ((x) + GPIO_IRQ_START)
  6764. +#define irq_to_gpio(x) ((x) - GPIO_IRQ_START)
  6765. +
  6766. +#endif
  6767. --- /dev/null
  6768. +++ b/arch/arm/mach-bcm2709/include/mach/hardware.h
  6769. @@ -0,0 +1,28 @@
  6770. +/*
  6771. + * arch/arm/mach-bcm2708/include/mach/hardware.h
  6772. + *
  6773. + * This file contains the hardware definitions of the BCM2708 devices.
  6774. + *
  6775. + * Copyright (C) 2010 Broadcom
  6776. + *
  6777. + * This program is free software; you can redistribute it and/or modify
  6778. + * it under the terms of the GNU General Public License as published by
  6779. + * the Free Software Foundation; either version 2 of the License, or
  6780. + * (at your option) any later version.
  6781. + *
  6782. + * This program is distributed in the hope that it will be useful,
  6783. + * but WITHOUT ANY WARRANTY; without even the implied warranty of
  6784. + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  6785. + * GNU General Public License for more details.
  6786. + *
  6787. + * You should have received a copy of the GNU General Public License
  6788. + * along with this program; if not, write to the Free Software
  6789. + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
  6790. + */
  6791. +#ifndef __ASM_ARCH_HARDWARE_H
  6792. +#define __ASM_ARCH_HARDWARE_H
  6793. +
  6794. +#include <asm/sizes.h>
  6795. +#include <mach/platform.h>
  6796. +
  6797. +#endif
  6798. --- /dev/null
  6799. +++ b/arch/arm/mach-bcm2709/include/mach/io.h
  6800. @@ -0,0 +1,27 @@
  6801. +/*
  6802. + * arch/arm/mach-bcm2708/include/mach/io.h
  6803. + *
  6804. + * Copyright (C) 2003 ARM Limited
  6805. + *
  6806. + * This program is free software; you can redistribute it and/or modify
  6807. + * it under the terms of the GNU General Public License as published by
  6808. + * the Free Software Foundation; either version 2 of the License, or
  6809. + * (at your option) any later version.
  6810. + *
  6811. + * This program is distributed in the hope that it will be useful,
  6812. + * but WITHOUT ANY WARRANTY; without even the implied warranty of
  6813. + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  6814. + * GNU General Public License for more details.
  6815. + *
  6816. + * You should have received a copy of the GNU General Public License
  6817. + * along with this program; if not, write to the Free Software
  6818. + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
  6819. + */
  6820. +#ifndef __ASM_ARM_ARCH_IO_H
  6821. +#define __ASM_ARM_ARCH_IO_H
  6822. +
  6823. +#define IO_SPACE_LIMIT 0xffffffff
  6824. +
  6825. +#define __io(a) __typesafe_io(a)
  6826. +
  6827. +#endif
  6828. --- /dev/null
  6829. +++ b/arch/arm/mach-bcm2709/include/mach/irqs.h
  6830. @@ -0,0 +1,225 @@
  6831. +/*
  6832. + * arch/arm/mach-bcm2708/include/mach/irqs.h
  6833. + *
  6834. + * Copyright (C) 2010 Broadcom
  6835. + * Copyright (C) 2003 ARM Limited
  6836. + * Copyright (C) 2000 Deep Blue Solutions Ltd.
  6837. + *
  6838. + * This program is free software; you can redistribute it and/or modify
  6839. + * it under the terms of the GNU General Public License as published by
  6840. + * the Free Software Foundation; either version 2 of the License, or
  6841. + * (at your option) any later version.
  6842. + *
  6843. + * This program is distributed in the hope that it will be useful,
  6844. + * but WITHOUT ANY WARRANTY; without even the implied warranty of
  6845. + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  6846. + * GNU General Public License for more details.
  6847. + *
  6848. + * You should have received a copy of the GNU General Public License
  6849. + * along with this program; if not, write to the Free Software
  6850. + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
  6851. + */
  6852. +
  6853. +#ifndef _BCM2708_IRQS_H_
  6854. +#define _BCM2708_IRQS_H_
  6855. +
  6856. +#include <mach/platform.h>
  6857. +
  6858. +/*
  6859. + * IRQ interrupts definitions are the same as the INT definitions
  6860. + * held within platform.h
  6861. + */
  6862. +#define IRQ_ARMCTRL_START 0
  6863. +#define IRQ_TIMER0 (IRQ_ARMCTRL_START + INTERRUPT_TIMER0)
  6864. +#define IRQ_TIMER1 (IRQ_ARMCTRL_START + INTERRUPT_TIMER1)
  6865. +#define IRQ_TIMER2 (IRQ_ARMCTRL_START + INTERRUPT_TIMER2)
  6866. +#define IRQ_TIMER3 (IRQ_ARMCTRL_START + INTERRUPT_TIMER3)
  6867. +#define IRQ_CODEC0 (IRQ_ARMCTRL_START + INTERRUPT_CODEC0)
  6868. +#define IRQ_CODEC1 (IRQ_ARMCTRL_START + INTERRUPT_CODEC1)
  6869. +#define IRQ_CODEC2 (IRQ_ARMCTRL_START + INTERRUPT_CODEC2)
  6870. +#define IRQ_JPEG (IRQ_ARMCTRL_START + INTERRUPT_JPEG)
  6871. +#define IRQ_ISP (IRQ_ARMCTRL_START + INTERRUPT_ISP)
  6872. +#define IRQ_USB (IRQ_ARMCTRL_START + INTERRUPT_USB)
  6873. +#define IRQ_3D (IRQ_ARMCTRL_START + INTERRUPT_3D)
  6874. +#define IRQ_TRANSPOSER (IRQ_ARMCTRL_START + INTERRUPT_TRANSPOSER)
  6875. +#define IRQ_MULTICORESYNC0 (IRQ_ARMCTRL_START + INTERRUPT_MULTICORESYNC0)
  6876. +#define IRQ_MULTICORESYNC1 (IRQ_ARMCTRL_START + INTERRUPT_MULTICORESYNC1)
  6877. +#define IRQ_MULTICORESYNC2 (IRQ_ARMCTRL_START + INTERRUPT_MULTICORESYNC2)
  6878. +#define IRQ_MULTICORESYNC3 (IRQ_ARMCTRL_START + INTERRUPT_MULTICORESYNC3)
  6879. +#define IRQ_DMA0 (IRQ_ARMCTRL_START + INTERRUPT_DMA0)
  6880. +#define IRQ_DMA1 (IRQ_ARMCTRL_START + INTERRUPT_DMA1)
  6881. +#define IRQ_DMA2 (IRQ_ARMCTRL_START + INTERRUPT_DMA2)
  6882. +#define IRQ_DMA3 (IRQ_ARMCTRL_START + INTERRUPT_DMA3)
  6883. +#define IRQ_DMA4 (IRQ_ARMCTRL_START + INTERRUPT_DMA4)
  6884. +#define IRQ_DMA5 (IRQ_ARMCTRL_START + INTERRUPT_DMA5)
  6885. +#define IRQ_DMA6 (IRQ_ARMCTRL_START + INTERRUPT_DMA6)
  6886. +#define IRQ_DMA7 (IRQ_ARMCTRL_START + INTERRUPT_DMA7)
  6887. +#define IRQ_DMA8 (IRQ_ARMCTRL_START + INTERRUPT_DMA8)
  6888. +#define IRQ_DMA9 (IRQ_ARMCTRL_START + INTERRUPT_DMA9)
  6889. +#define IRQ_DMA10 (IRQ_ARMCTRL_START + INTERRUPT_DMA10)
  6890. +#define IRQ_DMA11 (IRQ_ARMCTRL_START + INTERRUPT_DMA11)
  6891. +#define IRQ_DMA12 (IRQ_ARMCTRL_START + INTERRUPT_DMA12)
  6892. +#define IRQ_AUX (IRQ_ARMCTRL_START + INTERRUPT_AUX)
  6893. +#define IRQ_ARM (IRQ_ARMCTRL_START + INTERRUPT_ARM)
  6894. +#define IRQ_VPUDMA (IRQ_ARMCTRL_START + INTERRUPT_VPUDMA)
  6895. +#define IRQ_HOSTPORT (IRQ_ARMCTRL_START + INTERRUPT_HOSTPORT)
  6896. +#define IRQ_VIDEOSCALER (IRQ_ARMCTRL_START + INTERRUPT_VIDEOSCALER)
  6897. +#define IRQ_CCP2TX (IRQ_ARMCTRL_START + INTERRUPT_CCP2TX)
  6898. +#define IRQ_SDC (IRQ_ARMCTRL_START + INTERRUPT_SDC)
  6899. +#define IRQ_DSI0 (IRQ_ARMCTRL_START + INTERRUPT_DSI0)
  6900. +#define IRQ_AVE (IRQ_ARMCTRL_START + INTERRUPT_AVE)
  6901. +#define IRQ_CAM0 (IRQ_ARMCTRL_START + INTERRUPT_CAM0)
  6902. +#define IRQ_CAM1 (IRQ_ARMCTRL_START + INTERRUPT_CAM1)
  6903. +#define IRQ_HDMI0 (IRQ_ARMCTRL_START + INTERRUPT_HDMI0)
  6904. +#define IRQ_HDMI1 (IRQ_ARMCTRL_START + INTERRUPT_HDMI1)
  6905. +#define IRQ_PIXELVALVE1 (IRQ_ARMCTRL_START + INTERRUPT_PIXELVALVE1)
  6906. +#define IRQ_I2CSPISLV (IRQ_ARMCTRL_START + INTERRUPT_I2CSPISLV)
  6907. +#define IRQ_DSI1 (IRQ_ARMCTRL_START + INTERRUPT_DSI1)
  6908. +#define IRQ_PWA0 (IRQ_ARMCTRL_START + INTERRUPT_PWA0)
  6909. +#define IRQ_PWA1 (IRQ_ARMCTRL_START + INTERRUPT_PWA1)
  6910. +#define IRQ_CPR (IRQ_ARMCTRL_START + INTERRUPT_CPR)
  6911. +#define IRQ_SMI (IRQ_ARMCTRL_START + INTERRUPT_SMI)
  6912. +#define IRQ_GPIO0 (IRQ_ARMCTRL_START + INTERRUPT_GPIO0)
  6913. +#define IRQ_GPIO1 (IRQ_ARMCTRL_START + INTERRUPT_GPIO1)
  6914. +#define IRQ_GPIO2 (IRQ_ARMCTRL_START + INTERRUPT_GPIO2)
  6915. +#define IRQ_GPIO3 (IRQ_ARMCTRL_START + INTERRUPT_GPIO3)
  6916. +#define IRQ_I2C (IRQ_ARMCTRL_START + INTERRUPT_I2C)
  6917. +#define IRQ_SPI (IRQ_ARMCTRL_START + INTERRUPT_SPI)
  6918. +#define IRQ_I2SPCM (IRQ_ARMCTRL_START + INTERRUPT_I2SPCM)
  6919. +#define IRQ_SDIO (IRQ_ARMCTRL_START + INTERRUPT_SDIO)
  6920. +#define IRQ_UART (IRQ_ARMCTRL_START + INTERRUPT_UART)
  6921. +#define IRQ_SLIMBUS (IRQ_ARMCTRL_START + INTERRUPT_SLIMBUS)
  6922. +#define IRQ_VEC (IRQ_ARMCTRL_START + INTERRUPT_VEC)
  6923. +#define IRQ_CPG (IRQ_ARMCTRL_START + INTERRUPT_CPG)
  6924. +#define IRQ_RNG (IRQ_ARMCTRL_START + INTERRUPT_RNG)
  6925. +#define IRQ_ARASANSDIO (IRQ_ARMCTRL_START + INTERRUPT_ARASANSDIO)
  6926. +#define IRQ_AVSPMON (IRQ_ARMCTRL_START + INTERRUPT_AVSPMON)
  6927. +
  6928. +#define IRQ_ARM_TIMER (IRQ_ARMCTRL_START + INTERRUPT_ARM_TIMER)
  6929. +#define IRQ_ARM_MAILBOX (IRQ_ARMCTRL_START + INTERRUPT_ARM_MAILBOX)
  6930. +#define IRQ_ARM_DOORBELL_0 (IRQ_ARMCTRL_START + INTERRUPT_ARM_DOORBELL_0)
  6931. +#define IRQ_ARM_DOORBELL_1 (IRQ_ARMCTRL_START + INTERRUPT_ARM_DOORBELL_1)
  6932. +#define IRQ_VPU0_HALTED (IRQ_ARMCTRL_START + INTERRUPT_VPU0_HALTED)
  6933. +#define IRQ_VPU1_HALTED (IRQ_ARMCTRL_START + INTERRUPT_VPU1_HALTED)
  6934. +#define IRQ_ILLEGAL_TYPE0 (IRQ_ARMCTRL_START + INTERRUPT_ILLEGAL_TYPE0)
  6935. +#define IRQ_ILLEGAL_TYPE1 (IRQ_ARMCTRL_START + INTERRUPT_ILLEGAL_TYPE1)
  6936. +#define IRQ_PENDING1 (IRQ_ARMCTRL_START + INTERRUPT_PENDING1)
  6937. +#define IRQ_PENDING2 (IRQ_ARMCTRL_START + INTERRUPT_PENDING2)
  6938. +
  6939. +#define IRQ_ARM_LOCAL_CNTPSIRQ (IRQ_ARMCTRL_START + INTERRUPT_ARM_LOCAL_CNTPSIRQ)
  6940. +#define IRQ_ARM_LOCAL_CNTPNSIRQ (IRQ_ARMCTRL_START + INTERRUPT_ARM_LOCAL_CNTPNSIRQ)
  6941. +#define IRQ_ARM_LOCAL_CNTHPIRQ (IRQ_ARMCTRL_START + INTERRUPT_ARM_LOCAL_CNTHPIRQ)
  6942. +#define IRQ_ARM_LOCAL_CNTVIRQ (IRQ_ARMCTRL_START + INTERRUPT_ARM_LOCAL_CNTVIRQ)
  6943. +#define IRQ_ARM_LOCAL_MAILBOX0 (IRQ_ARMCTRL_START + INTERRUPT_ARM_LOCAL_MAILBOX0)
  6944. +#define IRQ_ARM_LOCAL_MAILBOX1 (IRQ_ARMCTRL_START + INTERRUPT_ARM_LOCAL_MAILBOX1)
  6945. +#define IRQ_ARM_LOCAL_MAILBOX2 (IRQ_ARMCTRL_START + INTERRUPT_ARM_LOCAL_MAILBOX2)
  6946. +#define IRQ_ARM_LOCAL_MAILBOX3 (IRQ_ARMCTRL_START + INTERRUPT_ARM_LOCAL_MAILBOX3)
  6947. +#define IRQ_ARM_LOCAL_GPU_FAST (IRQ_ARMCTRL_START + INTERRUPT_ARM_LOCAL_GPU_FAST)
  6948. +#define IRQ_ARM_LOCAL_PMU_FAST (IRQ_ARMCTRL_START + INTERRUPT_ARM_LOCAL_PMU_FAST)
  6949. +#define IRQ_ARM_LOCAL_ZERO (IRQ_ARMCTRL_START + INTERRUPT_ARM_LOCAL_ZERO)
  6950. +#define IRQ_ARM_LOCAL_TIMER (IRQ_ARMCTRL_START + INTERRUPT_ARM_LOCAL_TIMER)
  6951. +
  6952. +#define FIQ_START HARD_IRQS
  6953. +
  6954. +/*
  6955. + * FIQ interrupts definitions are the same as the INT definitions.
  6956. + */
  6957. +#define FIQ_TIMER0 (FIQ_START+INTERRUPT_TIMER0)
  6958. +#define FIQ_TIMER1 (FIQ_START+INTERRUPT_TIMER1)
  6959. +#define FIQ_TIMER2 (FIQ_START+INTERRUPT_TIMER2)
  6960. +#define FIQ_TIMER3 (FIQ_START+INTERRUPT_TIMER3)
  6961. +#define FIQ_CODEC0 (FIQ_START+INTERRUPT_CODEC0)
  6962. +#define FIQ_CODEC1 (FIQ_START+INTERRUPT_CODEC1)
  6963. +#define FIQ_CODEC2 (FIQ_START+INTERRUPT_CODEC2)
  6964. +#define FIQ_JPEG (FIQ_START+INTERRUPT_JPEG)
  6965. +#define FIQ_ISP (FIQ_START+INTERRUPT_ISP)
  6966. +#define FIQ_USB (FIQ_START+INTERRUPT_USB)
  6967. +#define FIQ_3D (FIQ_START+INTERRUPT_3D)
  6968. +#define FIQ_TRANSPOSER (FIQ_START+INTERRUPT_TRANSPOSER)
  6969. +#define FIQ_MULTICORESYNC0 (FIQ_START+INTERRUPT_MULTICORESYNC0)
  6970. +#define FIQ_MULTICORESYNC1 (FIQ_START+INTERRUPT_MULTICORESYNC1)
  6971. +#define FIQ_MULTICORESYNC2 (FIQ_START+INTERRUPT_MULTICORESYNC2)
  6972. +#define FIQ_MULTICORESYNC3 (FIQ_START+INTERRUPT_MULTICORESYNC3)
  6973. +#define FIQ_DMA0 (FIQ_START+INTERRUPT_DMA0)
  6974. +#define FIQ_DMA1 (FIQ_START+INTERRUPT_DMA1)
  6975. +#define FIQ_DMA2 (FIQ_START+INTERRUPT_DMA2)
  6976. +#define FIQ_DMA3 (FIQ_START+INTERRUPT_DMA3)
  6977. +#define FIQ_DMA4 (FIQ_START+INTERRUPT_DMA4)
  6978. +#define FIQ_DMA5 (FIQ_START+INTERRUPT_DMA5)
  6979. +#define FIQ_DMA6 (FIQ_START+INTERRUPT_DMA6)
  6980. +#define FIQ_DMA7 (FIQ_START+INTERRUPT_DMA7)
  6981. +#define FIQ_DMA8 (FIQ_START+INTERRUPT_DMA8)
  6982. +#define FIQ_DMA9 (FIQ_START+INTERRUPT_DMA9)
  6983. +#define FIQ_DMA10 (FIQ_START+INTERRUPT_DMA10)
  6984. +#define FIQ_DMA11 (FIQ_START+INTERRUPT_DMA11)
  6985. +#define FIQ_DMA12 (FIQ_START+INTERRUPT_DMA12)
  6986. +#define FIQ_AUX (FIQ_START+INTERRUPT_AUX)
  6987. +#define FIQ_ARM (FIQ_START+INTERRUPT_ARM)
  6988. +#define FIQ_VPUDMA (FIQ_START+INTERRUPT_VPUDMA)
  6989. +#define FIQ_HOSTPORT (FIQ_START+INTERRUPT_HOSTPORT)
  6990. +#define FIQ_VIDEOSCALER (FIQ_START+INTERRUPT_VIDEOSCALER)
  6991. +#define FIQ_CCP2TX (FIQ_START+INTERRUPT_CCP2TX)
  6992. +#define FIQ_SDC (FIQ_START+INTERRUPT_SDC)
  6993. +#define FIQ_DSI0 (FIQ_START+INTERRUPT_DSI0)
  6994. +#define FIQ_AVE (FIQ_START+INTERRUPT_AVE)
  6995. +#define FIQ_CAM0 (FIQ_START+INTERRUPT_CAM0)
  6996. +#define FIQ_CAM1 (FIQ_START+INTERRUPT_CAM1)
  6997. +#define FIQ_HDMI0 (FIQ_START+INTERRUPT_HDMI0)
  6998. +#define FIQ_HDMI1 (FIQ_START+INTERRUPT_HDMI1)
  6999. +#define FIQ_PIXELVALVE1 (FIQ_START+INTERRUPT_PIXELVALVE1)
  7000. +#define FIQ_I2CSPISLV (FIQ_START+INTERRUPT_I2CSPISLV)
  7001. +#define FIQ_DSI1 (FIQ_START+INTERRUPT_DSI1)
  7002. +#define FIQ_PWA0 (FIQ_START+INTERRUPT_PWA0)
  7003. +#define FIQ_PWA1 (FIQ_START+INTERRUPT_PWA1)
  7004. +#define FIQ_CPR (FIQ_START+INTERRUPT_CPR)
  7005. +#define FIQ_SMI (FIQ_START+INTERRUPT_SMI)
  7006. +#define FIQ_GPIO0 (FIQ_START+INTERRUPT_GPIO0)
  7007. +#define FIQ_GPIO1 (FIQ_START+INTERRUPT_GPIO1)
  7008. +#define FIQ_GPIO2 (FIQ_START+INTERRUPT_GPIO2)
  7009. +#define FIQ_GPIO3 (FIQ_START+INTERRUPT_GPIO3)
  7010. +#define FIQ_I2C (FIQ_START+INTERRUPT_I2C)
  7011. +#define FIQ_SPI (FIQ_START+INTERRUPT_SPI)
  7012. +#define FIQ_I2SPCM (FIQ_START+INTERRUPT_I2SPCM)
  7013. +#define FIQ_SDIO (FIQ_START+INTERRUPT_SDIO)
  7014. +#define FIQ_UART (FIQ_START+INTERRUPT_UART)
  7015. +#define FIQ_SLIMBUS (FIQ_START+INTERRUPT_SLIMBUS)
  7016. +#define FIQ_VEC (FIQ_START+INTERRUPT_VEC)
  7017. +#define FIQ_CPG (FIQ_START+INTERRUPT_CPG)
  7018. +#define FIQ_RNG (FIQ_START+INTERRUPT_RNG)
  7019. +#define FIQ_ARASANSDIO (FIQ_START+INTERRUPT_ARASANSDIO)
  7020. +#define FIQ_AVSPMON (FIQ_START+INTERRUPT_AVSPMON)
  7021. +
  7022. +#define FIQ_ARM_TIMER (FIQ_START+INTERRUPT_ARM_TIMER)
  7023. +#define FIQ_ARM_MAILBOX (FIQ_START+INTERRUPT_ARM_MAILBOX)
  7024. +#define FIQ_ARM_DOORBELL_0 (FIQ_START+INTERRUPT_ARM_DOORBELL_0)
  7025. +#define FIQ_ARM_DOORBELL_1 (FIQ_START+INTERRUPT_ARM_DOORBELL_1)
  7026. +#define FIQ_VPU0_HALTED (FIQ_START+INTERRUPT_VPU0_HALTED)
  7027. +#define FIQ_VPU1_HALTED (FIQ_START+INTERRUPT_VPU1_HALTED)
  7028. +#define FIQ_ILLEGAL_TYPE0 (FIQ_START+INTERRUPT_ILLEGAL_TYPE0)
  7029. +#define FIQ_ILLEGAL_TYPE1 (FIQ_START+INTERRUPT_ILLEGAL_TYPE1)
  7030. +#define FIQ_PENDING1 (FIQ_START+INTERRUPT_PENDING1)
  7031. +#define FIQ_PENDING2 (FIQ_START+INTERRUPT_PENDING2)
  7032. +
  7033. +#define FIQ_ARM_LOCAL_CNTPSIRQ (FIQ_ARMCTRL_START + INTERRUPT_ARM_LOCAL_CNTPSIRQ)
  7034. +#define FIQ_ARM_LOCAL_CNTPNSIRQ (FIQ_ARMCTRL_START + INTERRUPT_ARM_LOCAL_CNTPNSIRQ)
  7035. +#define FIQ_ARM_LOCAL_CNTHPIRQ (FIQ_ARMCTRL_START + INTERRUPT_ARM_LOCAL_CNTHPIRQ)
  7036. +#define FIQ_ARM_LOCAL_CNTVIRQ (FIQ_ARMCTRL_START + INTERRUPT_ARM_LOCAL_CNTVIRQ)
  7037. +#define FIQ_ARM_LOCAL_MAILBOX0 (FIQ_ARMCTRL_START + INTERRUPT_ARM_LOCAL_MAILBOX0)
  7038. +#define FIQ_ARM_LOCAL_MAILBOX1 (FIQ_ARMCTRL_START + INTERRUPT_ARM_LOCAL_MAILBOX1)
  7039. +#define FIQ_ARM_LOCAL_MAILBOX2 (FIQ_ARMCTRL_START + INTERRUPT_ARM_LOCAL_MAILBOX2)
  7040. +#define FIQ_ARM_LOCAL_MAILBOX3 (FIQ_ARMCTRL_START + INTERRUPT_ARM_LOCAL_MAILBOX3)
  7041. +#define FIQ_ARM_LOCAL_GPU_FAST (FIQ_ARMCTRL_START + INTERRUPT_ARM_LOCAL_GPU_FAST)
  7042. +#define FIQ_ARM_LOCAL_PMU_FAST (FIQ_ARMCTRL_START + INTERRUPT_ARM_LOCAL_PMU_FAST)
  7043. +#define FIQ_ARM_LOCAL_ZERO (FIQ_ARMCTRL_START + INTERRUPT_ARM_LOCAL_ZERO)
  7044. +#define FIQ_ARM_LOCAL_TIMER (FIQ_ARMCTRL_START + INTERRUPT_ARM_LOCAL_TIMER)
  7045. +
  7046. +#define HARD_IRQS (128)
  7047. +#define FIQ_IRQS (128)
  7048. +#define GPIO_IRQ_START (HARD_IRQS + FIQ_IRQS)
  7049. +#define GPIO_IRQS (32*5)
  7050. +#define SPARE_ALLOC_IRQS 32
  7051. +#define BCM2708_ALLOC_IRQS (HARD_IRQS+FIQ_IRQS+GPIO_IRQS+SPARE_ALLOC_IRQS)
  7052. +#define FREE_IRQS 32
  7053. +#define NR_IRQS (BCM2708_ALLOC_IRQS+FREE_IRQS)
  7054. +
  7055. +#endif /* _BCM2708_IRQS_H_ */
  7056. --- /dev/null
  7057. +++ b/arch/arm/mach-bcm2709/include/mach/memory.h
  7058. @@ -0,0 +1,57 @@
  7059. +/*
  7060. + * arch/arm/mach-bcm2708/include/mach/memory.h
  7061. + *
  7062. + * Copyright (C) 2010 Broadcom
  7063. + *
  7064. + * This program is free software; you can redistribute it and/or modify
  7065. + * it under the terms of the GNU General Public License as published by
  7066. + * the Free Software Foundation; either version 2 of the License, or
  7067. + * (at your option) any later version.
  7068. + *
  7069. + * This program is distributed in the hope that it will be useful,
  7070. + * but WITHOUT ANY WARRANTY; without even the implied warranty of
  7071. + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  7072. + * GNU General Public License for more details.
  7073. + *
  7074. + * You should have received a copy of the GNU General Public License
  7075. + * along with this program; if not, write to the Free Software
  7076. + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
  7077. + */
  7078. +#ifndef __ASM_ARCH_MEMORY_H
  7079. +#define __ASM_ARCH_MEMORY_H
  7080. +
  7081. +/* Memory overview:
  7082. +
  7083. + [ARMcore] <--virtual addr-->
  7084. + [ARMmmu] <--physical addr-->
  7085. + [GERTmap] <--bus add-->
  7086. + [VCperiph]
  7087. +
  7088. +*/
  7089. +
  7090. +/*
  7091. + * Physical DRAM offset.
  7092. + */
  7093. +#define BCM_PLAT_PHYS_OFFSET UL(0x00000000)
  7094. +#define VC_ARMMEM_OFFSET UL(0x00000000) /* offset in VC of ARM memory */
  7095. +
  7096. +#ifdef CONFIG_BCM2708_NOL2CACHE
  7097. + #define _REAL_BUS_OFFSET UL(0xC0000000) /* don't use L1 or L2 caches */
  7098. +#else
  7099. + #define _REAL_BUS_OFFSET UL(0x40000000) /* use L2 cache */
  7100. +#endif
  7101. +
  7102. +/* We're using the memory at 64M in the VideoCore for Linux - this adjustment
  7103. + * will provide the offset into this area as well as setting the bits that
  7104. + * stop the L1 and L2 cache from being used
  7105. + *
  7106. + * WARNING: this only works because the ARM is given memory at a fixed location
  7107. + * (ARMMEM_OFFSET)
  7108. + */
  7109. +#define BUS_OFFSET (VC_ARMMEM_OFFSET + _REAL_BUS_OFFSET)
  7110. +#define __virt_to_bus(x) ((x) + (BUS_OFFSET - PAGE_OFFSET))
  7111. +#define __bus_to_virt(x) ((x) - (BUS_OFFSET - PAGE_OFFSET))
  7112. +#define __pfn_to_bus(x) (__pfn_to_phys(x) + (BUS_OFFSET - BCM_PLAT_PHYS_OFFSET))
  7113. +#define __bus_to_pfn(x) __phys_to_pfn((x) - (BUS_OFFSET - BCM_PLAT_PHYS_OFFSET))
  7114. +
  7115. +#endif
  7116. --- /dev/null
  7117. +++ b/arch/arm/mach-bcm2709/include/mach/platform.h
  7118. @@ -0,0 +1,225 @@
  7119. +/*
  7120. + * arch/arm/mach-bcm2708/include/mach/platform.h
  7121. + *
  7122. + * Copyright (C) 2010 Broadcom
  7123. + *
  7124. + * This program is free software; you can redistribute it and/or modify
  7125. + * it under the terms of the GNU General Public License as published by
  7126. + * the Free Software Foundation; either version 2 of the License, or
  7127. + * (at your option) any later version.
  7128. + *
  7129. + * This program is distributed in the hope that it will be useful,
  7130. + * but WITHOUT ANY WARRANTY; without even the implied warranty of
  7131. + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  7132. + * GNU General Public License for more details.
  7133. + *
  7134. + * You should have received a copy of the GNU General Public License
  7135. + * along with this program; if not, write to the Free Software
  7136. + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
  7137. + */
  7138. +
  7139. +#ifndef _BCM2708_PLATFORM_H
  7140. +#define _BCM2708_PLATFORM_H
  7141. +
  7142. +
  7143. +/* macros to get at IO space when running virtually */
  7144. +#define IO_ADDRESS(x) (((x) & 0x00ffffff) + (((x) >> 4) & 0x0f000000) + 0xf0000000)
  7145. +
  7146. +#define __io_address(n) IOMEM(IO_ADDRESS(n))
  7147. +
  7148. +
  7149. +/*
  7150. + * SDRAM
  7151. + */
  7152. +#define BCM2708_SDRAM_BASE 0x00000000
  7153. +
  7154. +/*
  7155. + * Logic expansion modules
  7156. + *
  7157. + */
  7158. +
  7159. +
  7160. +/* ------------------------------------------------------------------------
  7161. + * BCM2708 ARMCTRL Registers
  7162. + * ------------------------------------------------------------------------
  7163. + */
  7164. +
  7165. +#define HW_REGISTER_RW(addr) (addr)
  7166. +#define HW_REGISTER_RO(addr) (addr)
  7167. +
  7168. +#include "arm_control.h"
  7169. +#undef ARM_BASE
  7170. +
  7171. +/*
  7172. + * Definitions and addresses for the ARM CONTROL logic
  7173. + * This file is manually generated.
  7174. + */
  7175. +
  7176. +#define BCM2708_PERI_BASE 0x3F000000
  7177. +#define IC0_BASE (BCM2708_PERI_BASE + 0x2000)
  7178. +#define ST_BASE (BCM2708_PERI_BASE + 0x3000) /* System Timer */
  7179. +#define MPHI_BASE (BCM2708_PERI_BASE + 0x6000) /* Message -based Parallel Host Interface */
  7180. +#define DMA_BASE (BCM2708_PERI_BASE + 0x7000) /* DMA controller */
  7181. +#define ARM_BASE (BCM2708_PERI_BASE + 0xB000) /* BCM2708 ARM control block */
  7182. +#define PM_BASE (BCM2708_PERI_BASE + 0x100000) /* Power Management, Reset controller and Watchdog registers */
  7183. +#define PCM_CLOCK_BASE (BCM2708_PERI_BASE + 0x101098) /* PCM Clock */
  7184. +#define RNG_BASE (BCM2708_PERI_BASE + 0x104000) /* Hardware RNG */
  7185. +#define GPIO_BASE (BCM2708_PERI_BASE + 0x200000) /* GPIO */
  7186. +#define UART0_BASE (BCM2708_PERI_BASE + 0x201000) /* Uart 0 */
  7187. +#define MMCI0_BASE (BCM2708_PERI_BASE + 0x202000) /* MMC interface */
  7188. +#define I2S_BASE (BCM2708_PERI_BASE + 0x203000) /* I2S */
  7189. +#define SPI0_BASE (BCM2708_PERI_BASE + 0x204000) /* SPI0 */
  7190. +#define BSC0_BASE (BCM2708_PERI_BASE + 0x205000) /* BSC0 I2C/TWI */
  7191. +#define UART1_BASE (BCM2708_PERI_BASE + 0x215000) /* Uart 1 */
  7192. +#define EMMC_BASE (BCM2708_PERI_BASE + 0x300000) /* eMMC interface */
  7193. +#define SMI_BASE (BCM2708_PERI_BASE + 0x600000) /* SMI */
  7194. +#define BSC1_BASE (BCM2708_PERI_BASE + 0x804000) /* BSC1 I2C/TWI */
  7195. +#define USB_BASE (BCM2708_PERI_BASE + 0x980000) /* DTC_OTG USB controller */
  7196. +#define MCORE_BASE (BCM2708_PERI_BASE + 0x0000) /* Fake frame buffer device (actually the multicore sync block*/
  7197. +
  7198. +#define ARMCTRL_BASE (ARM_BASE + 0x000)
  7199. +#define ARMCTRL_IC_BASE (ARM_BASE + 0x200) /* ARM interrupt controller */
  7200. +#define ARMCTRL_TIMER0_1_BASE (ARM_BASE + 0x400) /* Timer 0 and 1 */
  7201. +#define ARMCTRL_0_SBM_BASE (ARM_BASE + 0x800) /* User 0 (ARM)'s Semaphores Doorbells and Mailboxes */
  7202. +
  7203. +
  7204. +/*
  7205. + * Interrupt assignments
  7206. + */
  7207. +
  7208. +#define ARM_IRQ1_BASE 0
  7209. +#define INTERRUPT_TIMER0 (ARM_IRQ1_BASE + 0)
  7210. +#define INTERRUPT_TIMER1 (ARM_IRQ1_BASE + 1)
  7211. +#define INTERRUPT_TIMER2 (ARM_IRQ1_BASE + 2)
  7212. +#define INTERRUPT_TIMER3 (ARM_IRQ1_BASE + 3)
  7213. +#define INTERRUPT_CODEC0 (ARM_IRQ1_BASE + 4)
  7214. +#define INTERRUPT_CODEC1 (ARM_IRQ1_BASE + 5)
  7215. +#define INTERRUPT_CODEC2 (ARM_IRQ1_BASE + 6)
  7216. +#define INTERRUPT_VC_JPEG (ARM_IRQ1_BASE + 7)
  7217. +#define INTERRUPT_ISP (ARM_IRQ1_BASE + 8)
  7218. +#define INTERRUPT_VC_USB (ARM_IRQ1_BASE + 9)
  7219. +#define INTERRUPT_VC_3D (ARM_IRQ1_BASE + 10)
  7220. +#define INTERRUPT_TRANSPOSER (ARM_IRQ1_BASE + 11)
  7221. +#define INTERRUPT_MULTICORESYNC0 (ARM_IRQ1_BASE + 12)
  7222. +#define INTERRUPT_MULTICORESYNC1 (ARM_IRQ1_BASE + 13)
  7223. +#define INTERRUPT_MULTICORESYNC2 (ARM_IRQ1_BASE + 14)
  7224. +#define INTERRUPT_MULTICORESYNC3 (ARM_IRQ1_BASE + 15)
  7225. +#define INTERRUPT_DMA0 (ARM_IRQ1_BASE + 16)
  7226. +#define INTERRUPT_DMA1 (ARM_IRQ1_BASE + 17)
  7227. +#define INTERRUPT_VC_DMA2 (ARM_IRQ1_BASE + 18)
  7228. +#define INTERRUPT_VC_DMA3 (ARM_IRQ1_BASE + 19)
  7229. +#define INTERRUPT_DMA4 (ARM_IRQ1_BASE + 20)
  7230. +#define INTERRUPT_DMA5 (ARM_IRQ1_BASE + 21)
  7231. +#define INTERRUPT_DMA6 (ARM_IRQ1_BASE + 22)
  7232. +#define INTERRUPT_DMA7 (ARM_IRQ1_BASE + 23)
  7233. +#define INTERRUPT_DMA8 (ARM_IRQ1_BASE + 24)
  7234. +#define INTERRUPT_DMA9 (ARM_IRQ1_BASE + 25)
  7235. +#define INTERRUPT_DMA10 (ARM_IRQ1_BASE + 26)
  7236. +#define INTERRUPT_DMA11 (ARM_IRQ1_BASE + 27)
  7237. +#define INTERRUPT_DMA12 (ARM_IRQ1_BASE + 28)
  7238. +#define INTERRUPT_AUX (ARM_IRQ1_BASE + 29)
  7239. +#define INTERRUPT_ARM (ARM_IRQ1_BASE + 30)
  7240. +#define INTERRUPT_VPUDMA (ARM_IRQ1_BASE + 31)
  7241. +
  7242. +#define ARM_IRQ2_BASE 32
  7243. +#define INTERRUPT_HOSTPORT (ARM_IRQ2_BASE + 0)
  7244. +#define INTERRUPT_VIDEOSCALER (ARM_IRQ2_BASE + 1)
  7245. +#define INTERRUPT_CCP2TX (ARM_IRQ2_BASE + 2)
  7246. +#define INTERRUPT_SDC (ARM_IRQ2_BASE + 3)
  7247. +#define INTERRUPT_DSI0 (ARM_IRQ2_BASE + 4)
  7248. +#define INTERRUPT_AVE (ARM_IRQ2_BASE + 5)
  7249. +#define INTERRUPT_CAM0 (ARM_IRQ2_BASE + 6)
  7250. +#define INTERRUPT_CAM1 (ARM_IRQ2_BASE + 7)
  7251. +#define INTERRUPT_HDMI0 (ARM_IRQ2_BASE + 8)
  7252. +#define INTERRUPT_HDMI1 (ARM_IRQ2_BASE + 9)
  7253. +#define INTERRUPT_PIXELVALVE1 (ARM_IRQ2_BASE + 10)
  7254. +#define INTERRUPT_I2CSPISLV (ARM_IRQ2_BASE + 11)
  7255. +#define INTERRUPT_DSI1 (ARM_IRQ2_BASE + 12)
  7256. +#define INTERRUPT_PWA0 (ARM_IRQ2_BASE + 13)
  7257. +#define INTERRUPT_PWA1 (ARM_IRQ2_BASE + 14)
  7258. +#define INTERRUPT_CPR (ARM_IRQ2_BASE + 15)
  7259. +#define INTERRUPT_SMI (ARM_IRQ2_BASE + 16)
  7260. +#define INTERRUPT_GPIO0 (ARM_IRQ2_BASE + 17)
  7261. +#define INTERRUPT_GPIO1 (ARM_IRQ2_BASE + 18)
  7262. +#define INTERRUPT_GPIO2 (ARM_IRQ2_BASE + 19)
  7263. +#define INTERRUPT_GPIO3 (ARM_IRQ2_BASE + 20)
  7264. +#define INTERRUPT_VC_I2C (ARM_IRQ2_BASE + 21)
  7265. +#define INTERRUPT_VC_SPI (ARM_IRQ2_BASE + 22)
  7266. +#define INTERRUPT_VC_I2SPCM (ARM_IRQ2_BASE + 23)
  7267. +#define INTERRUPT_VC_SDIO (ARM_IRQ2_BASE + 24)
  7268. +#define INTERRUPT_VC_UART (ARM_IRQ2_BASE + 25)
  7269. +#define INTERRUPT_SLIMBUS (ARM_IRQ2_BASE + 26)
  7270. +#define INTERRUPT_VEC (ARM_IRQ2_BASE + 27)
  7271. +#define INTERRUPT_CPG (ARM_IRQ2_BASE + 28)
  7272. +#define INTERRUPT_RNG (ARM_IRQ2_BASE + 29)
  7273. +#define INTERRUPT_VC_ARASANSDIO (ARM_IRQ2_BASE + 30)
  7274. +#define INTERRUPT_AVSPMON (ARM_IRQ2_BASE + 31)
  7275. +
  7276. +#define ARM_IRQ0_BASE 64
  7277. +#define INTERRUPT_ARM_TIMER (ARM_IRQ0_BASE + 0)
  7278. +#define INTERRUPT_ARM_MAILBOX (ARM_IRQ0_BASE + 1)
  7279. +#define INTERRUPT_ARM_DOORBELL_0 (ARM_IRQ0_BASE + 2)
  7280. +#define INTERRUPT_ARM_DOORBELL_1 (ARM_IRQ0_BASE + 3)
  7281. +#define INTERRUPT_VPU0_HALTED (ARM_IRQ0_BASE + 4)
  7282. +#define INTERRUPT_VPU1_HALTED (ARM_IRQ0_BASE + 5)
  7283. +#define INTERRUPT_ILLEGAL_TYPE0 (ARM_IRQ0_BASE + 6)
  7284. +#define INTERRUPT_ILLEGAL_TYPE1 (ARM_IRQ0_BASE + 7)
  7285. +#define INTERRUPT_PENDING1 (ARM_IRQ0_BASE + 8)
  7286. +#define INTERRUPT_PENDING2 (ARM_IRQ0_BASE + 9)
  7287. +#define INTERRUPT_JPEG (ARM_IRQ0_BASE + 10)
  7288. +#define INTERRUPT_USB (ARM_IRQ0_BASE + 11)
  7289. +#define INTERRUPT_3D (ARM_IRQ0_BASE + 12)
  7290. +#define INTERRUPT_DMA2 (ARM_IRQ0_BASE + 13)
  7291. +#define INTERRUPT_DMA3 (ARM_IRQ0_BASE + 14)
  7292. +#define INTERRUPT_I2C (ARM_IRQ0_BASE + 15)
  7293. +#define INTERRUPT_SPI (ARM_IRQ0_BASE + 16)
  7294. +#define INTERRUPT_I2SPCM (ARM_IRQ0_BASE + 17)
  7295. +#define INTERRUPT_SDIO (ARM_IRQ0_BASE + 18)
  7296. +#define INTERRUPT_UART (ARM_IRQ0_BASE + 19)
  7297. +#define INTERRUPT_ARASANSDIO (ARM_IRQ0_BASE + 20)
  7298. +
  7299. +#define ARM_IRQ_LOCAL_BASE 96
  7300. +#define INTERRUPT_ARM_LOCAL_CNTPSIRQ (ARM_IRQ_LOCAL_BASE + 0)
  7301. +#define INTERRUPT_ARM_LOCAL_CNTPNSIRQ (ARM_IRQ_LOCAL_BASE + 1)
  7302. +#define INTERRUPT_ARM_LOCAL_CNTHPIRQ (ARM_IRQ_LOCAL_BASE + 2)
  7303. +#define INTERRUPT_ARM_LOCAL_CNTVIRQ (ARM_IRQ_LOCAL_BASE + 3)
  7304. +#define INTERRUPT_ARM_LOCAL_MAILBOX0 (ARM_IRQ_LOCAL_BASE + 4)
  7305. +#define INTERRUPT_ARM_LOCAL_MAILBOX1 (ARM_IRQ_LOCAL_BASE + 5)
  7306. +#define INTERRUPT_ARM_LOCAL_MAILBOX2 (ARM_IRQ_LOCAL_BASE + 6)
  7307. +#define INTERRUPT_ARM_LOCAL_MAILBOX3 (ARM_IRQ_LOCAL_BASE + 7)
  7308. +#define INTERRUPT_ARM_LOCAL_GPU_FAST (ARM_IRQ_LOCAL_BASE + 8)
  7309. +#define INTERRUPT_ARM_LOCAL_PMU_FAST (ARM_IRQ_LOCAL_BASE + 9)
  7310. +#define INTERRUPT_ARM_LOCAL_ZERO (ARM_IRQ_LOCAL_BASE + 10)
  7311. +#define INTERRUPT_ARM_LOCAL_TIMER (ARM_IRQ_LOCAL_BASE + 11)
  7312. +
  7313. +/*
  7314. + * Watchdog
  7315. + */
  7316. +#define PM_RSTC (PM_BASE+0x1c)
  7317. +#define PM_RSTS (PM_BASE+0x20)
  7318. +#define PM_WDOG (PM_BASE+0x24)
  7319. +
  7320. +#define PM_WDOG_RESET 0000000000
  7321. +#define PM_PASSWORD 0x5a000000
  7322. +#define PM_WDOG_TIME_SET 0x000fffff
  7323. +#define PM_RSTC_WRCFG_CLR 0xffffffcf
  7324. +#define PM_RSTC_WRCFG_SET 0x00000030
  7325. +#define PM_RSTC_WRCFG_FULL_RESET 0x00000020
  7326. +#define PM_RSTC_RESET 0x00000102
  7327. +
  7328. +#define PM_RSTS_HADPOR_SET 0x00001000
  7329. +#define PM_RSTS_HADSRH_SET 0x00000400
  7330. +#define PM_RSTS_HADSRF_SET 0x00000200
  7331. +#define PM_RSTS_HADSRQ_SET 0x00000100
  7332. +#define PM_RSTS_HADWRH_SET 0x00000040
  7333. +#define PM_RSTS_HADWRF_SET 0x00000020
  7334. +#define PM_RSTS_HADWRQ_SET 0x00000010
  7335. +#define PM_RSTS_HADDRH_SET 0x00000004
  7336. +#define PM_RSTS_HADDRF_SET 0x00000002
  7337. +#define PM_RSTS_HADDRQ_SET 0x00000001
  7338. +
  7339. +#define UART0_CLOCK 3000000
  7340. +
  7341. +#endif
  7342. +
  7343. +/* END */
  7344. --- /dev/null
  7345. +++ b/arch/arm/mach-bcm2709/include/mach/power.h
  7346. @@ -0,0 +1,26 @@
  7347. +/*
  7348. + * linux/arch/arm/mach-bcm2708/power.h
  7349. + *
  7350. + * Copyright (C) 2010 Broadcom
  7351. + *
  7352. + * This program is free software; you can redistribute it and/or modify
  7353. + * it under the terms of the GNU General Public License version 2 as
  7354. + * published by the Free Software Foundation.
  7355. + *
  7356. + * This device provides a shared mechanism for controlling the power to
  7357. + * VideoCore subsystems.
  7358. + */
  7359. +
  7360. +#ifndef _MACH_BCM2708_POWER_H
  7361. +#define _MACH_BCM2708_POWER_H
  7362. +
  7363. +#include <linux/types.h>
  7364. +#include <mach/arm_power.h>
  7365. +
  7366. +typedef unsigned int BCM_POWER_HANDLE_T;
  7367. +
  7368. +extern int bcm_power_open(BCM_POWER_HANDLE_T *handle);
  7369. +extern int bcm_power_request(BCM_POWER_HANDLE_T handle, uint32_t request);
  7370. +extern int bcm_power_close(BCM_POWER_HANDLE_T handle);
  7371. +
  7372. +#endif
  7373. --- /dev/null
  7374. +++ b/arch/arm/mach-bcm2709/include/mach/system.h
  7375. @@ -0,0 +1,38 @@
  7376. +/*
  7377. + * arch/arm/mach-bcm2708/include/mach/system.h
  7378. + *
  7379. + * Copyright (C) 2010 Broadcom
  7380. + * Copyright (C) 2003 ARM Limited
  7381. + * Copyright (C) 2000 Deep Blue Solutions Ltd
  7382. + *
  7383. + * This program is free software; you can redistribute it and/or modify
  7384. + * it under the terms of the GNU General Public License as published by
  7385. + * the Free Software Foundation; either version 2 of the License, or
  7386. + * (at your option) any later version.
  7387. + *
  7388. + * This program is distributed in the hope that it will be useful,
  7389. + * but WITHOUT ANY WARRANTY; without even the implied warranty of
  7390. + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  7391. + * GNU General Public License for more details.
  7392. + *
  7393. + * You should have received a copy of the GNU General Public License
  7394. + * along with this program; if not, write to the Free Software
  7395. + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
  7396. + */
  7397. +#ifndef __ASM_ARCH_SYSTEM_H
  7398. +#define __ASM_ARCH_SYSTEM_H
  7399. +
  7400. +#include <linux/io.h>
  7401. +#include <mach/hardware.h>
  7402. +#include <mach/platform.h>
  7403. +
  7404. +static inline void arch_idle(void)
  7405. +{
  7406. + /*
  7407. + * This should do all the clock switching
  7408. + * and wait for interrupt tricks
  7409. + */
  7410. + cpu_do_idle();
  7411. +}
  7412. +
  7413. +#endif
  7414. --- /dev/null
  7415. +++ b/arch/arm/mach-bcm2709/include/mach/timex.h
  7416. @@ -0,0 +1,23 @@
  7417. +/*
  7418. + * arch/arm/mach-bcm2708/include/mach/timex.h
  7419. + *
  7420. + * BCM2708 sysem clock frequency
  7421. + *
  7422. + * Copyright (C) 2010 Broadcom
  7423. + *
  7424. + * This program is free software; you can redistribute it and/or modify
  7425. + * it under the terms of the GNU General Public License as published by
  7426. + * the Free Software Foundation; either version 2 of the License, or
  7427. + * (at your option) any later version.
  7428. + *
  7429. + * This program is distributed in the hope that it will be useful,
  7430. + * but WITHOUT ANY WARRANTY; without even the implied warranty of
  7431. + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  7432. + * GNU General Public License for more details.
  7433. + *
  7434. + * You should have received a copy of the GNU General Public License
  7435. + * along with this program; if not, write to the Free Software
  7436. + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
  7437. + */
  7438. +
  7439. +#define CLOCK_TICK_RATE (1000000)
  7440. --- /dev/null
  7441. +++ b/arch/arm/mach-bcm2709/include/mach/uncompress.h
  7442. @@ -0,0 +1,84 @@
  7443. +/*
  7444. + * arch/arm/mach-bcn2708/include/mach/uncompress.h
  7445. + *
  7446. + * Copyright (C) 2010 Broadcom
  7447. + * Copyright (C) 2003 ARM Limited
  7448. + *
  7449. + * This program is free software; you can redistribute it and/or modify
  7450. + * it under the terms of the GNU General Public License as published by
  7451. + * the Free Software Foundation; either version 2 of the License, or
  7452. + * (at your option) any later version.
  7453. + *
  7454. + * This program is distributed in the hope that it will be useful,
  7455. + * but WITHOUT ANY WARRANTY; without even the implied warranty of
  7456. + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  7457. + * GNU General Public License for more details.
  7458. + *
  7459. + * You should have received a copy of the GNU General Public License
  7460. + * along with this program; if not, write to the Free Software
  7461. + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
  7462. + */
  7463. +
  7464. +#include <linux/io.h>
  7465. +#include <linux/amba/serial.h>
  7466. +#include <mach/hardware.h>
  7467. +
  7468. +#define UART_BAUD 115200
  7469. +
  7470. +#define BCM2708_UART_DR __io(UART0_BASE + UART01x_DR)
  7471. +#define BCM2708_UART_FR __io(UART0_BASE + UART01x_FR)
  7472. +#define BCM2708_UART_IBRD __io(UART0_BASE + UART011_IBRD)
  7473. +#define BCM2708_UART_FBRD __io(UART0_BASE + UART011_FBRD)
  7474. +#define BCM2708_UART_LCRH __io(UART0_BASE + UART011_LCRH)
  7475. +#define BCM2708_UART_CR __io(UART0_BASE + UART011_CR)
  7476. +
  7477. +/*
  7478. + * This does not append a newline
  7479. + */
  7480. +static inline void putc(int c)
  7481. +{
  7482. + while (__raw_readl(BCM2708_UART_FR) & UART01x_FR_TXFF)
  7483. + barrier();
  7484. +
  7485. + __raw_writel(c, BCM2708_UART_DR);
  7486. +}
  7487. +
  7488. +static inline void flush(void)
  7489. +{
  7490. + int fr;
  7491. +
  7492. + do {
  7493. + fr = __raw_readl(BCM2708_UART_FR);
  7494. + barrier();
  7495. + } while ((fr & (UART011_FR_TXFE | UART01x_FR_BUSY)) != UART011_FR_TXFE);
  7496. +}
  7497. +
  7498. +static inline void arch_decomp_setup(void)
  7499. +{
  7500. + int temp, div, rem, frac;
  7501. +
  7502. + temp = 16 * UART_BAUD;
  7503. + div = UART0_CLOCK / temp;
  7504. + rem = UART0_CLOCK % temp;
  7505. + temp = (8 * rem) / UART_BAUD;
  7506. + frac = (temp >> 1) + (temp & 1);
  7507. +
  7508. + /* Make sure the UART is disabled before we start */
  7509. + __raw_writel(0, BCM2708_UART_CR);
  7510. +
  7511. + /* Set the baud rate */
  7512. + __raw_writel(div, BCM2708_UART_IBRD);
  7513. + __raw_writel(frac, BCM2708_UART_FBRD);
  7514. +
  7515. + /* Set the UART to 8n1, FIFO enabled */
  7516. + __raw_writel(UART01x_LCRH_WLEN_8 | UART01x_LCRH_FEN, BCM2708_UART_LCRH);
  7517. +
  7518. + /* Enable the UART */
  7519. + __raw_writel(UART01x_CR_UARTEN | UART011_CR_TXE | UART011_CR_RXE,
  7520. + BCM2708_UART_CR);
  7521. +}
  7522. +
  7523. +/*
  7524. + * nothing to do
  7525. + */
  7526. +#define arch_decomp_wdog()
  7527. --- /dev/null
  7528. +++ b/arch/arm/mach-bcm2709/include/mach/vc_mem.h
  7529. @@ -0,0 +1,35 @@
  7530. +/*****************************************************************************
  7531. +* Copyright 2010 - 2011 Broadcom Corporation. All rights reserved.
  7532. +*
  7533. +* Unless you and Broadcom execute a separate written software license
  7534. +* agreement governing use of this software, this software is licensed to you
  7535. +* under the terms of the GNU General Public License version 2, available at
  7536. +* http://www.broadcom.com/licenses/GPLv2.php (the "GPL").
  7537. +*
  7538. +* Notwithstanding the above, under no circumstances may you combine this
  7539. +* software in any way with any other Broadcom software provided under a
  7540. +* license other than the GPL, without Broadcom's express prior written
  7541. +* consent.
  7542. +*****************************************************************************/
  7543. +
  7544. +#if !defined( VC_MEM_H )
  7545. +#define VC_MEM_H
  7546. +
  7547. +#include <linux/ioctl.h>
  7548. +
  7549. +#define VC_MEM_IOC_MAGIC 'v'
  7550. +
  7551. +#define VC_MEM_IOC_MEM_PHYS_ADDR _IOR( VC_MEM_IOC_MAGIC, 0, unsigned long )
  7552. +#define VC_MEM_IOC_MEM_SIZE _IOR( VC_MEM_IOC_MAGIC, 1, unsigned int )
  7553. +#define VC_MEM_IOC_MEM_BASE _IOR( VC_MEM_IOC_MAGIC, 2, unsigned int )
  7554. +#define VC_MEM_IOC_MEM_LOAD _IOR( VC_MEM_IOC_MAGIC, 3, unsigned int )
  7555. +
  7556. +#if defined( __KERNEL__ )
  7557. +#define VC_MEM_TO_ARM_ADDR_MASK 0x3FFFFFFF
  7558. +
  7559. +extern unsigned long mm_vc_mem_phys_addr;
  7560. +extern unsigned int mm_vc_mem_size;
  7561. +extern int vc_mem_get_current_size( void );
  7562. +#endif
  7563. +
  7564. +#endif /* VC_MEM_H */
  7565. --- /dev/null
  7566. +++ b/arch/arm/mach-bcm2709/include/mach/vc_support.h
  7567. @@ -0,0 +1,69 @@
  7568. +#ifndef _VC_SUPPORT_H_
  7569. +#define _VC_SUPPORT_H_
  7570. +
  7571. +/*
  7572. + * vc_support.h
  7573. + *
  7574. + * Created on: 25 Nov 2012
  7575. + * Author: Simon
  7576. + */
  7577. +
  7578. +enum {
  7579. +/*
  7580. + If a MEM_HANDLE_T is discardable, the memory manager may resize it to size
  7581. + 0 at any time when it is not locked or retained.
  7582. + */
  7583. + MEM_FLAG_DISCARDABLE = 1 << 0,
  7584. +
  7585. + /*
  7586. + If a MEM_HANDLE_T is allocating (or normal), its block of memory will be
  7587. + accessed in an allocating fashion through the cache.
  7588. + */
  7589. + MEM_FLAG_NORMAL = 0 << 2,
  7590. + MEM_FLAG_ALLOCATING = MEM_FLAG_NORMAL,
  7591. +
  7592. + /*
  7593. + If a MEM_HANDLE_T is direct, its block of memory will be accessed
  7594. + directly, bypassing the cache.
  7595. + */
  7596. + MEM_FLAG_DIRECT = 1 << 2,
  7597. +
  7598. + /*
  7599. + If a MEM_HANDLE_T is coherent, its block of memory will be accessed in a
  7600. + non-allocating fashion through the cache.
  7601. + */
  7602. + MEM_FLAG_COHERENT = 2 << 2,
  7603. +
  7604. + /*
  7605. + If a MEM_HANDLE_T is L1-nonallocating, its block of memory will be accessed by
  7606. + the VPU in a fashion which is allocating in L2, but only coherent in L1.
  7607. + */
  7608. + MEM_FLAG_L1_NONALLOCATING = (MEM_FLAG_DIRECT | MEM_FLAG_COHERENT),
  7609. +
  7610. + /*
  7611. + If a MEM_HANDLE_T is zero'd, its contents are set to 0 rather than
  7612. + MEM_HANDLE_INVALID on allocation and resize up.
  7613. + */
  7614. + MEM_FLAG_ZERO = 1 << 4,
  7615. +
  7616. + /*
  7617. + If a MEM_HANDLE_T is uninitialised, it will not be reset to a defined value
  7618. + (either zero, or all 1's) on allocation.
  7619. + */
  7620. + MEM_FLAG_NO_INIT = 1 << 5,
  7621. +
  7622. + /*
  7623. + Hints.
  7624. + */
  7625. + MEM_FLAG_HINT_PERMALOCK = 1 << 6, /* Likely to be locked for long periods of time. */
  7626. +};
  7627. +
  7628. +unsigned int AllocateVcMemory(unsigned int *pHandle, unsigned int size, unsigned int alignment, unsigned int flags);
  7629. +unsigned int ReleaseVcMemory(unsigned int handle);
  7630. +unsigned int LockVcMemory(unsigned int *pBusAddress, unsigned int handle);
  7631. +unsigned int UnlockVcMemory(unsigned int handle);
  7632. +
  7633. +unsigned int ExecuteVcCode(unsigned int code,
  7634. + unsigned int r0, unsigned int r1, unsigned int r2, unsigned int r3, unsigned int r4, unsigned int r5);
  7635. +
  7636. +#endif
  7637. --- /dev/null
  7638. +++ b/arch/arm/mach-bcm2709/include/mach/vcio.h
  7639. @@ -0,0 +1,165 @@
  7640. +/*
  7641. + * arch/arm/mach-bcm2708/include/mach/vcio.h
  7642. + *
  7643. + * Copyright (C) 2010 Broadcom
  7644. + *
  7645. + * This program is free software; you can redistribute it and/or modify
  7646. + * it under the terms of the GNU General Public License as published by
  7647. + * the Free Software Foundation; either version 2 of the License, or
  7648. + * (at your option) any later version.
  7649. + *
  7650. + * This program is distributed in the hope that it will be useful,
  7651. + * but WITHOUT ANY WARRANTY; without even the implied warranty of
  7652. + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  7653. + * GNU General Public License for more details.
  7654. + *
  7655. + * You should have received a copy of the GNU General Public License
  7656. + * along with this program; if not, write to the Free Software
  7657. + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
  7658. + */
  7659. +#ifndef _MACH_BCM2708_VCIO_H
  7660. +#define _MACH_BCM2708_VCIO_H
  7661. +
  7662. +/* Routines to handle I/O via the VideoCore "ARM control" registers
  7663. + * (semaphores, doorbells, mailboxes)
  7664. + */
  7665. +
  7666. +#define BCM_VCIO_DRIVER_NAME "bcm2708_vcio"
  7667. +
  7668. +/* Constants shared with the ARM identifying separate mailbox channels */
  7669. +#define MBOX_CHAN_POWER 0 /* for use by the power management interface */
  7670. +#define MBOX_CHAN_FB 1 /* for use by the frame buffer */
  7671. +#define MBOX_CHAN_VCHIQ 3 /* for use by the VCHIQ interface */
  7672. +#define MBOX_CHAN_PROPERTY 8 /* for use by the property channel */
  7673. +#define MBOX_CHAN_COUNT 9
  7674. +
  7675. +enum {
  7676. + VCMSG_PROCESS_REQUEST = 0x00000000
  7677. +};
  7678. +enum {
  7679. + VCMSG_REQUEST_SUCCESSFUL = 0x80000000,
  7680. + VCMSG_REQUEST_FAILED = 0x80000001
  7681. +};
  7682. +/* Mailbox property tags */
  7683. +enum {
  7684. + VCMSG_PROPERTY_END = 0x00000000,
  7685. + VCMSG_GET_FIRMWARE_REVISION = 0x00000001,
  7686. + VCMSG_GET_BOARD_MODEL = 0x00010001,
  7687. + VCMSG_GET_BOARD_REVISION = 0x00010002,
  7688. + VCMSG_GET_BOARD_MAC_ADDRESS = 0x00010003,
  7689. + VCMSG_GET_BOARD_SERIAL = 0x00010004,
  7690. + VCMSG_GET_ARM_MEMORY = 0x00010005,
  7691. + VCMSG_GET_VC_MEMORY = 0x00010006,
  7692. + VCMSG_GET_CLOCKS = 0x00010007,
  7693. + VCMSG_GET_COMMAND_LINE = 0x00050001,
  7694. + VCMSG_GET_DMA_CHANNELS = 0x00060001,
  7695. + VCMSG_GET_POWER_STATE = 0x00020001,
  7696. + VCMSG_GET_TIMING = 0x00020002,
  7697. + VCMSG_SET_POWER_STATE = 0x00028001,
  7698. + VCMSG_GET_CLOCK_STATE = 0x00030001,
  7699. + VCMSG_SET_CLOCK_STATE = 0x00038001,
  7700. + VCMSG_GET_CLOCK_RATE = 0x00030002,
  7701. + VCMSG_SET_CLOCK_RATE = 0x00038002,
  7702. + VCMSG_GET_VOLTAGE = 0x00030003,
  7703. + VCMSG_SET_VOLTAGE = 0x00038003,
  7704. + VCMSG_GET_MAX_CLOCK = 0x00030004,
  7705. + VCMSG_GET_MAX_VOLTAGE = 0x00030005,
  7706. + VCMSG_GET_TEMPERATURE = 0x00030006,
  7707. + VCMSG_GET_MIN_CLOCK = 0x00030007,
  7708. + VCMSG_GET_MIN_VOLTAGE = 0x00030008,
  7709. + VCMSG_GET_TURBO = 0x00030009,
  7710. + VCMSG_GET_MAX_TEMPERATURE = 0x0003000a,
  7711. + VCMSG_GET_STC = 0x0003000b,
  7712. + VCMSG_SET_TURBO = 0x00038009,
  7713. + VCMSG_SET_ALLOCATE_MEM = 0x0003000c,
  7714. + VCMSG_SET_LOCK_MEM = 0x0003000d,
  7715. + VCMSG_SET_UNLOCK_MEM = 0x0003000e,
  7716. + VCMSG_SET_RELEASE_MEM = 0x0003000f,
  7717. + VCMSG_SET_EXECUTE_CODE = 0x00030010,
  7718. + VCMSG_SET_EXECUTE_QPU = 0x00030011,
  7719. + VCMSG_SET_ENABLE_QPU = 0x00030012,
  7720. + VCMSG_GET_RESOURCE_HANDLE = 0x00030014,
  7721. + VCMSG_GET_EDID_BLOCK = 0x00030020,
  7722. + VCMSG_GET_CUSTOMER_OTP = 0x00030021,
  7723. + VCMSG_SET_CUSTOMER_OTP = 0x00038021,
  7724. + VCMSG_SET_ALLOCATE_BUFFER = 0x00040001,
  7725. + VCMSG_SET_RELEASE_BUFFER = 0x00048001,
  7726. + VCMSG_SET_BLANK_SCREEN = 0x00040002,
  7727. + VCMSG_TST_BLANK_SCREEN = 0x00044002,
  7728. + VCMSG_GET_PHYSICAL_WIDTH_HEIGHT = 0x00040003,
  7729. + VCMSG_TST_PHYSICAL_WIDTH_HEIGHT = 0x00044003,
  7730. + VCMSG_SET_PHYSICAL_WIDTH_HEIGHT = 0x00048003,
  7731. + VCMSG_GET_VIRTUAL_WIDTH_HEIGHT = 0x00040004,
  7732. + VCMSG_TST_VIRTUAL_WIDTH_HEIGHT = 0x00044004,
  7733. + VCMSG_SET_VIRTUAL_WIDTH_HEIGHT = 0x00048004,
  7734. + VCMSG_GET_DEPTH = 0x00040005,
  7735. + VCMSG_TST_DEPTH = 0x00044005,
  7736. + VCMSG_SET_DEPTH = 0x00048005,
  7737. + VCMSG_GET_PIXEL_ORDER = 0x00040006,
  7738. + VCMSG_TST_PIXEL_ORDER = 0x00044006,
  7739. + VCMSG_SET_PIXEL_ORDER = 0x00048006,
  7740. + VCMSG_GET_ALPHA_MODE = 0x00040007,
  7741. + VCMSG_TST_ALPHA_MODE = 0x00044007,
  7742. + VCMSG_SET_ALPHA_MODE = 0x00048007,
  7743. + VCMSG_GET_PITCH = 0x00040008,
  7744. + VCMSG_TST_PITCH = 0x00044008,
  7745. + VCMSG_SET_PITCH = 0x00048008,
  7746. + VCMSG_GET_VIRTUAL_OFFSET = 0x00040009,
  7747. + VCMSG_TST_VIRTUAL_OFFSET = 0x00044009,
  7748. + VCMSG_SET_VIRTUAL_OFFSET = 0x00048009,
  7749. + VCMSG_GET_OVERSCAN = 0x0004000a,
  7750. + VCMSG_TST_OVERSCAN = 0x0004400a,
  7751. + VCMSG_SET_OVERSCAN = 0x0004800a,
  7752. + VCMSG_GET_PALETTE = 0x0004000b,
  7753. + VCMSG_TST_PALETTE = 0x0004400b,
  7754. + VCMSG_SET_PALETTE = 0x0004800b,
  7755. + VCMSG_GET_LAYER = 0x0004000c,
  7756. + VCMSG_TST_LAYER = 0x0004400c,
  7757. + VCMSG_SET_LAYER = 0x0004800c,
  7758. + VCMSG_GET_TRANSFORM = 0x0004000d,
  7759. + VCMSG_TST_TRANSFORM = 0x0004400d,
  7760. + VCMSG_SET_TRANSFORM = 0x0004800d,
  7761. + VCMSG_TST_VSYNC = 0x0004400e,
  7762. + VCMSG_SET_VSYNC = 0x0004800e,
  7763. + VCMSG_SET_CURSOR_INFO = 0x00008010,
  7764. + VCMSG_SET_CURSOR_STATE = 0x00008011,
  7765. +};
  7766. +
  7767. +extern int /*rc*/ bcm_mailbox_read(unsigned chan, uint32_t *data28);
  7768. +extern int /*rc*/ bcm_mailbox_write(unsigned chan, uint32_t data28);
  7769. +extern int /*rc*/ bcm_mailbox_property(void *data, int size);
  7770. +
  7771. +#include <linux/ioctl.h>
  7772. +
  7773. +/*
  7774. + * The major device number. We can't rely on dynamic
  7775. + * registration any more, because ioctls need to know
  7776. + * it.
  7777. + */
  7778. +#define MAJOR_NUM 100
  7779. +
  7780. +/*
  7781. + * Set the message of the device driver
  7782. + */
  7783. +#define IOCTL_MBOX_PROPERTY _IOWR(MAJOR_NUM, 0, char *)
  7784. +/*
  7785. + * _IOWR means that we're creating an ioctl command
  7786. + * number for passing information from a user process
  7787. + * to the kernel module and from the kernel module to user process
  7788. + *
  7789. + * The first arguments, MAJOR_NUM, is the major device
  7790. + * number we're using.
  7791. + *
  7792. + * The second argument is the number of the command
  7793. + * (there could be several with different meanings).
  7794. + *
  7795. + * The third argument is the type we want to get from
  7796. + * the process to the kernel.
  7797. + */
  7798. +
  7799. +/*
  7800. + * The name of the device file
  7801. + */
  7802. +#define DEVICE_FILE_NAME "vcio"
  7803. +
  7804. +#endif
  7805. --- /dev/null
  7806. +++ b/arch/arm/mach-bcm2709/include/mach/vmalloc.h
  7807. @@ -0,0 +1,20 @@
  7808. +/*
  7809. + * arch/arm/mach-bcm2708/include/mach/vmalloc.h
  7810. + *
  7811. + * Copyright (C) 2010 Broadcom
  7812. + *
  7813. + * This program is free software; you can redistribute it and/or modify
  7814. + * it under the terms of the GNU General Public License as published by
  7815. + * the Free Software Foundation; either version 2 of the License, or
  7816. + * (at your option) any later version.
  7817. + *
  7818. + * This program is distributed in the hope that it will be useful,
  7819. + * but WITHOUT ANY WARRANTY; without even the implied warranty of
  7820. + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  7821. + * GNU General Public License for more details.
  7822. + *
  7823. + * You should have received a copy of the GNU General Public License
  7824. + * along with this program; if not, write to the Free Software
  7825. + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
  7826. + */
  7827. +#define VMALLOC_END (0xff000000)
  7828. --- /dev/null
  7829. +++ b/arch/arm/mach-bcm2709/power.c
  7830. @@ -0,0 +1,195 @@
  7831. +/*
  7832. + * linux/arch/arm/mach-bcm2708/power.c
  7833. + *
  7834. + * Copyright (C) 2010 Broadcom
  7835. + *
  7836. + * This program is free software; you can redistribute it and/or modify
  7837. + * it under the terms of the GNU General Public License version 2 as
  7838. + * published by the Free Software Foundation.
  7839. + *
  7840. + * This device provides a shared mechanism for controlling the power to
  7841. + * VideoCore subsystems.
  7842. + */
  7843. +
  7844. +#include <linux/module.h>
  7845. +#include <linux/semaphore.h>
  7846. +#include <linux/bug.h>
  7847. +#include <mach/power.h>
  7848. +#include <mach/vcio.h>
  7849. +#include <mach/arm_power.h>
  7850. +
  7851. +#define DRIVER_NAME "bcm2708_power"
  7852. +
  7853. +#define BCM_POWER_MAXCLIENTS 4
  7854. +#define BCM_POWER_NOCLIENT (1<<31)
  7855. +
  7856. +/* Some drivers expect there devices to be permanently powered */
  7857. +#ifdef CONFIG_USB
  7858. +#define BCM_POWER_ALWAYS_ON (BCM_POWER_USB)
  7859. +#endif
  7860. +
  7861. +#if 1
  7862. +#define DPRINTK printk
  7863. +#else
  7864. +#define DPRINTK if (0) printk
  7865. +#endif
  7866. +
  7867. +struct state_struct {
  7868. + uint32_t global_request;
  7869. + uint32_t client_request[BCM_POWER_MAXCLIENTS];
  7870. + struct semaphore client_mutex;
  7871. + struct semaphore mutex;
  7872. +} g_state;
  7873. +
  7874. +int bcm_power_open(BCM_POWER_HANDLE_T *handle)
  7875. +{
  7876. + BCM_POWER_HANDLE_T i;
  7877. + int ret = -EBUSY;
  7878. +
  7879. + down(&g_state.client_mutex);
  7880. +
  7881. + for (i = 0; i < BCM_POWER_MAXCLIENTS; i++) {
  7882. + if (g_state.client_request[i] == BCM_POWER_NOCLIENT) {
  7883. + g_state.client_request[i] = BCM_POWER_NONE;
  7884. + *handle = i;
  7885. + ret = 0;
  7886. + break;
  7887. + }
  7888. + }
  7889. +
  7890. + up(&g_state.client_mutex);
  7891. +
  7892. + DPRINTK("bcm_power_open() -> %d\n", *handle);
  7893. +
  7894. + return ret;
  7895. +}
  7896. +EXPORT_SYMBOL_GPL(bcm_power_open);
  7897. +
  7898. +int bcm_power_request(BCM_POWER_HANDLE_T handle, uint32_t request)
  7899. +{
  7900. + int rc = 0;
  7901. +
  7902. + DPRINTK("bcm_power_request(%d, %x)\n", handle, request);
  7903. +
  7904. + if ((handle < BCM_POWER_MAXCLIENTS) &&
  7905. + (g_state.client_request[handle] != BCM_POWER_NOCLIENT)) {
  7906. + if (down_interruptible(&g_state.mutex) != 0) {
  7907. + DPRINTK("bcm_power_request -> interrupted\n");
  7908. + return -EINTR;
  7909. + }
  7910. +
  7911. + if (request != g_state.client_request[handle]) {
  7912. + uint32_t others_request = 0;
  7913. + uint32_t global_request;
  7914. + BCM_POWER_HANDLE_T i;
  7915. +
  7916. + for (i = 0; i < BCM_POWER_MAXCLIENTS; i++) {
  7917. + if (i != handle)
  7918. + others_request |=
  7919. + g_state.client_request[i];
  7920. + }
  7921. + others_request &= ~BCM_POWER_NOCLIENT;
  7922. +
  7923. + global_request = request | others_request;
  7924. + if (global_request != g_state.global_request) {
  7925. + uint32_t actual;
  7926. +
  7927. + /* Send a request to VideoCore */
  7928. + bcm_mailbox_write(MBOX_CHAN_POWER,
  7929. + global_request << 4);
  7930. +
  7931. + /* Wait for a response during power-up */
  7932. + if (global_request & ~g_state.global_request) {
  7933. + rc = bcm_mailbox_read(MBOX_CHAN_POWER,
  7934. + &actual);
  7935. + DPRINTK
  7936. + ("bcm_mailbox_read -> %08x, %d\n",
  7937. + actual, rc);
  7938. + actual >>= 4;
  7939. + } else {
  7940. + rc = 0;
  7941. + actual = global_request;
  7942. + }
  7943. +
  7944. + if (rc == 0) {
  7945. + if (actual != global_request) {
  7946. + printk(KERN_ERR
  7947. + "%s: prev global %x, new global %x, actual %x, request %x, others_request %x\n",
  7948. + __func__,
  7949. + g_state.global_request,
  7950. + global_request, actual, request, others_request);
  7951. + /* A failure */
  7952. + BUG_ON((others_request & actual)
  7953. + != others_request);
  7954. + request &= actual;
  7955. + rc = -EIO;
  7956. + }
  7957. +
  7958. + g_state.global_request = actual;
  7959. + g_state.client_request[handle] =
  7960. + request;
  7961. + }
  7962. + }
  7963. + }
  7964. + up(&g_state.mutex);
  7965. + } else {
  7966. + rc = -EINVAL;
  7967. + }
  7968. + DPRINTK("bcm_power_request -> %d\n", rc);
  7969. + return rc;
  7970. +}
  7971. +EXPORT_SYMBOL_GPL(bcm_power_request);
  7972. +
  7973. +int bcm_power_close(BCM_POWER_HANDLE_T handle)
  7974. +{
  7975. + int rc;
  7976. +
  7977. + DPRINTK("bcm_power_close(%d)\n", handle);
  7978. +
  7979. + rc = bcm_power_request(handle, BCM_POWER_NONE);
  7980. + if (rc == 0)
  7981. + g_state.client_request[handle] = BCM_POWER_NOCLIENT;
  7982. +
  7983. + return rc;
  7984. +}
  7985. +EXPORT_SYMBOL_GPL(bcm_power_close);
  7986. +
  7987. +static int __init bcm_power_init(void)
  7988. +{
  7989. +#if defined(BCM_POWER_ALWAYS_ON)
  7990. + BCM_POWER_HANDLE_T always_on_handle;
  7991. +#endif
  7992. + int rc = 0;
  7993. + int i;
  7994. +
  7995. + printk(KERN_INFO "bcm_power: Broadcom power driver\n");
  7996. + bcm_mailbox_write(MBOX_CHAN_POWER, 0);
  7997. +
  7998. + for (i = 0; i < BCM_POWER_MAXCLIENTS; i++)
  7999. + g_state.client_request[i] = BCM_POWER_NOCLIENT;
  8000. +
  8001. + sema_init(&g_state.client_mutex, 1);
  8002. + sema_init(&g_state.mutex, 1);
  8003. +
  8004. + g_state.global_request = 0;
  8005. +#if defined(BCM_POWER_ALWAYS_ON)
  8006. + if (BCM_POWER_ALWAYS_ON) {
  8007. + bcm_power_open(&always_on_handle);
  8008. + bcm_power_request(always_on_handle, BCM_POWER_ALWAYS_ON);
  8009. + }
  8010. +#endif
  8011. +
  8012. + return rc;
  8013. +}
  8014. +
  8015. +static void __exit bcm_power_exit(void)
  8016. +{
  8017. + bcm_mailbox_write(MBOX_CHAN_POWER, 0);
  8018. +}
  8019. +
  8020. +arch_initcall(bcm_power_init); /* Initialize early */
  8021. +module_exit(bcm_power_exit);
  8022. +
  8023. +MODULE_AUTHOR("Phil Elwell");
  8024. +MODULE_DESCRIPTION("Interface to BCM2708 power management");
  8025. +MODULE_LICENSE("GPL");
  8026. --- /dev/null
  8027. +++ b/arch/arm/mach-bcm2709/vc_mem.c
  8028. @@ -0,0 +1,431 @@
  8029. +/*****************************************************************************
  8030. +* Copyright 2010 - 2011 Broadcom Corporation. All rights reserved.
  8031. +*
  8032. +* Unless you and Broadcom execute a separate written software license
  8033. +* agreement governing use of this software, this software is licensed to you
  8034. +* under the terms of the GNU General Public License version 2, available at
  8035. +* http://www.broadcom.com/licenses/GPLv2.php (the "GPL").
  8036. +*
  8037. +* Notwithstanding the above, under no circumstances may you combine this
  8038. +* software in any way with any other Broadcom software provided under a
  8039. +* license other than the GPL, without Broadcom's express prior written
  8040. +* consent.
  8041. +*****************************************************************************/
  8042. +
  8043. +#include <linux/kernel.h>
  8044. +#include <linux/module.h>
  8045. +#include <linux/fs.h>
  8046. +#include <linux/device.h>
  8047. +#include <linux/cdev.h>
  8048. +#include <linux/mm.h>
  8049. +#include <linux/slab.h>
  8050. +#include <linux/debugfs.h>
  8051. +#include <asm/uaccess.h>
  8052. +#include <linux/dma-mapping.h>
  8053. +
  8054. +#ifdef CONFIG_ARCH_KONA
  8055. +#include <chal/chal_ipc.h>
  8056. +#elif defined(CONFIG_ARCH_BCM2708) || defined(CONFIG_ARCH_BCM2709)
  8057. +#else
  8058. +#include <csp/chal_ipc.h>
  8059. +#endif
  8060. +
  8061. +#include "mach/vc_mem.h"
  8062. +#include <mach/vcio.h>
  8063. +
  8064. +#define DRIVER_NAME "vc-mem"
  8065. +
  8066. +// Device (/dev) related variables
  8067. +static dev_t vc_mem_devnum = 0;
  8068. +static struct class *vc_mem_class = NULL;
  8069. +static struct cdev vc_mem_cdev;
  8070. +static int vc_mem_inited = 0;
  8071. +
  8072. +#ifdef CONFIG_DEBUG_FS
  8073. +static struct dentry *vc_mem_debugfs_entry;
  8074. +#endif
  8075. +
  8076. +/*
  8077. + * Videocore memory addresses and size
  8078. + *
  8079. + * Drivers that wish to know the videocore memory addresses and sizes should
  8080. + * use these variables instead of the MM_IO_BASE and MM_ADDR_IO defines in
  8081. + * headers. This allows the other drivers to not be tied down to a a certain
  8082. + * address/size at compile time.
  8083. + *
  8084. + * In the future, the goal is to have the videocore memory virtual address and
  8085. + * size be calculated at boot time rather than at compile time. The decision of
  8086. + * where the videocore memory resides and its size would be in the hands of the
  8087. + * bootloader (and/or kernel). When that happens, the values of these variables
  8088. + * would be calculated and assigned in the init function.
  8089. + */
  8090. +// in the 2835 VC in mapped above ARM, but ARM has full access to VC space
  8091. +unsigned long mm_vc_mem_phys_addr = 0x00000000;
  8092. +unsigned int mm_vc_mem_size = 0;
  8093. +unsigned int mm_vc_mem_base = 0;
  8094. +
  8095. +EXPORT_SYMBOL(mm_vc_mem_phys_addr);
  8096. +EXPORT_SYMBOL(mm_vc_mem_size);
  8097. +EXPORT_SYMBOL(mm_vc_mem_base);
  8098. +
  8099. +static uint phys_addr = 0;
  8100. +static uint mem_size = 0;
  8101. +static uint mem_base = 0;
  8102. +
  8103. +
  8104. +/****************************************************************************
  8105. +*
  8106. +* vc_mem_open
  8107. +*
  8108. +***************************************************************************/
  8109. +
  8110. +static int
  8111. +vc_mem_open(struct inode *inode, struct file *file)
  8112. +{
  8113. + (void) inode;
  8114. + (void) file;
  8115. +
  8116. + pr_debug("%s: called file = 0x%p\n", __func__, file);
  8117. +
  8118. + return 0;
  8119. +}
  8120. +
  8121. +/****************************************************************************
  8122. +*
  8123. +* vc_mem_release
  8124. +*
  8125. +***************************************************************************/
  8126. +
  8127. +static int
  8128. +vc_mem_release(struct inode *inode, struct file *file)
  8129. +{
  8130. + (void) inode;
  8131. + (void) file;
  8132. +
  8133. + pr_debug("%s: called file = 0x%p\n", __func__, file);
  8134. +
  8135. + return 0;
  8136. +}
  8137. +
  8138. +/****************************************************************************
  8139. +*
  8140. +* vc_mem_get_size
  8141. +*
  8142. +***************************************************************************/
  8143. +
  8144. +static void
  8145. +vc_mem_get_size(void)
  8146. +{
  8147. +}
  8148. +
  8149. +/****************************************************************************
  8150. +*
  8151. +* vc_mem_get_base
  8152. +*
  8153. +***************************************************************************/
  8154. +
  8155. +static void
  8156. +vc_mem_get_base(void)
  8157. +{
  8158. +}
  8159. +
  8160. +/****************************************************************************
  8161. +*
  8162. +* vc_mem_get_current_size
  8163. +*
  8164. +***************************************************************************/
  8165. +
  8166. +int
  8167. +vc_mem_get_current_size(void)
  8168. +{
  8169. + return mm_vc_mem_size;
  8170. +}
  8171. +
  8172. +EXPORT_SYMBOL_GPL(vc_mem_get_current_size);
  8173. +
  8174. +/****************************************************************************
  8175. +*
  8176. +* vc_mem_ioctl
  8177. +*
  8178. +***************************************************************************/
  8179. +
  8180. +static long
  8181. +vc_mem_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
  8182. +{
  8183. + int rc = 0;
  8184. +
  8185. + (void) cmd;
  8186. + (void) arg;
  8187. +
  8188. + pr_debug("%s: called file = 0x%p\n", __func__, file);
  8189. +
  8190. + switch (cmd) {
  8191. + case VC_MEM_IOC_MEM_PHYS_ADDR:
  8192. + {
  8193. + pr_debug("%s: VC_MEM_IOC_MEM_PHYS_ADDR=0x%p\n",
  8194. + __func__, (void *) mm_vc_mem_phys_addr);
  8195. +
  8196. + if (copy_to_user((void *) arg, &mm_vc_mem_phys_addr,
  8197. + sizeof (mm_vc_mem_phys_addr)) != 0) {
  8198. + rc = -EFAULT;
  8199. + }
  8200. + break;
  8201. + }
  8202. + case VC_MEM_IOC_MEM_SIZE:
  8203. + {
  8204. + // Get the videocore memory size first
  8205. + vc_mem_get_size();
  8206. +
  8207. + pr_debug("%s: VC_MEM_IOC_MEM_SIZE=%u\n", __func__,
  8208. + mm_vc_mem_size);
  8209. +
  8210. + if (copy_to_user((void *) arg, &mm_vc_mem_size,
  8211. + sizeof (mm_vc_mem_size)) != 0) {
  8212. + rc = -EFAULT;
  8213. + }
  8214. + break;
  8215. + }
  8216. + case VC_MEM_IOC_MEM_BASE:
  8217. + {
  8218. + // Get the videocore memory base
  8219. + vc_mem_get_base();
  8220. +
  8221. + pr_debug("%s: VC_MEM_IOC_MEM_BASE=%u\n", __func__,
  8222. + mm_vc_mem_base);
  8223. +
  8224. + if (copy_to_user((void *) arg, &mm_vc_mem_base,
  8225. + sizeof (mm_vc_mem_base)) != 0) {
  8226. + rc = -EFAULT;
  8227. + }
  8228. + break;
  8229. + }
  8230. + case VC_MEM_IOC_MEM_LOAD:
  8231. + {
  8232. + // Get the videocore memory base
  8233. + vc_mem_get_base();
  8234. +
  8235. + pr_debug("%s: VC_MEM_IOC_MEM_LOAD=%u\n", __func__,
  8236. + mm_vc_mem_base);
  8237. +
  8238. + if (copy_to_user((void *) arg, &mm_vc_mem_base,
  8239. + sizeof (mm_vc_mem_base)) != 0) {
  8240. + rc = -EFAULT;
  8241. + }
  8242. + break;
  8243. + }
  8244. + default:
  8245. + {
  8246. + return -ENOTTY;
  8247. + }
  8248. + }
  8249. + pr_debug("%s: file = 0x%p returning %d\n", __func__, file, rc);
  8250. +
  8251. + return rc;
  8252. +}
  8253. +
  8254. +/****************************************************************************
  8255. +*
  8256. +* vc_mem_mmap
  8257. +*
  8258. +***************************************************************************/
  8259. +
  8260. +static int
  8261. +vc_mem_mmap(struct file *filp, struct vm_area_struct *vma)
  8262. +{
  8263. + int rc = 0;
  8264. + unsigned long length = vma->vm_end - vma->vm_start;
  8265. + unsigned long offset = vma->vm_pgoff << PAGE_SHIFT;
  8266. +
  8267. + pr_debug("%s: vm_start = 0x%08lx vm_end = 0x%08lx vm_pgoff = 0x%08lx\n",
  8268. + __func__, (long) vma->vm_start, (long) vma->vm_end,
  8269. + (long) vma->vm_pgoff);
  8270. +
  8271. + if (offset + length > mm_vc_mem_size) {
  8272. + pr_err("%s: length %ld is too big\n", __func__, length);
  8273. + return -EINVAL;
  8274. + }
  8275. + // Do not cache the memory map
  8276. + vma->vm_page_prot = pgprot_noncached(vma->vm_page_prot);
  8277. +
  8278. + rc = remap_pfn_range(vma, vma->vm_start,
  8279. + (mm_vc_mem_phys_addr >> PAGE_SHIFT) +
  8280. + vma->vm_pgoff, length, vma->vm_page_prot);
  8281. + if (rc != 0) {
  8282. + pr_err("%s: remap_pfn_range failed (rc=%d)\n", __func__, rc);
  8283. + }
  8284. +
  8285. + return rc;
  8286. +}
  8287. +
  8288. +/****************************************************************************
  8289. +*
  8290. +* File Operations for the driver.
  8291. +*
  8292. +***************************************************************************/
  8293. +
  8294. +static const struct file_operations vc_mem_fops = {
  8295. + .owner = THIS_MODULE,
  8296. + .open = vc_mem_open,
  8297. + .release = vc_mem_release,
  8298. + .unlocked_ioctl = vc_mem_ioctl,
  8299. + .mmap = vc_mem_mmap,
  8300. +};
  8301. +
  8302. +#ifdef CONFIG_DEBUG_FS
  8303. +static void vc_mem_debugfs_deinit(void)
  8304. +{
  8305. + debugfs_remove_recursive(vc_mem_debugfs_entry);
  8306. + vc_mem_debugfs_entry = NULL;
  8307. +}
  8308. +
  8309. +
  8310. +static int vc_mem_debugfs_init(
  8311. + struct device *dev)
  8312. +{
  8313. + vc_mem_debugfs_entry = debugfs_create_dir(DRIVER_NAME, NULL);
  8314. + if (!vc_mem_debugfs_entry) {
  8315. + dev_warn(dev, "could not create debugfs entry\n");
  8316. + return -EFAULT;
  8317. + }
  8318. +
  8319. + if (!debugfs_create_x32("vc_mem_phys_addr",
  8320. + 0444,
  8321. + vc_mem_debugfs_entry,
  8322. + (u32 *)&mm_vc_mem_phys_addr)) {
  8323. + dev_warn(dev, "%s:could not create vc_mem_phys entry\n",
  8324. + __func__);
  8325. + goto fail;
  8326. + }
  8327. +
  8328. + if (!debugfs_create_x32("vc_mem_size",
  8329. + 0444,
  8330. + vc_mem_debugfs_entry,
  8331. + (u32 *)&mm_vc_mem_size)) {
  8332. + dev_warn(dev, "%s:could not create vc_mem_size entry\n",
  8333. + __func__);
  8334. + goto fail;
  8335. + }
  8336. +
  8337. + if (!debugfs_create_x32("vc_mem_base",
  8338. + 0444,
  8339. + vc_mem_debugfs_entry,
  8340. + (u32 *)&mm_vc_mem_base)) {
  8341. + dev_warn(dev, "%s:could not create vc_mem_base entry\n",
  8342. + __func__);
  8343. + goto fail;
  8344. + }
  8345. +
  8346. + return 0;
  8347. +
  8348. +fail:
  8349. + vc_mem_debugfs_deinit();
  8350. + return -EFAULT;
  8351. +}
  8352. +
  8353. +#endif /* CONFIG_DEBUG_FS */
  8354. +
  8355. +
  8356. +/****************************************************************************
  8357. +*
  8358. +* vc_mem_init
  8359. +*
  8360. +***************************************************************************/
  8361. +
  8362. +static int __init
  8363. +vc_mem_init(void)
  8364. +{
  8365. + int rc = -EFAULT;
  8366. + struct device *dev;
  8367. +
  8368. + pr_debug("%s: called\n", __func__);
  8369. +
  8370. + mm_vc_mem_phys_addr = phys_addr;
  8371. + mm_vc_mem_size = mem_size;
  8372. + mm_vc_mem_base = mem_base;
  8373. +
  8374. + vc_mem_get_size();
  8375. +
  8376. + pr_info("vc-mem: phys_addr:0x%08lx mem_base=0x%08x mem_size:0x%08x(%u MiB)\n",
  8377. + mm_vc_mem_phys_addr, mm_vc_mem_base, mm_vc_mem_size, mm_vc_mem_size / (1024 * 1024));
  8378. +
  8379. + if ((rc = alloc_chrdev_region(&vc_mem_devnum, 0, 1, DRIVER_NAME)) < 0) {
  8380. + pr_err("%s: alloc_chrdev_region failed (rc=%d)\n",
  8381. + __func__, rc);
  8382. + goto out_err;
  8383. + }
  8384. +
  8385. + cdev_init(&vc_mem_cdev, &vc_mem_fops);
  8386. + if ((rc = cdev_add(&vc_mem_cdev, vc_mem_devnum, 1)) != 0) {
  8387. + pr_err("%s: cdev_add failed (rc=%d)\n", __func__, rc);
  8388. + goto out_unregister;
  8389. + }
  8390. +
  8391. + vc_mem_class = class_create(THIS_MODULE, DRIVER_NAME);
  8392. + if (IS_ERR(vc_mem_class)) {
  8393. + rc = PTR_ERR(vc_mem_class);
  8394. + pr_err("%s: class_create failed (rc=%d)\n", __func__, rc);
  8395. + goto out_cdev_del;
  8396. + }
  8397. +
  8398. + dev = device_create(vc_mem_class, NULL, vc_mem_devnum, NULL,
  8399. + DRIVER_NAME);
  8400. + if (IS_ERR(dev)) {
  8401. + rc = PTR_ERR(dev);
  8402. + pr_err("%s: device_create failed (rc=%d)\n", __func__, rc);
  8403. + goto out_class_destroy;
  8404. + }
  8405. +
  8406. +#ifdef CONFIG_DEBUG_FS
  8407. + /* don't fail if the debug entries cannot be created */
  8408. + vc_mem_debugfs_init(dev);
  8409. +#endif
  8410. +
  8411. + vc_mem_inited = 1;
  8412. + return 0;
  8413. +
  8414. + device_destroy(vc_mem_class, vc_mem_devnum);
  8415. +
  8416. + out_class_destroy:
  8417. + class_destroy(vc_mem_class);
  8418. + vc_mem_class = NULL;
  8419. +
  8420. + out_cdev_del:
  8421. + cdev_del(&vc_mem_cdev);
  8422. +
  8423. + out_unregister:
  8424. + unregister_chrdev_region(vc_mem_devnum, 1);
  8425. +
  8426. + out_err:
  8427. + return -1;
  8428. +}
  8429. +
  8430. +/****************************************************************************
  8431. +*
  8432. +* vc_mem_exit
  8433. +*
  8434. +***************************************************************************/
  8435. +
  8436. +static void __exit
  8437. +vc_mem_exit(void)
  8438. +{
  8439. + pr_debug("%s: called\n", __func__);
  8440. +
  8441. + if (vc_mem_inited) {
  8442. +#if CONFIG_DEBUG_FS
  8443. + vc_mem_debugfs_deinit();
  8444. +#endif
  8445. + device_destroy(vc_mem_class, vc_mem_devnum);
  8446. + class_destroy(vc_mem_class);
  8447. + cdev_del(&vc_mem_cdev);
  8448. + unregister_chrdev_region(vc_mem_devnum, 1);
  8449. + }
  8450. +}
  8451. +
  8452. +module_init(vc_mem_init);
  8453. +module_exit(vc_mem_exit);
  8454. +MODULE_LICENSE("GPL");
  8455. +MODULE_AUTHOR("Broadcom Corporation");
  8456. +
  8457. +module_param(phys_addr, uint, 0644);
  8458. +module_param(mem_size, uint, 0644);
  8459. +module_param(mem_base, uint, 0644);
  8460. --- /dev/null
  8461. +++ b/arch/arm/mach-bcm2709/vc_support.c
  8462. @@ -0,0 +1,318 @@
  8463. +/*
  8464. + * vc_support.c
  8465. + *
  8466. + * Created on: 25 Nov 2012
  8467. + * Author: Simon
  8468. + */
  8469. +
  8470. +#include <linux/module.h>
  8471. +#include <mach/vcio.h>
  8472. +
  8473. +#ifdef ECLIPSE_IGNORE
  8474. +
  8475. +#define __user
  8476. +#define __init
  8477. +#define __exit
  8478. +#define __iomem
  8479. +#define KERN_DEBUG
  8480. +#define KERN_ERR
  8481. +#define KERN_WARNING
  8482. +#define KERN_INFO
  8483. +#define _IOWR(a, b, c) b
  8484. +#define _IOW(a, b, c) b
  8485. +#define _IO(a, b) b
  8486. +
  8487. +#endif
  8488. +
  8489. +/****** VC MAILBOX FUNCTIONALITY ******/
  8490. +unsigned int AllocateVcMemory(unsigned int *pHandle, unsigned int size, unsigned int alignment, unsigned int flags)
  8491. +{
  8492. + struct vc_msg
  8493. + {
  8494. + unsigned int m_msgSize;
  8495. + unsigned int m_response;
  8496. +
  8497. + struct vc_tag
  8498. + {
  8499. + unsigned int m_tagId;
  8500. + unsigned int m_sendBufferSize;
  8501. + union {
  8502. + unsigned int m_sendDataSize;
  8503. + unsigned int m_recvDataSize;
  8504. + };
  8505. +
  8506. + struct args
  8507. + {
  8508. + union {
  8509. + unsigned int m_size;
  8510. + unsigned int m_handle;
  8511. + };
  8512. + unsigned int m_alignment;
  8513. + unsigned int m_flags;
  8514. + } m_args;
  8515. + } m_tag;
  8516. +
  8517. + unsigned int m_endTag;
  8518. + } msg;
  8519. + int s;
  8520. +
  8521. + msg.m_msgSize = sizeof(msg);
  8522. + msg.m_response = 0;
  8523. + msg.m_endTag = 0;
  8524. +
  8525. + //fill in the tag for the allocation command
  8526. + msg.m_tag.m_tagId = 0x3000c;
  8527. + msg.m_tag.m_sendBufferSize = 12;
  8528. + msg.m_tag.m_sendDataSize = 12;
  8529. +
  8530. + //fill in our args
  8531. + msg.m_tag.m_args.m_size = size;
  8532. + msg.m_tag.m_args.m_alignment = alignment;
  8533. + msg.m_tag.m_args.m_flags = flags;
  8534. +
  8535. + //run the command
  8536. + s = bcm_mailbox_property(&msg, sizeof(msg));
  8537. +
  8538. + if (s == 0 && msg.m_response == 0x80000000 && msg.m_tag.m_recvDataSize == 0x80000004)
  8539. + {
  8540. + *pHandle = msg.m_tag.m_args.m_handle;
  8541. + return 0;
  8542. + }
  8543. + else
  8544. + {
  8545. + printk(KERN_ERR "failed to allocate vc memory: s=%d response=%08x recv data size=%08x\n",
  8546. + s, msg.m_response, msg.m_tag.m_recvDataSize);
  8547. + return 1;
  8548. + }
  8549. +}
  8550. +
  8551. +unsigned int ReleaseVcMemory(unsigned int handle)
  8552. +{
  8553. + struct vc_msg
  8554. + {
  8555. + unsigned int m_msgSize;
  8556. + unsigned int m_response;
  8557. +
  8558. + struct vc_tag
  8559. + {
  8560. + unsigned int m_tagId;
  8561. + unsigned int m_sendBufferSize;
  8562. + union {
  8563. + unsigned int m_sendDataSize;
  8564. + unsigned int m_recvDataSize;
  8565. + };
  8566. +
  8567. + struct args
  8568. + {
  8569. + union {
  8570. + unsigned int m_handle;
  8571. + unsigned int m_error;
  8572. + };
  8573. + } m_args;
  8574. + } m_tag;
  8575. +
  8576. + unsigned int m_endTag;
  8577. + } msg;
  8578. + int s;
  8579. +
  8580. + msg.m_msgSize = sizeof(msg);
  8581. + msg.m_response = 0;
  8582. + msg.m_endTag = 0;
  8583. +
  8584. + //fill in the tag for the release command
  8585. + msg.m_tag.m_tagId = 0x3000f;
  8586. + msg.m_tag.m_sendBufferSize = 4;
  8587. + msg.m_tag.m_sendDataSize = 4;
  8588. +
  8589. + //pass across the handle
  8590. + msg.m_tag.m_args.m_handle = handle;
  8591. +
  8592. + s = bcm_mailbox_property(&msg, sizeof(msg));
  8593. +
  8594. + if (s == 0 && msg.m_response == 0x80000000 && msg.m_tag.m_recvDataSize == 0x80000004 && msg.m_tag.m_args.m_error == 0)
  8595. + return 0;
  8596. + else
  8597. + {
  8598. + printk(KERN_ERR "failed to release vc memory: s=%d response=%08x recv data size=%08x error=%08x\n",
  8599. + s, msg.m_response, msg.m_tag.m_recvDataSize, msg.m_tag.m_args.m_error);
  8600. + return 1;
  8601. + }
  8602. +}
  8603. +
  8604. +unsigned int LockVcMemory(unsigned int *pBusAddress, unsigned int handle)
  8605. +{
  8606. + struct vc_msg
  8607. + {
  8608. + unsigned int m_msgSize;
  8609. + unsigned int m_response;
  8610. +
  8611. + struct vc_tag
  8612. + {
  8613. + unsigned int m_tagId;
  8614. + unsigned int m_sendBufferSize;
  8615. + union {
  8616. + unsigned int m_sendDataSize;
  8617. + unsigned int m_recvDataSize;
  8618. + };
  8619. +
  8620. + struct args
  8621. + {
  8622. + union {
  8623. + unsigned int m_handle;
  8624. + unsigned int m_busAddress;
  8625. + };
  8626. + } m_args;
  8627. + } m_tag;
  8628. +
  8629. + unsigned int m_endTag;
  8630. + } msg;
  8631. + int s;
  8632. +
  8633. + msg.m_msgSize = sizeof(msg);
  8634. + msg.m_response = 0;
  8635. + msg.m_endTag = 0;
  8636. +
  8637. + //fill in the tag for the lock command
  8638. + msg.m_tag.m_tagId = 0x3000d;
  8639. + msg.m_tag.m_sendBufferSize = 4;
  8640. + msg.m_tag.m_sendDataSize = 4;
  8641. +
  8642. + //pass across the handle
  8643. + msg.m_tag.m_args.m_handle = handle;
  8644. +
  8645. + s = bcm_mailbox_property(&msg, sizeof(msg));
  8646. +
  8647. + if (s == 0 && msg.m_response == 0x80000000 && msg.m_tag.m_recvDataSize == 0x80000004)
  8648. + {
  8649. + //pick out the bus address
  8650. + *pBusAddress = msg.m_tag.m_args.m_busAddress;
  8651. + return 0;
  8652. + }
  8653. + else
  8654. + {
  8655. + printk(KERN_ERR "failed to lock vc memory: s=%d response=%08x recv data size=%08x\n",
  8656. + s, msg.m_response, msg.m_tag.m_recvDataSize);
  8657. + return 1;
  8658. + }
  8659. +}
  8660. +
  8661. +unsigned int UnlockVcMemory(unsigned int handle)
  8662. +{
  8663. + struct vc_msg
  8664. + {
  8665. + unsigned int m_msgSize;
  8666. + unsigned int m_response;
  8667. +
  8668. + struct vc_tag
  8669. + {
  8670. + unsigned int m_tagId;
  8671. + unsigned int m_sendBufferSize;
  8672. + union {
  8673. + unsigned int m_sendDataSize;
  8674. + unsigned int m_recvDataSize;
  8675. + };
  8676. +
  8677. + struct args
  8678. + {
  8679. + union {
  8680. + unsigned int m_handle;
  8681. + unsigned int m_error;
  8682. + };
  8683. + } m_args;
  8684. + } m_tag;
  8685. +
  8686. + unsigned int m_endTag;
  8687. + } msg;
  8688. + int s;
  8689. +
  8690. + msg.m_msgSize = sizeof(msg);
  8691. + msg.m_response = 0;
  8692. + msg.m_endTag = 0;
  8693. +
  8694. + //fill in the tag for the unlock command
  8695. + msg.m_tag.m_tagId = 0x3000e;
  8696. + msg.m_tag.m_sendBufferSize = 4;
  8697. + msg.m_tag.m_sendDataSize = 4;
  8698. +
  8699. + //pass across the handle
  8700. + msg.m_tag.m_args.m_handle = handle;
  8701. +
  8702. + s = bcm_mailbox_property(&msg, sizeof(msg));
  8703. +
  8704. + //check the error code too
  8705. + if (s == 0 && msg.m_response == 0x80000000 && msg.m_tag.m_recvDataSize == 0x80000004 && msg.m_tag.m_args.m_error == 0)
  8706. + return 0;
  8707. + else
  8708. + {
  8709. + printk(KERN_ERR "failed to unlock vc memory: s=%d response=%08x recv data size=%08x error%08x\n",
  8710. + s, msg.m_response, msg.m_tag.m_recvDataSize, msg.m_tag.m_args.m_error);
  8711. + return 1;
  8712. + }
  8713. +}
  8714. +
  8715. +unsigned int ExecuteVcCode(unsigned int code,
  8716. + unsigned int r0, unsigned int r1, unsigned int r2, unsigned int r3, unsigned int r4, unsigned int r5)
  8717. +{
  8718. + struct vc_msg
  8719. + {
  8720. + unsigned int m_msgSize;
  8721. + unsigned int m_response;
  8722. +
  8723. + struct vc_tag
  8724. + {
  8725. + unsigned int m_tagId;
  8726. + unsigned int m_sendBufferSize;
  8727. + union {
  8728. + unsigned int m_sendDataSize;
  8729. + unsigned int m_recvDataSize;
  8730. + };
  8731. +
  8732. + struct args
  8733. + {
  8734. + union {
  8735. + unsigned int m_pCode;
  8736. + unsigned int m_return;
  8737. + };
  8738. + unsigned int m_r0;
  8739. + unsigned int m_r1;
  8740. + unsigned int m_r2;
  8741. + unsigned int m_r3;
  8742. + unsigned int m_r4;
  8743. + unsigned int m_r5;
  8744. + } m_args;
  8745. + } m_tag;
  8746. +
  8747. + unsigned int m_endTag;
  8748. + } msg;
  8749. + int s;
  8750. +
  8751. + msg.m_msgSize = sizeof(msg);
  8752. + msg.m_response = 0;
  8753. + msg.m_endTag = 0;
  8754. +
  8755. + //fill in the tag for the unlock command
  8756. + msg.m_tag.m_tagId = 0x30010;
  8757. + msg.m_tag.m_sendBufferSize = 28;
  8758. + msg.m_tag.m_sendDataSize = 28;
  8759. +
  8760. + //pass across the handle
  8761. + msg.m_tag.m_args.m_pCode = code;
  8762. + msg.m_tag.m_args.m_r0 = r0;
  8763. + msg.m_tag.m_args.m_r1 = r1;
  8764. + msg.m_tag.m_args.m_r2 = r2;
  8765. + msg.m_tag.m_args.m_r3 = r3;
  8766. + msg.m_tag.m_args.m_r4 = r4;
  8767. + msg.m_tag.m_args.m_r5 = r5;
  8768. +
  8769. + s = bcm_mailbox_property(&msg, sizeof(msg));
  8770. +
  8771. + //check the error code too
  8772. + if (s == 0 && msg.m_response == 0x80000000 && msg.m_tag.m_recvDataSize == 0x80000004)
  8773. + return msg.m_tag.m_args.m_return;
  8774. + else
  8775. + {
  8776. + printk(KERN_ERR "failed to execute: s=%d response=%08x recv data size=%08x\n",
  8777. + s, msg.m_response, msg.m_tag.m_recvDataSize);
  8778. + return 1;
  8779. + }
  8780. +}
  8781. --- /dev/null
  8782. +++ b/arch/arm/mach-bcm2709/vcio.c
  8783. @@ -0,0 +1,474 @@
  8784. +/*
  8785. + * linux/arch/arm/mach-bcm2708/vcio.c
  8786. + *
  8787. + * Copyright (C) 2010 Broadcom
  8788. + *
  8789. + * This program is free software; you can redistribute it and/or modify
  8790. + * it under the terms of the GNU General Public License version 2 as
  8791. + * published by the Free Software Foundation.
  8792. + *
  8793. + * This device provides a shared mechanism for writing to the mailboxes,
  8794. + * semaphores, doorbells etc. that are shared between the ARM and the
  8795. + * VideoCore processor
  8796. + */
  8797. +
  8798. +#if defined(CONFIG_SERIAL_BCM_MBOX_CONSOLE) && defined(CONFIG_MAGIC_SYSRQ)
  8799. +#define SUPPORT_SYSRQ
  8800. +#endif
  8801. +
  8802. +#include <linux/module.h>
  8803. +#include <linux/console.h>
  8804. +#include <linux/serial_core.h>
  8805. +#include <linux/serial.h>
  8806. +#include <linux/errno.h>
  8807. +#include <linux/device.h>
  8808. +#include <linux/init.h>
  8809. +#include <linux/mm.h>
  8810. +#include <linux/dma-mapping.h>
  8811. +#include <linux/platform_device.h>
  8812. +#include <linux/sysrq.h>
  8813. +#include <linux/delay.h>
  8814. +#include <linux/slab.h>
  8815. +#include <linux/interrupt.h>
  8816. +#include <linux/irq.h>
  8817. +
  8818. +#include <linux/io.h>
  8819. +
  8820. +#include <mach/vcio.h>
  8821. +#include <mach/platform.h>
  8822. +
  8823. +#include <asm/uaccess.h>
  8824. +
  8825. +
  8826. +#define DRIVER_NAME BCM_VCIO_DRIVER_NAME
  8827. +
  8828. +/* ----------------------------------------------------------------------
  8829. + * Mailbox
  8830. + * -------------------------------------------------------------------- */
  8831. +
  8832. +/* offsets from a mail box base address */
  8833. +#define MAIL_WRT 0x00 /* write - and next 4 words */
  8834. +#define MAIL_RD 0x00 /* read - and next 4 words */
  8835. +#define MAIL_POL 0x10 /* read without popping the fifo */
  8836. +#define MAIL_SND 0x14 /* sender ID (bottom two bits) */
  8837. +#define MAIL_STA 0x18 /* status */
  8838. +#define MAIL_CNF 0x1C /* configuration */
  8839. +
  8840. +#define MBOX_MSG(chan, data28) (((data28) & ~0xf) | ((chan) & 0xf))
  8841. +#define MBOX_MSG_LSB(chan, data28) (((data28) << 4) | ((chan) & 0xf))
  8842. +#define MBOX_CHAN(msg) ((msg) & 0xf)
  8843. +#define MBOX_DATA28(msg) ((msg) & ~0xf)
  8844. +#define MBOX_DATA28_LSB(msg) (((uint32_t)msg) >> 4)
  8845. +
  8846. +#define MBOX_MAGIC 0xd0d0c0de
  8847. +
  8848. +struct vc_mailbox {
  8849. + struct device *dev; /* parent device */
  8850. + void __iomem *status;
  8851. + void __iomem *config;
  8852. + void __iomem *read;
  8853. + void __iomem *write;
  8854. + uint32_t msg[MBOX_CHAN_COUNT];
  8855. + struct semaphore sema[MBOX_CHAN_COUNT];
  8856. + uint32_t magic;
  8857. +};
  8858. +
  8859. +static void mbox_init(struct vc_mailbox *mbox_out, struct device *dev,
  8860. + uint32_t addr_mbox)
  8861. +{
  8862. + int i;
  8863. +
  8864. + mbox_out->dev = dev;
  8865. + mbox_out->status = __io_address(addr_mbox + MAIL_STA);
  8866. + mbox_out->config = __io_address(addr_mbox + MAIL_CNF);
  8867. + mbox_out->read = __io_address(addr_mbox + MAIL_RD);
  8868. + /* Write to the other mailbox */
  8869. + mbox_out->write =
  8870. + __io_address((addr_mbox ^ ARM_0_MAIL0_WRT ^ ARM_0_MAIL1_WRT) +
  8871. + MAIL_WRT);
  8872. +
  8873. + for (i = 0; i < MBOX_CHAN_COUNT; i++) {
  8874. + mbox_out->msg[i] = 0;
  8875. + sema_init(&mbox_out->sema[i], 0);
  8876. + }
  8877. +
  8878. + /* Enable the interrupt on data reception */
  8879. + writel(ARM_MC_IHAVEDATAIRQEN, mbox_out->config);
  8880. +
  8881. + mbox_out->magic = MBOX_MAGIC;
  8882. +}
  8883. +
  8884. +static int mbox_write(struct vc_mailbox *mbox, unsigned chan, uint32_t data28)
  8885. +{
  8886. + int rc;
  8887. +
  8888. + if (mbox->magic != MBOX_MAGIC)
  8889. + rc = -EINVAL;
  8890. + else {
  8891. + /* wait for the mailbox FIFO to have some space in it */
  8892. + while (0 != (readl(mbox->status) & ARM_MS_FULL))
  8893. + cpu_relax();
  8894. +
  8895. + writel(MBOX_MSG(chan, data28), mbox->write);
  8896. + rc = 0;
  8897. + }
  8898. + return rc;
  8899. +}
  8900. +
  8901. +static int mbox_read(struct vc_mailbox *mbox, unsigned chan, uint32_t *data28)
  8902. +{
  8903. + int rc;
  8904. +
  8905. + if (mbox->magic != MBOX_MAGIC)
  8906. + rc = -EINVAL;
  8907. + else {
  8908. + down(&mbox->sema[chan]);
  8909. + *data28 = MBOX_DATA28(mbox->msg[chan]);
  8910. + mbox->msg[chan] = 0;
  8911. + rc = 0;
  8912. + }
  8913. + return rc;
  8914. +}
  8915. +
  8916. +static irqreturn_t mbox_irq(int irq, void *dev_id)
  8917. +{
  8918. + /* wait for the mailbox FIFO to have some data in it */
  8919. + struct vc_mailbox *mbox = (struct vc_mailbox *) dev_id;
  8920. + int status = readl(mbox->status);
  8921. + int ret = IRQ_NONE;
  8922. +
  8923. + while (!(status & ARM_MS_EMPTY)) {
  8924. + uint32_t msg = readl(mbox->read);
  8925. + int chan = MBOX_CHAN(msg);
  8926. + if (chan < MBOX_CHAN_COUNT) {
  8927. + if (mbox->msg[chan]) {
  8928. + /* Overflow */
  8929. + printk(KERN_ERR DRIVER_NAME
  8930. + ": mbox chan %d overflow - drop %08x\n",
  8931. + chan, msg);
  8932. + } else {
  8933. + mbox->msg[chan] = (msg | 0xf);
  8934. + up(&mbox->sema[chan]);
  8935. + }
  8936. + } else {
  8937. + printk(KERN_ERR DRIVER_NAME
  8938. + ": invalid channel selector (msg %08x)\n", msg);
  8939. + }
  8940. + ret = IRQ_HANDLED;
  8941. + status = readl(mbox->status);
  8942. + }
  8943. + return ret;
  8944. +}
  8945. +
  8946. +static struct irqaction mbox_irqaction = {
  8947. + .name = "ARM Mailbox IRQ",
  8948. + .flags = IRQF_DISABLED | IRQF_IRQPOLL,
  8949. + .handler = mbox_irq,
  8950. +};
  8951. +
  8952. +/* ----------------------------------------------------------------------
  8953. + * Mailbox Methods
  8954. + * -------------------------------------------------------------------- */
  8955. +
  8956. +static struct device *mbox_dev; /* we assume there's only one! */
  8957. +
  8958. +static int dev_mbox_write(struct device *dev, unsigned chan, uint32_t data28)
  8959. +{
  8960. + int rc;
  8961. +
  8962. + struct vc_mailbox *mailbox = dev_get_drvdata(dev);
  8963. + device_lock(dev);
  8964. + rc = mbox_write(mailbox, chan, data28);
  8965. + device_unlock(dev);
  8966. +
  8967. + return rc;
  8968. +}
  8969. +
  8970. +static int dev_mbox_read(struct device *dev, unsigned chan, uint32_t *data28)
  8971. +{
  8972. + int rc;
  8973. +
  8974. + struct vc_mailbox *mailbox = dev_get_drvdata(dev);
  8975. + device_lock(dev);
  8976. + rc = mbox_read(mailbox, chan, data28);
  8977. + device_unlock(dev);
  8978. +
  8979. + return rc;
  8980. +}
  8981. +
  8982. +extern int bcm_mailbox_write(unsigned chan, uint32_t data28)
  8983. +{
  8984. + if (mbox_dev)
  8985. + return dev_mbox_write(mbox_dev, chan, data28);
  8986. + else
  8987. + return -ENODEV;
  8988. +}
  8989. +EXPORT_SYMBOL_GPL(bcm_mailbox_write);
  8990. +
  8991. +extern int bcm_mailbox_read(unsigned chan, uint32_t *data28)
  8992. +{
  8993. + if (mbox_dev)
  8994. + return dev_mbox_read(mbox_dev, chan, data28);
  8995. + else
  8996. + return -ENODEV;
  8997. +}
  8998. +EXPORT_SYMBOL_GPL(bcm_mailbox_read);
  8999. +
  9000. +static void dev_mbox_register(const char *dev_name, struct device *dev)
  9001. +{
  9002. + mbox_dev = dev;
  9003. +}
  9004. +
  9005. +static int mbox_copy_from_user(void *dst, const void *src, int size)
  9006. +{
  9007. + if ( (uint32_t)src < TASK_SIZE)
  9008. + {
  9009. + return copy_from_user(dst, src, size);
  9010. + }
  9011. + else
  9012. + {
  9013. + memcpy( dst, src, size );
  9014. + return 0;
  9015. + }
  9016. +}
  9017. +
  9018. +static int mbox_copy_to_user(void *dst, const void *src, int size)
  9019. +{
  9020. + if ( (uint32_t)dst < TASK_SIZE)
  9021. + {
  9022. + return copy_to_user(dst, src, size);
  9023. + }
  9024. + else
  9025. + {
  9026. + memcpy( dst, src, size );
  9027. + return 0;
  9028. + }
  9029. +}
  9030. +
  9031. +static DEFINE_MUTEX(mailbox_lock);
  9032. +extern int bcm_mailbox_property(void *data, int size)
  9033. +{
  9034. + uint32_t success;
  9035. + dma_addr_t mem_bus; /* the memory address accessed from videocore */
  9036. + void *mem_kern; /* the memory address accessed from driver */
  9037. + int s = 0;
  9038. +
  9039. + mutex_lock(&mailbox_lock);
  9040. + /* allocate some memory for the messages communicating with GPU */
  9041. + mem_kern = dma_alloc_coherent(NULL, PAGE_ALIGN(size), &mem_bus, GFP_ATOMIC);
  9042. + if (mem_kern) {
  9043. + /* create the message */
  9044. + mbox_copy_from_user(mem_kern, data, size);
  9045. +
  9046. + /* send the message */
  9047. + wmb();
  9048. + s = bcm_mailbox_write(MBOX_CHAN_PROPERTY, (uint32_t)mem_bus);
  9049. + if (s == 0) {
  9050. + s = bcm_mailbox_read(MBOX_CHAN_PROPERTY, &success);
  9051. + }
  9052. + if (s == 0) {
  9053. + /* copy the response */
  9054. + rmb();
  9055. + mbox_copy_to_user(data, mem_kern, size);
  9056. + }
  9057. + dma_free_coherent(NULL, PAGE_ALIGN(size), mem_kern, mem_bus);
  9058. + } else {
  9059. + s = -ENOMEM;
  9060. + }
  9061. + if (s != 0)
  9062. + printk(KERN_ERR DRIVER_NAME ": %s failed (%d)\n", __func__, s);
  9063. +
  9064. + mutex_unlock(&mailbox_lock);
  9065. + return s;
  9066. +}
  9067. +EXPORT_SYMBOL_GPL(bcm_mailbox_property);
  9068. +
  9069. +/* ----------------------------------------------------------------------
  9070. + * Platform Device for Mailbox
  9071. + * -------------------------------------------------------------------- */
  9072. +
  9073. +/*
  9074. + * Is the device open right now? Used to prevent
  9075. + * concurent access into the same device
  9076. + */
  9077. +static int Device_Open = 0;
  9078. +
  9079. +/*
  9080. + * This is called whenever a process attempts to open the device file
  9081. + */
  9082. +static int device_open(struct inode *inode, struct file *file)
  9083. +{
  9084. + /*
  9085. + * We don't want to talk to two processes at the same time
  9086. + */
  9087. + if (Device_Open)
  9088. + return -EBUSY;
  9089. +
  9090. + Device_Open++;
  9091. + /*
  9092. + * Initialize the message
  9093. + */
  9094. + try_module_get(THIS_MODULE);
  9095. + return 0;
  9096. +}
  9097. +
  9098. +static int device_release(struct inode *inode, struct file *file)
  9099. +{
  9100. + /*
  9101. + * We're now ready for our next caller
  9102. + */
  9103. + Device_Open--;
  9104. +
  9105. + module_put(THIS_MODULE);
  9106. + return 0;
  9107. +}
  9108. +
  9109. +/*
  9110. + * This function is called whenever a process tries to do an ioctl on our
  9111. + * device file. We get two extra parameters (additional to the inode and file
  9112. + * structures, which all device functions get): the number of the ioctl called
  9113. + * and the parameter given to the ioctl function.
  9114. + *
  9115. + * If the ioctl is write or read/write (meaning output is returned to the
  9116. + * calling process), the ioctl call returns the output of this function.
  9117. + *
  9118. + */
  9119. +static long device_ioctl(struct file *file, /* see include/linux/fs.h */
  9120. + unsigned int ioctl_num, /* number and param for ioctl */
  9121. + unsigned long ioctl_param)
  9122. +{
  9123. + unsigned size;
  9124. + /*
  9125. + * Switch according to the ioctl called
  9126. + */
  9127. + switch (ioctl_num) {
  9128. + case IOCTL_MBOX_PROPERTY:
  9129. + /*
  9130. + * Receive a pointer to a message (in user space) and set that
  9131. + * to be the device's message. Get the parameter given to
  9132. + * ioctl by the process.
  9133. + */
  9134. + mbox_copy_from_user(&size, (void *)ioctl_param, sizeof size);
  9135. + return bcm_mailbox_property((void *)ioctl_param, size);
  9136. + break;
  9137. + default:
  9138. + printk(KERN_ERR DRIVER_NAME "unknown ioctl: %d\n", ioctl_num);
  9139. + return -EINVAL;
  9140. + }
  9141. +
  9142. + return 0;
  9143. +}
  9144. +
  9145. +/* Module Declarations */
  9146. +
  9147. +/*
  9148. + * This structure will hold the functions to be called
  9149. + * when a process does something to the device we
  9150. + * created. Since a pointer to this structure is kept in
  9151. + * the devices table, it can't be local to
  9152. + * init_module. NULL is for unimplemented functios.
  9153. + */
  9154. +struct file_operations fops = {
  9155. + .unlocked_ioctl = device_ioctl,
  9156. + .open = device_open,
  9157. + .release = device_release, /* a.k.a. close */
  9158. +};
  9159. +
  9160. +static int bcm_vcio_probe(struct platform_device *pdev)
  9161. +{
  9162. + int ret = 0;
  9163. + struct vc_mailbox *mailbox;
  9164. +
  9165. + mailbox = kzalloc(sizeof(*mailbox), GFP_KERNEL);
  9166. + if (NULL == mailbox) {
  9167. + printk(KERN_ERR DRIVER_NAME ": failed to allocate "
  9168. + "mailbox memory\n");
  9169. + ret = -ENOMEM;
  9170. + } else {
  9171. + struct resource *res;
  9172. +
  9173. + res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
  9174. + if (res == NULL) {
  9175. + printk(KERN_ERR DRIVER_NAME ": failed to obtain memory "
  9176. + "resource\n");
  9177. + ret = -ENODEV;
  9178. + kfree(mailbox);
  9179. + } else {
  9180. + /* should be based on the registers from res really */
  9181. + mbox_init(mailbox, &pdev->dev, ARM_0_MAIL0_RD);
  9182. +
  9183. + platform_set_drvdata(pdev, mailbox);
  9184. + dev_mbox_register(DRIVER_NAME, &pdev->dev);
  9185. +
  9186. + mbox_irqaction.dev_id = mailbox;
  9187. + setup_irq(IRQ_ARM_MAILBOX, &mbox_irqaction);
  9188. + printk(KERN_INFO DRIVER_NAME ": mailbox at %p\n",
  9189. + __io_address(ARM_0_MAIL0_RD));
  9190. + }
  9191. + }
  9192. +
  9193. + if (ret == 0) {
  9194. + /*
  9195. + * Register the character device
  9196. + */
  9197. + ret = register_chrdev(MAJOR_NUM, DEVICE_FILE_NAME, &fops);
  9198. +
  9199. + /*
  9200. + * Negative values signify an error
  9201. + */
  9202. + if (ret < 0) {
  9203. + printk(KERN_ERR DRIVER_NAME
  9204. + "Failed registering the character device %d\n", ret);
  9205. + return ret;
  9206. + }
  9207. + }
  9208. + return ret;
  9209. +}
  9210. +
  9211. +static int bcm_vcio_remove(struct platform_device *pdev)
  9212. +{
  9213. + struct vc_mailbox *mailbox = platform_get_drvdata(pdev);
  9214. +
  9215. + platform_set_drvdata(pdev, NULL);
  9216. + kfree(mailbox);
  9217. +
  9218. + return 0;
  9219. +}
  9220. +
  9221. +static struct platform_driver bcm_mbox_driver = {
  9222. + .probe = bcm_vcio_probe,
  9223. + .remove = bcm_vcio_remove,
  9224. +
  9225. + .driver = {
  9226. + .name = DRIVER_NAME,
  9227. + .owner = THIS_MODULE,
  9228. + },
  9229. +};
  9230. +
  9231. +static int __init bcm_mbox_init(void)
  9232. +{
  9233. + int ret;
  9234. +
  9235. + printk(KERN_INFO "mailbox: Broadcom VideoCore Mailbox driver\n");
  9236. +
  9237. + ret = platform_driver_register(&bcm_mbox_driver);
  9238. + if (ret != 0) {
  9239. + printk(KERN_ERR DRIVER_NAME ": failed to register "
  9240. + "on platform\n");
  9241. + }
  9242. +
  9243. + return ret;
  9244. +}
  9245. +
  9246. +static void __exit bcm_mbox_exit(void)
  9247. +{
  9248. + platform_driver_unregister(&bcm_mbox_driver);
  9249. +}
  9250. +
  9251. +arch_initcall(bcm_mbox_init); /* Initialize early */
  9252. +module_exit(bcm_mbox_exit);
  9253. +
  9254. +MODULE_AUTHOR("Gray Girling");
  9255. +MODULE_DESCRIPTION("ARM I/O to VideoCore processor");
  9256. +MODULE_LICENSE("GPL");
  9257. +MODULE_ALIAS("platform:bcm-mbox");
  9258. --- a/arch/arm/mm/proc-v7.S
  9259. +++ b/arch/arm/mm/proc-v7.S
  9260. @@ -441,6 +441,7 @@ __v7_setup:
  9261. orr r0, r0, r6 @ set them
  9262. THUMB( orr r0, r0, #1 << 30 ) @ Thumb exceptions
  9263. ret lr @ return to head.S:__ret
  9264. + .space 256
  9265. ENDPROC(__v7_setup)
  9266. .align 2
  9267. --- a/arch/arm/tools/mach-types
  9268. +++ b/arch/arm/tools/mach-types
  9269. @@ -523,6 +523,7 @@ prima2_evb MACH_PRIMA2_EVB PRIMA2_EVB
  9270. paz00 MACH_PAZ00 PAZ00 3128
  9271. acmenetusfoxg20 MACH_ACMENETUSFOXG20 ACMENETUSFOXG20 3129
  9272. bcm2708 MACH_BCM2708 BCM2708 3138
  9273. +bcm2709 MACH_BCM2709 BCM2709 3139
  9274. ag5evm MACH_AG5EVM AG5EVM 3189
  9275. ics_if_voip MACH_ICS_IF_VOIP ICS_IF_VOIP 3206
  9276. wlf_cragg_6410 MACH_WLF_CRAGG_6410 WLF_CRAGG_6410 3207
  9277. --- a/drivers/char/hw_random/Kconfig
  9278. +++ b/drivers/char/hw_random/Kconfig
  9279. @@ -322,7 +322,7 @@ config HW_RANDOM_TPM
  9280. config HW_RANDOM_BCM2708
  9281. tristate "BCM2708 generic true random number generator support"
  9282. - depends on HW_RANDOM && ARCH_BCM2708
  9283. + depends on HW_RANDOM && (ARCH_BCM2708 || ARCH_BCM2709)
  9284. ---help---
  9285. This driver provides the kernel-side support for the BCM2708 hardware.
  9286. --- a/drivers/clocksource/arm_arch_timer.c
  9287. +++ b/drivers/clocksource/arm_arch_timer.c
  9288. @@ -795,3 +795,39 @@ static void __init arch_timer_mem_init(s
  9289. }
  9290. CLOCKSOURCE_OF_DECLARE(armv7_arch_timer_mem, "arm,armv7-timer-mem",
  9291. arch_timer_mem_init);
  9292. +
  9293. +int __init dc4_arch_timer_init(void)
  9294. +{
  9295. + if (arch_timers_present & ARCH_CP15_TIMER) {
  9296. + pr_warn("arch_timer: multiple nodes in dt, skipping\n");
  9297. + return -1;
  9298. + }
  9299. +
  9300. + arch_timers_present |= ARCH_CP15_TIMER;
  9301. +
  9302. + /* Try to determine the frequency from the device tree or CNTFRQ */
  9303. + arch_timer_rate = 19200000;
  9304. +
  9305. + arch_timer_ppi[PHYS_SECURE_PPI] = IRQ_ARM_LOCAL_CNTPSIRQ;
  9306. + arch_timer_ppi[PHYS_NONSECURE_PPI] = IRQ_ARM_LOCAL_CNTPNSIRQ;
  9307. + arch_timer_ppi[VIRT_PPI] = IRQ_ARM_LOCAL_CNTVIRQ;
  9308. + arch_timer_ppi[HYP_PPI] = IRQ_ARM_LOCAL_CNTHPIRQ;
  9309. +
  9310. + /*
  9311. + * If HYP mode is available, we know that the physical timer
  9312. + * has been configured to be accessible from PL1. Use it, so
  9313. + * that a guest can use the virtual timer instead.
  9314. + *
  9315. + * If no interrupt provided for virtual timer, we'll have to
  9316. + * stick to the physical timer. It'd better be accessible...
  9317. + */
  9318. + if (is_hyp_mode_available() || !arch_timer_ppi[VIRT_PPI]) {
  9319. + arch_timer_use_virtual = false;
  9320. + }
  9321. +
  9322. + arch_timer_c3stop = 0;
  9323. +
  9324. + arch_timer_register();
  9325. + arch_timer_common_init();
  9326. + return 0;
  9327. +}
  9328. --- a/drivers/dma/Kconfig
  9329. +++ b/drivers/dma/Kconfig
  9330. @@ -332,7 +332,7 @@ config DMA_BCM2835
  9331. config DMA_BCM2708
  9332. tristate "BCM2708 DMA engine support"
  9333. - depends on MACH_BCM2708
  9334. + depends on MACH_BCM2708 || MACH_BCM2709
  9335. select DMA_ENGINE
  9336. select DMA_VIRTUAL_CHANNELS
  9337. --- a/drivers/i2c/busses/Kconfig
  9338. +++ b/drivers/i2c/busses/Kconfig
  9339. @@ -362,7 +362,7 @@ config I2C_AXXIA
  9340. config I2C_BCM2835
  9341. tristate "Broadcom BCM2835 I2C controller"
  9342. - depends on ARCH_BCM2835 || ARCH_BCM2708
  9343. + depends on ARCH_BCM2835 || ARCH_BCM2708 || ARCH_BCM2709
  9344. help
  9345. If you say yes to this option, support will be included for the
  9346. BCM2835 I2C controller.
  9347. @@ -374,7 +374,7 @@ config I2C_BCM2835
  9348. config I2C_BCM2708
  9349. tristate "BCM2708 BSC"
  9350. - depends on MACH_BCM2708
  9351. + depends on MACH_BCM2708 || MACH_BCM2709
  9352. help
  9353. Enabling this option will add BSC (Broadcom Serial Controller)
  9354. support for the BCM2708. BSC is a Broadcom proprietary bus compatible
  9355. --- a/drivers/media/platform/bcm2835/Kconfig
  9356. +++ b/drivers/media/platform/bcm2835/Kconfig
  9357. @@ -2,7 +2,7 @@
  9358. config VIDEO_BCM2835
  9359. bool "Broadcom BCM2835 camera interface driver"
  9360. - depends on VIDEO_V4L2 && ARCH_BCM2708
  9361. + depends on VIDEO_V4L2 && (ARCH_BCM2708 || ARCH_BCM2709)
  9362. ---help---
  9363. Say Y here to enable camera host interface devices for
  9364. Broadcom BCM2835 SoC. This operates over the VCHIQ interface
  9365. --- a/drivers/misc/vc04_services/Kconfig
  9366. +++ b/drivers/misc/vc04_services/Kconfig
  9367. @@ -1,6 +1,6 @@
  9368. config BCM2708_VCHIQ
  9369. tristate "Videocore VCHIQ"
  9370. - depends on MACH_BCM2708
  9371. + depends on MACH_BCM2708 || MACH_BCM2709
  9372. default y
  9373. help
  9374. Kernel to VideoCore communication interface for the
  9375. --- a/drivers/misc/vc04_services/Makefile
  9376. +++ b/drivers/misc/vc04_services/Makefile
  9377. @@ -1,5 +1,3 @@
  9378. -ifeq ($(CONFIG_MACH_BCM2708),y)
  9379. -
  9380. obj-$(CONFIG_BCM2708_VCHIQ) += vchiq.o
  9381. vchiq-objs := \
  9382. @@ -14,4 +12,3 @@ vchiq-objs := \
  9383. ccflags-y += -DVCOS_VERIFY_BKPTS=1 -Idrivers/misc/vc04_services -DUSE_VCHIQ_ARM -D__VCCOREVER__=0x04000000
  9384. -endif
  9385. --- a/drivers/mmc/host/Kconfig
  9386. +++ b/drivers/mmc/host/Kconfig
  9387. @@ -304,7 +304,7 @@ config MMC_SDHCI_ST
  9388. config MMC_BCM2835
  9389. tristate "MMC support on BCM2835"
  9390. - depends on MACH_BCM2708
  9391. + depends on (MACH_BCM2708 || MACH_BCM2709)
  9392. help
  9393. This selects the MMC Interface on BCM2835.
  9394. --- a/drivers/spi/Kconfig
  9395. +++ b/drivers/spi/Kconfig
  9396. @@ -77,7 +77,7 @@ config SPI_ATMEL
  9397. config SPI_BCM2835
  9398. tristate "BCM2835 SPI controller"
  9399. - depends on ARCH_BCM2835 || ARCH_BCM2708 || COMPILE_TEST
  9400. + depends on ARCH_BCM2835 || ARCH_BCM2708 || ARCH_BCM2709 || COMPILE_TEST
  9401. help
  9402. This selects a driver for the Broadcom BCM2835 SPI master.
  9403. @@ -88,7 +88,7 @@ config SPI_BCM2835
  9404. config SPI_BCM2708
  9405. tristate "BCM2708 SPI controller driver (SPI0)"
  9406. - depends on MACH_BCM2708
  9407. + depends on MACH_BCM2708 || MACH_BCM2709
  9408. help
  9409. This selects a driver for the Broadcom BCM2708 SPI master (SPI0). This
  9410. driver is not compatible with the "Universal SPI Master" or the SPI slave
  9411. --- a/drivers/watchdog/Kconfig
  9412. +++ b/drivers/watchdog/Kconfig
  9413. @@ -454,7 +454,7 @@ config RETU_WATCHDOG
  9414. config BCM2708_WDT
  9415. tristate "BCM2708 Watchdog"
  9416. - depends on ARCH_BCM2708
  9417. + depends on ARCH_BCM2708 || ARCH_BCM2709
  9418. help
  9419. Enables BCM2708 watchdog support.
  9420. --- a/sound/arm/Kconfig
  9421. +++ b/sound/arm/Kconfig
  9422. @@ -42,7 +42,7 @@ config SND_PXA2XX_AC97
  9423. config SND_BCM2835
  9424. tristate "BCM2835 ALSA driver"
  9425. - depends on ARCH_BCM2708 && BCM2708_VCHIQ && SND
  9426. + depends on (ARCH_BCM2708 || ARCH_BCM2709) && BCM2708_VCHIQ && SND
  9427. select SND_PCM
  9428. help
  9429. Say Y or M if you want to support BCM2835 Alsa pcm card driver
  9430. --- a/sound/soc/bcm/Kconfig
  9431. +++ b/sound/soc/bcm/Kconfig
  9432. @@ -10,7 +10,7 @@ config SND_BCM2835_SOC_I2S
  9433. config SND_BCM2708_SOC_I2S
  9434. tristate "SoC Audio support for the Broadcom BCM2708 I2S module"
  9435. - depends on MACH_BCM2708
  9436. + depends on MACH_BCM2708 || MACH_BCM2709
  9437. select REGMAP_MMIO
  9438. select SND_SOC_DMAENGINE_PCM
  9439. select SND_SOC_GENERIC_DMAENGINE_PCM