0001-Main-bcm2708-linux-port.patch 157 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188318931903191319231933194319531963197319831993200320132023203320432053206320732083209321032113212321332143215321632173218321932203221322232233224322532263227322832293230323132323233323432353236323732383239324032413242324332443245324632473248324932503251325232533254325532563257325832593260326132623263326432653266326732683269327032713272327332743275327632773278327932803281328232833284328532863287328832893290329132923293329432953296329732983299330033013302330333043305330633073308330933103311331233133314331533163317331833193320332133223323332433253326332733283329333033313332333333343335333633373338333933403341334233433344334533463347334833493350335133523353335433553356335733583359336033613362336333643365336633673368336933703371337233733374337533763377337833793380338133823383338433853386338733883389339033913392339333943395339633973398339934003401340234033404340534063407340834093410341134123413341434153416341734183419342034213422342334243425342634273428342934303431343234333434343534363437343834393440344134423443344434453446344734483449345034513452345334543455345634573458345934603461346234633464346534663467346834693470347134723473347434753476347734783479348034813482348334843485348634873488348934903491349234933494349534963497349834993500350135023503350435053506350735083509351035113512351335143515351635173518351935203521352235233524352535263527352835293530353135323533353435353536353735383539354035413542354335443545354635473548354935503551355235533554355535563557355835593560356135623563356435653566356735683569357035713572357335743575357635773578357935803581358235833584358535863587358835893590359135923593359435953596359735983599360036013602360336043605360636073608360936103611361236133614361536163617361836193620362136223623362436253626362736283629363036313632363336343635363636373638363936403641364236433644364536463647364836493650365136523653365436553656365736583659366036613662366336643665366636673668366936703671367236733674367536763677367836793680368136823683368436853686368736883689369036913692369336943695369636973698369937003701370237033704370537063707370837093710371137123713371437153716371737183719372037213722372337243725372637273728372937303731373237333734373537363737373837393740374137423743374437453746374737483749375037513752375337543755375637573758375937603761376237633764376537663767376837693770377137723773377437753776377737783779378037813782378337843785378637873788378937903791379237933794379537963797379837993800380138023803380438053806380738083809381038113812381338143815381638173818381938203821382238233824382538263827382838293830383138323833383438353836383738383839384038413842384338443845384638473848384938503851385238533854385538563857385838593860386138623863386438653866386738683869387038713872387338743875387638773878387938803881388238833884388538863887388838893890389138923893389438953896389738983899390039013902390339043905390639073908390939103911391239133914391539163917391839193920392139223923392439253926392739283929393039313932393339343935393639373938393939403941394239433944394539463947394839493950395139523953395439553956395739583959396039613962396339643965396639673968396939703971397239733974397539763977397839793980398139823983398439853986398739883989399039913992399339943995399639973998399940004001400240034004400540064007400840094010401140124013401440154016401740184019402040214022402340244025402640274028402940304031403240334034403540364037403840394040404140424043404440454046404740484049405040514052405340544055405640574058405940604061406240634064406540664067406840694070407140724073407440754076407740784079408040814082408340844085408640874088408940904091409240934094409540964097409840994100410141024103410441054106410741084109411041114112411341144115411641174118411941204121412241234124412541264127412841294130413141324133413441354136413741384139414041414142414341444145414641474148414941504151415241534154415541564157415841594160416141624163416441654166416741684169417041714172417341744175417641774178417941804181418241834184418541864187418841894190419141924193419441954196419741984199420042014202420342044205420642074208420942104211421242134214421542164217421842194220422142224223422442254226422742284229423042314232423342344235423642374238423942404241424242434244424542464247424842494250425142524253425442554256425742584259426042614262426342644265426642674268426942704271427242734274427542764277427842794280428142824283428442854286428742884289429042914292429342944295429642974298429943004301430243034304430543064307430843094310431143124313431443154316431743184319432043214322432343244325432643274328432943304331433243334334433543364337433843394340434143424343434443454346434743484349435043514352435343544355435643574358435943604361436243634364436543664367436843694370437143724373437443754376437743784379438043814382438343844385438643874388438943904391439243934394439543964397439843994400440144024403440444054406440744084409441044114412441344144415441644174418441944204421442244234424442544264427442844294430443144324433443444354436443744384439444044414442444344444445444644474448444944504451445244534454445544564457445844594460446144624463446444654466446744684469447044714472447344744475447644774478447944804481448244834484448544864487448844894490449144924493449444954496449744984499450045014502450345044505450645074508450945104511451245134514451545164517451845194520452145224523452445254526452745284529453045314532453345344535453645374538453945404541454245434544454545464547454845494550455145524553455445554556455745584559456045614562456345644565456645674568456945704571457245734574457545764577457845794580458145824583458445854586458745884589459045914592459345944595459645974598459946004601460246034604460546064607460846094610461146124613461446154616461746184619462046214622462346244625462646274628462946304631463246334634463546364637463846394640464146424643464446454646464746484649465046514652465346544655465646574658465946604661466246634664466546664667466846694670467146724673467446754676467746784679468046814682468346844685468646874688468946904691469246934694469546964697469846994700470147024703470447054706470747084709471047114712471347144715471647174718471947204721472247234724472547264727472847294730473147324733473447354736473747384739474047414742474347444745474647474748474947504751475247534754475547564757475847594760476147624763476447654766476747684769477047714772477347744775477647774778477947804781478247834784478547864787478847894790479147924793479447954796479747984799480048014802480348044805480648074808480948104811481248134814481548164817481848194820482148224823482448254826482748284829483048314832483348344835483648374838483948404841484248434844484548464847484848494850485148524853485448554856485748584859486048614862486348644865486648674868486948704871487248734874487548764877487848794880488148824883488448854886488748884889489048914892489348944895489648974898489949004901490249034904490549064907490849094910491149124913491449154916491749184919492049214922492349244925492649274928492949304931493249334934493549364937493849394940494149424943494449454946494749484949495049514952495349544955495649574958495949604961496249634964496549664967496849694970497149724973497449754976497749784979498049814982498349844985498649874988498949904991499249934994499549964997499849995000500150025003
  1. From 95293790045ab4ae5c357460372dd1b57fc74f29 Mon Sep 17 00:00:00 2001
  2. From: popcornmix <popcornmix@gmail.com>
  3. Date: Sun, 12 May 2013 12:24:19 +0100
  4. Subject: [PATCH 001/114] Main bcm2708 linux port
  5. Signed-off-by: popcornmix <popcornmix@gmail.com>
  6. ---
  7. arch/arm/Kconfig | 17 +
  8. arch/arm/Kconfig.debug | 8 +
  9. arch/arm/Makefile | 1 +
  10. arch/arm/configs/bcmrpi_defconfig | 464 ++++++++++++++++
  11. arch/arm/kernel/process.c | 10 +
  12. arch/arm/mach-bcm2708/Kconfig | 26 +
  13. arch/arm/mach-bcm2708/Makefile | 6 +
  14. arch/arm/mach-bcm2708/Makefile.boot | 3 +
  15. arch/arm/mach-bcm2708/armctrl.c | 208 +++++++
  16. arch/arm/mach-bcm2708/armctrl.h | 27 +
  17. arch/arm/mach-bcm2708/bcm2708.c | 662 +++++++++++++++++++++++
  18. arch/arm/mach-bcm2708/bcm2708.h | 49 ++
  19. arch/arm/mach-bcm2708/clock.c | 61 +++
  20. arch/arm/mach-bcm2708/clock.h | 24 +
  21. arch/arm/mach-bcm2708/dma.c | 399 ++++++++++++++
  22. arch/arm/mach-bcm2708/include/mach/arm_control.h | 419 ++++++++++++++
  23. arch/arm/mach-bcm2708/include/mach/arm_power.h | 62 +++
  24. arch/arm/mach-bcm2708/include/mach/clkdev.h | 7 +
  25. arch/arm/mach-bcm2708/include/mach/debug-macro.S | 22 +
  26. arch/arm/mach-bcm2708/include/mach/dma.h | 88 +++
  27. arch/arm/mach-bcm2708/include/mach/entry-macro.S | 69 +++
  28. arch/arm/mach-bcm2708/include/mach/frc.h | 38 ++
  29. arch/arm/mach-bcm2708/include/mach/hardware.h | 28 +
  30. arch/arm/mach-bcm2708/include/mach/io.h | 27 +
  31. arch/arm/mach-bcm2708/include/mach/irqs.h | 196 +++++++
  32. arch/arm/mach-bcm2708/include/mach/memory.h | 57 ++
  33. arch/arm/mach-bcm2708/include/mach/platform.h | 228 ++++++++
  34. arch/arm/mach-bcm2708/include/mach/power.h | 26 +
  35. arch/arm/mach-bcm2708/include/mach/system.h | 38 ++
  36. arch/arm/mach-bcm2708/include/mach/timex.h | 23 +
  37. arch/arm/mach-bcm2708/include/mach/uncompress.h | 84 +++
  38. arch/arm/mach-bcm2708/include/mach/vc_mem.h | 35 ++
  39. arch/arm/mach-bcm2708/include/mach/vcio.h | 165 ++++++
  40. arch/arm/mach-bcm2708/include/mach/vmalloc.h | 20 +
  41. arch/arm/mach-bcm2708/power.c | 197 +++++++
  42. arch/arm/mach-bcm2708/vc_mem.c | 431 +++++++++++++++
  43. arch/arm/mach-bcm2708/vcio.c | 474 ++++++++++++++++
  44. arch/arm/mm/Kconfig | 2 +-
  45. arch/arm/mm/proc-v6.S | 15 +-
  46. arch/arm/tools/mach-types | 1 +
  47. drivers/tty/serial/amba-pl011.c | 2 +-
  48. include/linux/mmc/host.h | 1 +
  49. include/linux/mmc/sdhci.h | 1 +
  50. 43 files changed, 4716 insertions(+), 5 deletions(-)
  51. create mode 100644 arch/arm/configs/bcmrpi_defconfig
  52. create mode 100644 arch/arm/mach-bcm2708/Kconfig
  53. create mode 100644 arch/arm/mach-bcm2708/Makefile
  54. create mode 100644 arch/arm/mach-bcm2708/Makefile.boot
  55. create mode 100644 arch/arm/mach-bcm2708/armctrl.c
  56. create mode 100644 arch/arm/mach-bcm2708/armctrl.h
  57. create mode 100644 arch/arm/mach-bcm2708/bcm2708.c
  58. create mode 100644 arch/arm/mach-bcm2708/bcm2708.h
  59. create mode 100644 arch/arm/mach-bcm2708/clock.c
  60. create mode 100644 arch/arm/mach-bcm2708/clock.h
  61. create mode 100644 arch/arm/mach-bcm2708/dma.c
  62. create mode 100644 arch/arm/mach-bcm2708/include/mach/arm_control.h
  63. create mode 100644 arch/arm/mach-bcm2708/include/mach/arm_power.h
  64. create mode 100644 arch/arm/mach-bcm2708/include/mach/clkdev.h
  65. create mode 100644 arch/arm/mach-bcm2708/include/mach/debug-macro.S
  66. create mode 100644 arch/arm/mach-bcm2708/include/mach/dma.h
  67. create mode 100644 arch/arm/mach-bcm2708/include/mach/entry-macro.S
  68. create mode 100644 arch/arm/mach-bcm2708/include/mach/frc.h
  69. create mode 100644 arch/arm/mach-bcm2708/include/mach/hardware.h
  70. create mode 100644 arch/arm/mach-bcm2708/include/mach/io.h
  71. create mode 100644 arch/arm/mach-bcm2708/include/mach/irqs.h
  72. create mode 100644 arch/arm/mach-bcm2708/include/mach/memory.h
  73. create mode 100644 arch/arm/mach-bcm2708/include/mach/platform.h
  74. create mode 100644 arch/arm/mach-bcm2708/include/mach/power.h
  75. create mode 100644 arch/arm/mach-bcm2708/include/mach/system.h
  76. create mode 100644 arch/arm/mach-bcm2708/include/mach/timex.h
  77. create mode 100644 arch/arm/mach-bcm2708/include/mach/uncompress.h
  78. create mode 100644 arch/arm/mach-bcm2708/include/mach/vc_mem.h
  79. create mode 100644 arch/arm/mach-bcm2708/include/mach/vcio.h
  80. create mode 100644 arch/arm/mach-bcm2708/include/mach/vmalloc.h
  81. create mode 100644 arch/arm/mach-bcm2708/power.c
  82. create mode 100644 arch/arm/mach-bcm2708/vc_mem.c
  83. create mode 100644 arch/arm/mach-bcm2708/vcio.c
  84. --- a/arch/arm/Kconfig
  85. +++ b/arch/arm/Kconfig
  86. @@ -381,6 +381,22 @@ config ARCH_AT91
  87. This enables support for systems based on Atmel
  88. AT91RM9200 and AT91SAM9* processors.
  89. +config ARCH_BCM2708
  90. + bool "Broadcom BCM2708 family"
  91. + select CPU_V6
  92. + select ARM_AMBA
  93. + select HAVE_CLK
  94. + select HAVE_SCHED_CLOCK
  95. + select NEED_MACH_GPIO_H
  96. + select NEED_MACH_MEMORY_H
  97. + select CLKDEV_LOOKUP
  98. + select GENERIC_CLOCKEVENTS
  99. + select ARM_ERRATA_411920
  100. + select MACH_BCM2708
  101. + select VC4
  102. + help
  103. + This enables support for Broadcom BCM2708 boards.
  104. +
  105. config ARCH_CLPS711X
  106. bool "Cirrus Logic CLPS711x/EP721x/EP731x-based"
  107. select ARCH_REQUIRE_GPIOLIB
  108. @@ -972,6 +988,7 @@ source "arch/arm/plat-versatile/Kconfig"
  109. source "arch/arm/mach-vt8500/Kconfig"
  110. source "arch/arm/mach-w90x900/Kconfig"
  111. +source "arch/arm/mach-bcm2708/Kconfig"
  112. source "arch/arm/mach-zynq/Kconfig"
  113. --- a/arch/arm/Kconfig.debug
  114. +++ b/arch/arm/Kconfig.debug
  115. @@ -985,6 +985,14 @@ choice
  116. options; the platform specific options are deprecated
  117. and will be soon removed.
  118. + config DEBUG_BCM2708_UART0
  119. + bool "Broadcom BCM2708 UART0 (PL011)"
  120. + depends on MACH_BCM2708
  121. + help
  122. + Say Y here if you want the debug print routines to direct
  123. + their output to UART 0. The port must have been initialised
  124. + by the boot-loader before use.
  125. +
  126. endchoice
  127. config DEBUG_EXYNOS_UART
  128. --- a/arch/arm/Makefile
  129. +++ b/arch/arm/Makefile
  130. @@ -159,6 +159,7 @@ textofs-$(CONFIG_ARCH_AXXIA) := 0x003080
  131. machine-$(CONFIG_ARCH_AT91) += at91
  132. machine-$(CONFIG_ARCH_AXXIA) += axxia
  133. machine-$(CONFIG_ARCH_BCM) += bcm
  134. +machine-$(CONFIG_ARCH_BCM2708) += bcm2708
  135. machine-$(CONFIG_ARCH_BERLIN) += berlin
  136. machine-$(CONFIG_ARCH_CLPS711X) += clps711x
  137. machine-$(CONFIG_ARCH_CNS3XXX) += cns3xxx
  138. --- /dev/null
  139. +++ b/arch/arm/configs/bcmrpi_defconfig
  140. @@ -0,0 +1,464 @@
  141. +# CONFIG_LOCALVERSION_AUTO is not set
  142. +CONFIG_SYSVIPC=y
  143. +CONFIG_POSIX_MQUEUE=y
  144. +CONFIG_FHANDLE=y
  145. +CONFIG_AUDIT=y
  146. +CONFIG_NO_HZ=y
  147. +CONFIG_HIGH_RES_TIMERS=y
  148. +CONFIG_BSD_PROCESS_ACCT=y
  149. +CONFIG_BSD_PROCESS_ACCT_V3=y
  150. +CONFIG_IKCONFIG=y
  151. +CONFIG_IKCONFIG_PROC=y
  152. +CONFIG_CGROUP_FREEZER=y
  153. +CONFIG_CGROUP_DEVICE=y
  154. +CONFIG_CGROUP_CPUACCT=y
  155. +CONFIG_RESOURCE_COUNTERS=y
  156. +CONFIG_BLK_CGROUP=y
  157. +CONFIG_NAMESPACES=y
  158. +CONFIG_SCHED_AUTOGROUP=y
  159. +CONFIG_EMBEDDED=y
  160. +# CONFIG_COMPAT_BRK is not set
  161. +CONFIG_SLAB=y
  162. +CONFIG_PROFILING=y
  163. +CONFIG_OPROFILE=m
  164. +CONFIG_KPROBES=y
  165. +CONFIG_MODULES=y
  166. +CONFIG_MODULE_UNLOAD=y
  167. +CONFIG_MODVERSIONS=y
  168. +CONFIG_MODULE_SRCVERSION_ALL=y
  169. +# CONFIG_BLK_DEV_BSG is not set
  170. +CONFIG_BLK_DEV_THROTTLING=y
  171. +CONFIG_PARTITION_ADVANCED=y
  172. +CONFIG_MAC_PARTITION=y
  173. +CONFIG_CFQ_GROUP_IOSCHED=y
  174. +CONFIG_ARCH_BCM2708=y
  175. +CONFIG_AEABI=y
  176. +CONFIG_SECCOMP=y
  177. +CONFIG_ZBOOT_ROM_TEXT=0x0
  178. +CONFIG_ZBOOT_ROM_BSS=0x0
  179. +CONFIG_CMDLINE="dwc_otg.lpm_enable=0 console=ttyAMA0,115200 kgdboc=ttyAMA0,115200 root=/dev/mmcblk0p2 rootfstype=ext3 rootwait"
  180. +CONFIG_KEXEC=y
  181. +CONFIG_CPU_IDLE=y
  182. +CONFIG_VFP=y
  183. +CONFIG_BINFMT_MISC=m
  184. +CONFIG_NET=y
  185. +CONFIG_PACKET=y
  186. +CONFIG_UNIX=y
  187. +CONFIG_XFRM_USER=y
  188. +CONFIG_NET_KEY=m
  189. +CONFIG_INET=y
  190. +CONFIG_IP_MULTICAST=y
  191. +CONFIG_IP_PNP=y
  192. +CONFIG_IP_PNP_DHCP=y
  193. +CONFIG_IP_PNP_RARP=y
  194. +CONFIG_SYN_COOKIES=y
  195. +# CONFIG_INET_XFRM_MODE_TRANSPORT is not set
  196. +# CONFIG_INET_XFRM_MODE_TUNNEL is not set
  197. +# CONFIG_INET_XFRM_MODE_BEET is not set
  198. +# CONFIG_INET_LRO is not set
  199. +# CONFIG_INET_DIAG is not set
  200. +# CONFIG_IPV6 is not set
  201. +CONFIG_NET_PKTGEN=m
  202. +CONFIG_IRDA=m
  203. +CONFIG_IRLAN=m
  204. +CONFIG_IRCOMM=m
  205. +CONFIG_IRDA_ULTRA=y
  206. +CONFIG_IRDA_CACHE_LAST_LSAP=y
  207. +CONFIG_IRDA_FAST_RR=y
  208. +CONFIG_IRTTY_SIR=m
  209. +CONFIG_KINGSUN_DONGLE=m
  210. +CONFIG_KSDAZZLE_DONGLE=m
  211. +CONFIG_KS959_DONGLE=m
  212. +CONFIG_USB_IRDA=m
  213. +CONFIG_SIGMATEL_FIR=m
  214. +CONFIG_MCS_FIR=m
  215. +CONFIG_BT=m
  216. +CONFIG_BT_RFCOMM=m
  217. +CONFIG_BT_RFCOMM_TTY=y
  218. +CONFIG_BT_BNEP=m
  219. +CONFIG_BT_BNEP_MC_FILTER=y
  220. +CONFIG_BT_BNEP_PROTO_FILTER=y
  221. +CONFIG_BT_HIDP=m
  222. +CONFIG_BT_HCIBTUSB=m
  223. +CONFIG_BT_HCIBCM203X=m
  224. +CONFIG_BT_HCIBPA10X=m
  225. +CONFIG_BT_HCIBFUSB=m
  226. +CONFIG_BT_HCIVHCI=m
  227. +CONFIG_BT_MRVL=m
  228. +CONFIG_BT_MRVL_SDIO=m
  229. +CONFIG_BT_ATH3K=m
  230. +CONFIG_CFG80211=m
  231. +CONFIG_MAC80211=m
  232. +CONFIG_MAC80211_MESH=y
  233. +CONFIG_WIMAX=m
  234. +CONFIG_NET_9P=m
  235. +CONFIG_NFC=m
  236. +CONFIG_NFC_PN533=m
  237. +CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug"
  238. +CONFIG_BLK_DEV_LOOP=y
  239. +CONFIG_BLK_DEV_CRYPTOLOOP=m
  240. +CONFIG_BLK_DEV_NBD=m
  241. +CONFIG_BLK_DEV_RAM=y
  242. +CONFIG_CDROM_PKTCDVD=m
  243. +CONFIG_SCSI=y
  244. +# CONFIG_SCSI_PROC_FS is not set
  245. +CONFIG_BLK_DEV_SD=m
  246. +CONFIG_BLK_DEV_SR=m
  247. +# CONFIG_SCSI_LOWLEVEL is not set
  248. +CONFIG_MD=y
  249. +CONFIG_NETDEVICES=y
  250. +CONFIG_NETCONSOLE=m
  251. +CONFIG_TUN=m
  252. +CONFIG_MDIO_BITBANG=m
  253. +CONFIG_PPP=m
  254. +CONFIG_PPP_BSDCOMP=m
  255. +CONFIG_PPP_DEFLATE=m
  256. +CONFIG_PPP_ASYNC=m
  257. +CONFIG_PPP_SYNC_TTY=m
  258. +CONFIG_SLIP=m
  259. +CONFIG_SLIP_COMPRESSED=y
  260. +CONFIG_USB_CATC=m
  261. +CONFIG_USB_KAWETH=m
  262. +CONFIG_USB_PEGASUS=m
  263. +CONFIG_USB_RTL8150=m
  264. +CONFIG_USB_USBNET=y
  265. +CONFIG_USB_NET_AX8817X=m
  266. +CONFIG_USB_NET_CDCETHER=m
  267. +CONFIG_USB_NET_CDC_EEM=m
  268. +CONFIG_USB_NET_DM9601=m
  269. +CONFIG_USB_NET_SMSC75XX=m
  270. +CONFIG_USB_NET_SMSC95XX=y
  271. +CONFIG_USB_NET_GL620A=m
  272. +CONFIG_USB_NET_NET1080=m
  273. +CONFIG_USB_NET_PLUSB=m
  274. +CONFIG_USB_NET_MCS7830=m
  275. +CONFIG_USB_NET_CDC_SUBSET=m
  276. +CONFIG_USB_ALI_M5632=y
  277. +CONFIG_USB_AN2720=y
  278. +CONFIG_USB_KC2190=y
  279. +# CONFIG_USB_NET_ZAURUS is not set
  280. +CONFIG_USB_NET_CX82310_ETH=m
  281. +CONFIG_USB_NET_KALMIA=m
  282. +CONFIG_USB_NET_INT51X1=m
  283. +CONFIG_USB_IPHETH=m
  284. +CONFIG_USB_SIERRA_NET=m
  285. +CONFIG_USB_VL600=m
  286. +CONFIG_LIBERTAS_THINFIRM=m
  287. +CONFIG_LIBERTAS_THINFIRM_USB=m
  288. +CONFIG_AT76C50X_USB=m
  289. +CONFIG_USB_ZD1201=m
  290. +CONFIG_USB_NET_RNDIS_WLAN=m
  291. +CONFIG_RTL8187=m
  292. +CONFIG_MAC80211_HWSIM=m
  293. +CONFIG_B43=m
  294. +CONFIG_B43LEGACY=m
  295. +CONFIG_HOSTAP=m
  296. +CONFIG_LIBERTAS=m
  297. +CONFIG_LIBERTAS_USB=m
  298. +CONFIG_LIBERTAS_SDIO=m
  299. +CONFIG_P54_COMMON=m
  300. +CONFIG_P54_USB=m
  301. +CONFIG_RT2X00=m
  302. +CONFIG_RT2500USB=m
  303. +CONFIG_RT73USB=m
  304. +CONFIG_RT2800USB=m
  305. +CONFIG_RT2800USB_RT53XX=y
  306. +CONFIG_RTL8192CU=m
  307. +CONFIG_ZD1211RW=m
  308. +CONFIG_MWIFIEX=m
  309. +CONFIG_MWIFIEX_SDIO=m
  310. +CONFIG_WIMAX_I2400M_USB=m
  311. +CONFIG_INPUT_POLLDEV=m
  312. +# CONFIG_INPUT_MOUSEDEV_PSAUX is not set
  313. +CONFIG_INPUT_JOYDEV=m
  314. +CONFIG_INPUT_EVDEV=m
  315. +# CONFIG_INPUT_KEYBOARD is not set
  316. +# CONFIG_INPUT_MOUSE is not set
  317. +CONFIG_INPUT_MISC=y
  318. +CONFIG_INPUT_AD714X=m
  319. +CONFIG_INPUT_ATI_REMOTE2=m
  320. +CONFIG_INPUT_KEYSPAN_REMOTE=m
  321. +CONFIG_INPUT_POWERMATE=m
  322. +CONFIG_INPUT_YEALINK=m
  323. +CONFIG_INPUT_CM109=m
  324. +CONFIG_INPUT_UINPUT=m
  325. +CONFIG_INPUT_ADXL34X=m
  326. +CONFIG_INPUT_CMA3000=m
  327. +CONFIG_SERIO=m
  328. +CONFIG_SERIO_RAW=m
  329. +CONFIG_GAMEPORT=m
  330. +CONFIG_GAMEPORT_NS558=m
  331. +CONFIG_GAMEPORT_L4=m
  332. +# CONFIG_LEGACY_PTYS is not set
  333. +# CONFIG_DEVKMEM is not set
  334. +CONFIG_SERIAL_AMBA_PL011=y
  335. +CONFIG_SERIAL_AMBA_PL011_CONSOLE=y
  336. +# CONFIG_HW_RANDOM is not set
  337. +CONFIG_RAW_DRIVER=y
  338. +# CONFIG_HWMON is not set
  339. +CONFIG_WATCHDOG=y
  340. +CONFIG_FB=y
  341. +CONFIG_FRAMEBUFFER_CONSOLE=y
  342. +CONFIG_LOGO=y
  343. +# CONFIG_LOGO_LINUX_MONO is not set
  344. +# CONFIG_LOGO_LINUX_VGA16 is not set
  345. +CONFIG_HID_A4TECH=m
  346. +CONFIG_HID_ACRUX=m
  347. +CONFIG_HID_APPLE=m
  348. +CONFIG_HID_BELKIN=m
  349. +CONFIG_HID_CHERRY=m
  350. +CONFIG_HID_CHICONY=m
  351. +CONFIG_HID_CYPRESS=m
  352. +CONFIG_HID_DRAGONRISE=m
  353. +CONFIG_HID_EMS_FF=m
  354. +CONFIG_HID_ELECOM=m
  355. +CONFIG_HID_EZKEY=m
  356. +CONFIG_HID_HOLTEK=m
  357. +CONFIG_HID_KEYTOUCH=m
  358. +CONFIG_HID_KYE=m
  359. +CONFIG_HID_UCLOGIC=m
  360. +CONFIG_HID_WALTOP=m
  361. +CONFIG_HID_GYRATION=m
  362. +CONFIG_HID_TWINHAN=m
  363. +CONFIG_HID_KENSINGTON=m
  364. +CONFIG_HID_LCPOWER=m
  365. +CONFIG_HID_LOGITECH=m
  366. +CONFIG_HID_MAGICMOUSE=m
  367. +CONFIG_HID_MICROSOFT=m
  368. +CONFIG_HID_MONTEREY=m
  369. +CONFIG_HID_MULTITOUCH=m
  370. +CONFIG_HID_NTRIG=m
  371. +CONFIG_HID_ORTEK=m
  372. +CONFIG_HID_PANTHERLORD=m
  373. +CONFIG_HID_PETALYNX=m
  374. +CONFIG_HID_PICOLCD=m
  375. +CONFIG_HID_ROCCAT=m
  376. +CONFIG_HID_SAMSUNG=m
  377. +CONFIG_HID_SONY=m
  378. +CONFIG_HID_SPEEDLINK=m
  379. +CONFIG_HID_SUNPLUS=m
  380. +CONFIG_HID_GREENASIA=m
  381. +CONFIG_HID_SMARTJOYPLUS=m
  382. +CONFIG_HID_TOPSEED=m
  383. +CONFIG_HID_THRUSTMASTER=m
  384. +CONFIG_HID_WACOM=m
  385. +CONFIG_HID_WIIMOTE=m
  386. +CONFIG_HID_ZEROPLUS=m
  387. +CONFIG_HID_ZYDACRON=m
  388. +CONFIG_HID_PID=y
  389. +CONFIG_USB_HIDDEV=y
  390. +CONFIG_USB=y
  391. +CONFIG_USB_ANNOUNCE_NEW_DEVICES=y
  392. +CONFIG_USB_MON=m
  393. +CONFIG_USB_STORAGE=y
  394. +CONFIG_USB_STORAGE_REALTEK=m
  395. +CONFIG_USB_STORAGE_DATAFAB=m
  396. +CONFIG_USB_STORAGE_FREECOM=m
  397. +CONFIG_USB_STORAGE_ISD200=m
  398. +CONFIG_USB_STORAGE_USBAT=m
  399. +CONFIG_USB_STORAGE_SDDR09=m
  400. +CONFIG_USB_STORAGE_SDDR55=m
  401. +CONFIG_USB_STORAGE_JUMPSHOT=m
  402. +CONFIG_USB_STORAGE_ALAUDA=m
  403. +CONFIG_USB_STORAGE_ONETOUCH=m
  404. +CONFIG_USB_STORAGE_KARMA=m
  405. +CONFIG_USB_STORAGE_CYPRESS_ATACB=m
  406. +CONFIG_USB_STORAGE_ENE_UB6250=m
  407. +CONFIG_USB_UAS=m
  408. +CONFIG_USB_MDC800=m
  409. +CONFIG_USB_MICROTEK=m
  410. +CONFIG_USB_SERIAL=m
  411. +CONFIG_USB_SERIAL_GENERIC=y
  412. +CONFIG_USB_SERIAL_AIRCABLE=m
  413. +CONFIG_USB_SERIAL_ARK3116=m
  414. +CONFIG_USB_SERIAL_BELKIN=m
  415. +CONFIG_USB_SERIAL_CH341=m
  416. +CONFIG_USB_SERIAL_WHITEHEAT=m
  417. +CONFIG_USB_SERIAL_DIGI_ACCELEPORT=m
  418. +CONFIG_USB_SERIAL_CP210X=m
  419. +CONFIG_USB_SERIAL_CYPRESS_M8=m
  420. +CONFIG_USB_SERIAL_EMPEG=m
  421. +CONFIG_USB_SERIAL_FTDI_SIO=m
  422. +CONFIG_USB_SERIAL_VISOR=m
  423. +CONFIG_USB_SERIAL_IPAQ=m
  424. +CONFIG_USB_SERIAL_IR=m
  425. +CONFIG_USB_SERIAL_EDGEPORT=m
  426. +CONFIG_USB_SERIAL_EDGEPORT_TI=m
  427. +CONFIG_USB_SERIAL_GARMIN=m
  428. +CONFIG_USB_SERIAL_IPW=m
  429. +CONFIG_USB_SERIAL_IUU=m
  430. +CONFIG_USB_SERIAL_KEYSPAN_PDA=m
  431. +CONFIG_USB_SERIAL_KEYSPAN=m
  432. +CONFIG_USB_SERIAL_KLSI=m
  433. +CONFIG_USB_SERIAL_KOBIL_SCT=m
  434. +CONFIG_USB_SERIAL_MCT_U232=m
  435. +CONFIG_USB_SERIAL_MOS7720=m
  436. +CONFIG_USB_SERIAL_MOS7840=m
  437. +CONFIG_USB_SERIAL_NAVMAN=m
  438. +CONFIG_USB_SERIAL_PL2303=m
  439. +CONFIG_USB_SERIAL_OTI6858=m
  440. +CONFIG_USB_SERIAL_QCAUX=m
  441. +CONFIG_USB_SERIAL_QUALCOMM=m
  442. +CONFIG_USB_SERIAL_SPCP8X5=m
  443. +CONFIG_USB_SERIAL_SAFE=m
  444. +CONFIG_USB_SERIAL_SIERRAWIRELESS=m
  445. +CONFIG_USB_SERIAL_SYMBOL=m
  446. +CONFIG_USB_SERIAL_TI=m
  447. +CONFIG_USB_SERIAL_CYBERJACK=m
  448. +CONFIG_USB_SERIAL_XIRCOM=m
  449. +CONFIG_USB_SERIAL_OPTION=m
  450. +CONFIG_USB_SERIAL_OMNINET=m
  451. +CONFIG_USB_SERIAL_OPTICON=m
  452. +CONFIG_USB_SERIAL_SSU100=m
  453. +CONFIG_USB_SERIAL_DEBUG=m
  454. +CONFIG_USB_EMI62=m
  455. +CONFIG_USB_EMI26=m
  456. +CONFIG_USB_ADUTUX=m
  457. +CONFIG_USB_SEVSEG=m
  458. +CONFIG_USB_RIO500=m
  459. +CONFIG_USB_LEGOTOWER=m
  460. +CONFIG_USB_LCD=m
  461. +CONFIG_USB_LED=m
  462. +CONFIG_USB_CYPRESS_CY7C63=m
  463. +CONFIG_USB_CYTHERM=m
  464. +CONFIG_USB_IDMOUSE=m
  465. +CONFIG_USB_FTDI_ELAN=m
  466. +CONFIG_USB_APPLEDISPLAY=m
  467. +CONFIG_USB_LD=m
  468. +CONFIG_USB_TRANCEVIBRATOR=m
  469. +CONFIG_USB_IOWARRIOR=m
  470. +CONFIG_USB_TEST=m
  471. +CONFIG_USB_ISIGHTFW=m
  472. +CONFIG_USB_YUREX=m
  473. +CONFIG_MMC=y
  474. +CONFIG_MMC_SDHCI=y
  475. +CONFIG_MMC_SDHCI_PLTFM=y
  476. +CONFIG_UIO=m
  477. +CONFIG_UIO_PDRV_GENIRQ=m
  478. +# CONFIG_IOMMU_SUPPORT is not set
  479. +CONFIG_EXT4_FS=y
  480. +CONFIG_EXT4_FS_POSIX_ACL=y
  481. +CONFIG_EXT4_FS_SECURITY=y
  482. +CONFIG_REISERFS_FS=m
  483. +CONFIG_REISERFS_FS_XATTR=y
  484. +CONFIG_REISERFS_FS_POSIX_ACL=y
  485. +CONFIG_REISERFS_FS_SECURITY=y
  486. +CONFIG_JFS_FS=m
  487. +CONFIG_JFS_POSIX_ACL=y
  488. +CONFIG_JFS_SECURITY=y
  489. +CONFIG_JFS_STATISTICS=y
  490. +CONFIG_XFS_FS=m
  491. +CONFIG_XFS_QUOTA=y
  492. +CONFIG_XFS_POSIX_ACL=y
  493. +CONFIG_XFS_RT=y
  494. +CONFIG_GFS2_FS=m
  495. +CONFIG_OCFS2_FS=m
  496. +CONFIG_BTRFS_FS=m
  497. +CONFIG_BTRFS_FS_POSIX_ACL=y
  498. +CONFIG_NILFS2_FS=m
  499. +CONFIG_FANOTIFY=y
  500. +CONFIG_AUTOFS4_FS=y
  501. +CONFIG_FUSE_FS=m
  502. +CONFIG_CUSE=m
  503. +CONFIG_FSCACHE=y
  504. +CONFIG_FSCACHE_STATS=y
  505. +CONFIG_FSCACHE_HISTOGRAM=y
  506. +CONFIG_CACHEFILES=y
  507. +CONFIG_ISO9660_FS=m
  508. +CONFIG_JOLIET=y
  509. +CONFIG_ZISOFS=y
  510. +CONFIG_UDF_FS=m
  511. +CONFIG_MSDOS_FS=y
  512. +CONFIG_VFAT_FS=y
  513. +CONFIG_FAT_DEFAULT_IOCHARSET="ascii"
  514. +CONFIG_NTFS_FS=m
  515. +CONFIG_TMPFS=y
  516. +CONFIG_TMPFS_POSIX_ACL=y
  517. +CONFIG_CONFIGFS_FS=y
  518. +CONFIG_SQUASHFS=m
  519. +CONFIG_SQUASHFS_XATTR=y
  520. +CONFIG_SQUASHFS_LZO=y
  521. +CONFIG_SQUASHFS_XZ=y
  522. +CONFIG_NFS_FS=y
  523. +CONFIG_NFS_V3_ACL=y
  524. +CONFIG_NFS_V4=y
  525. +CONFIG_ROOT_NFS=y
  526. +CONFIG_NFS_FSCACHE=y
  527. +CONFIG_CIFS=m
  528. +CONFIG_CIFS_WEAK_PW_HASH=y
  529. +CONFIG_CIFS_XATTR=y
  530. +CONFIG_CIFS_POSIX=y
  531. +CONFIG_9P_FS=m
  532. +CONFIG_9P_FS_POSIX_ACL=y
  533. +CONFIG_NLS_DEFAULT="utf8"
  534. +CONFIG_NLS_CODEPAGE_437=y
  535. +CONFIG_NLS_CODEPAGE_737=m
  536. +CONFIG_NLS_CODEPAGE_775=m
  537. +CONFIG_NLS_CODEPAGE_850=m
  538. +CONFIG_NLS_CODEPAGE_852=m
  539. +CONFIG_NLS_CODEPAGE_855=m
  540. +CONFIG_NLS_CODEPAGE_857=m
  541. +CONFIG_NLS_CODEPAGE_860=m
  542. +CONFIG_NLS_CODEPAGE_861=m
  543. +CONFIG_NLS_CODEPAGE_862=m
  544. +CONFIG_NLS_CODEPAGE_863=m
  545. +CONFIG_NLS_CODEPAGE_864=m
  546. +CONFIG_NLS_CODEPAGE_865=m
  547. +CONFIG_NLS_CODEPAGE_866=m
  548. +CONFIG_NLS_CODEPAGE_869=m
  549. +CONFIG_NLS_CODEPAGE_936=m
  550. +CONFIG_NLS_CODEPAGE_950=m
  551. +CONFIG_NLS_CODEPAGE_932=m
  552. +CONFIG_NLS_CODEPAGE_949=m
  553. +CONFIG_NLS_CODEPAGE_874=m
  554. +CONFIG_NLS_ISO8859_8=m
  555. +CONFIG_NLS_CODEPAGE_1250=m
  556. +CONFIG_NLS_CODEPAGE_1251=m
  557. +CONFIG_NLS_ASCII=y
  558. +CONFIG_NLS_ISO8859_1=m
  559. +CONFIG_NLS_ISO8859_2=m
  560. +CONFIG_NLS_ISO8859_3=m
  561. +CONFIG_NLS_ISO8859_4=m
  562. +CONFIG_NLS_ISO8859_5=m
  563. +CONFIG_NLS_ISO8859_6=m
  564. +CONFIG_NLS_ISO8859_7=m
  565. +CONFIG_NLS_ISO8859_9=m
  566. +CONFIG_NLS_ISO8859_13=m
  567. +CONFIG_NLS_ISO8859_14=m
  568. +CONFIG_NLS_ISO8859_15=m
  569. +CONFIG_NLS_KOI8_R=m
  570. +CONFIG_NLS_KOI8_U=m
  571. +CONFIG_NLS_UTF8=m
  572. +CONFIG_PRINTK_TIME=y
  573. +CONFIG_BOOT_PRINTK_DELAY=y
  574. +CONFIG_DEBUG_INFO=y
  575. +CONFIG_DEBUG_STACK_USAGE=y
  576. +CONFIG_DEBUG_MEMORY_INIT=y
  577. +CONFIG_DETECT_HUNG_TASK=y
  578. +CONFIG_TIMER_STATS=y
  579. +CONFIG_LATENCYTOP=y
  580. +CONFIG_IRQSOFF_TRACER=y
  581. +CONFIG_SCHED_TRACER=y
  582. +CONFIG_STACK_TRACER=y
  583. +CONFIG_BLK_DEV_IO_TRACE=y
  584. +CONFIG_FUNCTION_PROFILER=y
  585. +CONFIG_KGDB=y
  586. +CONFIG_KGDB_KDB=y
  587. +CONFIG_KDB_KEYBOARD=y
  588. +CONFIG_STRICT_DEVMEM=y
  589. +CONFIG_CRYPTO_AUTHENC=m
  590. +CONFIG_CRYPTO_CBC=y
  591. +CONFIG_CRYPTO_HMAC=y
  592. +CONFIG_CRYPTO_XCBC=m
  593. +CONFIG_CRYPTO_MD5=y
  594. +CONFIG_CRYPTO_SHA1=y
  595. +CONFIG_CRYPTO_SHA512=m
  596. +CONFIG_CRYPTO_TGR192=m
  597. +CONFIG_CRYPTO_WP512=m
  598. +CONFIG_CRYPTO_CAST5=m
  599. +CONFIG_CRYPTO_DES=y
  600. +CONFIG_CRYPTO_DEFLATE=m
  601. +# CONFIG_CRYPTO_ANSI_CPRNG is not set
  602. +# CONFIG_CRYPTO_HW is not set
  603. +CONFIG_CRC_ITU_T=y
  604. +CONFIG_LIBCRC32C=y
  605. --- a/arch/arm/kernel/process.c
  606. +++ b/arch/arm/kernel/process.c
  607. @@ -172,6 +172,16 @@ void arch_cpu_idle_dead(void)
  608. }
  609. #endif
  610. +char bcm2708_reboot_mode = 'h';
  611. +
  612. +int __init reboot_setup(char *str)
  613. +{
  614. + bcm2708_reboot_mode = str[0];
  615. + return 1;
  616. +}
  617. +
  618. +__setup("reboot=", reboot_setup);
  619. +
  620. /*
  621. * Called by kexec, immediately prior to machine_kexec().
  622. *
  623. --- /dev/null
  624. +++ b/arch/arm/mach-bcm2708/Kconfig
  625. @@ -0,0 +1,26 @@
  626. +menu "Broadcom BCM2708 Implementations"
  627. + depends on ARCH_BCM2708
  628. +
  629. +config MACH_BCM2708
  630. + bool "Broadcom BCM2708 Development Platform"
  631. + select NEED_MACH_MEMORY_H
  632. + select NEED_MACH_IO_H
  633. + select CPU_V6
  634. + help
  635. + Include support for the Broadcom(R) BCM2708 platform.
  636. +
  637. +config BCM2708_VCMEM
  638. + bool "Videocore Memory"
  639. + depends on MACH_BCM2708
  640. + default y
  641. + help
  642. + Helper for videocore memory access and total size allocation.
  643. +
  644. +config BCM2708_NOL2CACHE
  645. + bool "Videocore L2 cache disable"
  646. + depends on MACH_BCM2708
  647. + default n
  648. + help
  649. + Do not allow ARM to use GPU's L2 cache. Requires disable_l2cache in config.txt.
  650. +
  651. +endmenu
  652. --- /dev/null
  653. +++ b/arch/arm/mach-bcm2708/Makefile
  654. @@ -0,0 +1,6 @@
  655. +#
  656. +# Makefile for the linux kernel.
  657. +#
  658. +
  659. +obj-$(CONFIG_MACH_BCM2708) += clock.o bcm2708.o armctrl.o vcio.o power.o dma.o
  660. +obj-$(CONFIG_BCM2708_VCMEM) += vc_mem.o
  661. --- /dev/null
  662. +++ b/arch/arm/mach-bcm2708/Makefile.boot
  663. @@ -0,0 +1,3 @@
  664. + zreladdr-y := 0x00008000
  665. +params_phys-y := 0x00000100
  666. +initrd_phys-y := 0x00800000
  667. --- /dev/null
  668. +++ b/arch/arm/mach-bcm2708/armctrl.c
  669. @@ -0,0 +1,208 @@
  670. +/*
  671. + * linux/arch/arm/mach-bcm2708/armctrl.c
  672. + *
  673. + * Copyright (C) 2010 Broadcom
  674. + *
  675. + * This program is free software; you can redistribute it and/or modify
  676. + * it under the terms of the GNU General Public License as published by
  677. + * the Free Software Foundation; either version 2 of the License, or
  678. + * (at your option) any later version.
  679. + *
  680. + * This program is distributed in the hope that it will be useful,
  681. + * but WITHOUT ANY WARRANTY; without even the implied warranty of
  682. + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  683. + * GNU General Public License for more details.
  684. + *
  685. + * You should have received a copy of the GNU General Public License
  686. + * along with this program; if not, write to the Free Software
  687. + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
  688. + */
  689. +#include <linux/init.h>
  690. +#include <linux/list.h>
  691. +#include <linux/io.h>
  692. +#include <linux/version.h>
  693. +#include <linux/syscore_ops.h>
  694. +#include <linux/interrupt.h>
  695. +
  696. +#include <asm/mach/irq.h>
  697. +#include <mach/hardware.h>
  698. +#include "armctrl.h"
  699. +
  700. +/* For support of kernels >= 3.0 assume only one VIC for now*/
  701. +static unsigned int remap_irqs[(INTERRUPT_ARASANSDIO + 1) - INTERRUPT_JPEG] = {
  702. + INTERRUPT_VC_JPEG,
  703. + INTERRUPT_VC_USB,
  704. + INTERRUPT_VC_3D,
  705. + INTERRUPT_VC_DMA2,
  706. + INTERRUPT_VC_DMA3,
  707. + INTERRUPT_VC_I2C,
  708. + INTERRUPT_VC_SPI,
  709. + INTERRUPT_VC_I2SPCM,
  710. + INTERRUPT_VC_SDIO,
  711. + INTERRUPT_VC_UART,
  712. + INTERRUPT_VC_ARASANSDIO
  713. +};
  714. +
  715. +static void armctrl_mask_irq(struct irq_data *d)
  716. +{
  717. + static const unsigned int disables[4] = {
  718. + ARM_IRQ_DIBL1,
  719. + ARM_IRQ_DIBL2,
  720. + ARM_IRQ_DIBL3,
  721. + 0
  722. + };
  723. +
  724. + unsigned int data = (unsigned int)irq_get_chip_data(d->irq);
  725. + writel(1 << (data & 0x1f), __io_address(disables[(data >> 5) & 0x3]));
  726. +}
  727. +
  728. +static void armctrl_unmask_irq(struct irq_data *d)
  729. +{
  730. + static const unsigned int enables[4] = {
  731. + ARM_IRQ_ENBL1,
  732. + ARM_IRQ_ENBL2,
  733. + ARM_IRQ_ENBL3,
  734. + 0
  735. + };
  736. +
  737. + unsigned int data = (unsigned int)irq_get_chip_data(d->irq);
  738. + writel(1 << (data & 0x1f), __io_address(enables[(data >> 5) & 0x3]));
  739. +}
  740. +
  741. +#if defined(CONFIG_PM)
  742. +
  743. +/* for kernels 3.xx use the new syscore_ops apis but for older kernels use the sys dev class */
  744. +
  745. +/* Static defines
  746. + * struct armctrl_device - VIC PM device (< 3.xx)
  747. + * @sysdev: The system device which is registered. (< 3.xx)
  748. + * @irq: The IRQ number for the base of the VIC.
  749. + * @base: The register base for the VIC.
  750. + * @resume_sources: A bitmask of interrupts for resume.
  751. + * @resume_irqs: The IRQs enabled for resume.
  752. + * @int_select: Save for VIC_INT_SELECT.
  753. + * @int_enable: Save for VIC_INT_ENABLE.
  754. + * @soft_int: Save for VIC_INT_SOFT.
  755. + * @protect: Save for VIC_PROTECT.
  756. + */
  757. +struct armctrl_info {
  758. + void __iomem *base;
  759. + int irq;
  760. + u32 resume_sources;
  761. + u32 resume_irqs;
  762. + u32 int_select;
  763. + u32 int_enable;
  764. + u32 soft_int;
  765. + u32 protect;
  766. +} armctrl;
  767. +
  768. +static int armctrl_suspend(void)
  769. +{
  770. + return 0;
  771. +}
  772. +
  773. +static void armctrl_resume(void)
  774. +{
  775. + return;
  776. +}
  777. +
  778. +/**
  779. + * armctrl_pm_register - Register a VIC for later power management control
  780. + * @base: The base address of the VIC.
  781. + * @irq: The base IRQ for the VIC.
  782. + * @resume_sources: bitmask of interrupts allowed for resume sources.
  783. + *
  784. + * For older kernels (< 3.xx) do -
  785. + * Register the VIC with the system device tree so that it can be notified
  786. + * of suspend and resume requests and ensure that the correct actions are
  787. + * taken to re-instate the settings on resume.
  788. + */
  789. +static void __init armctrl_pm_register(void __iomem * base, unsigned int irq,
  790. + u32 resume_sources)
  791. +{
  792. + armctrl.base = base;
  793. + armctrl.resume_sources = resume_sources;
  794. + armctrl.irq = irq;
  795. +}
  796. +
  797. +static int armctrl_set_wake(struct irq_data *d, unsigned int on)
  798. +{
  799. + unsigned int off = d->irq & 31;
  800. + u32 bit = 1 << off;
  801. +
  802. + if (!(bit & armctrl.resume_sources))
  803. + return -EINVAL;
  804. +
  805. + if (on)
  806. + armctrl.resume_irqs |= bit;
  807. + else
  808. + armctrl.resume_irqs &= ~bit;
  809. +
  810. + return 0;
  811. +}
  812. +
  813. +#else
  814. +static inline void armctrl_pm_register(void __iomem * base, unsigned int irq,
  815. + u32 arg1)
  816. +{
  817. +}
  818. +
  819. +#define armctrl_suspend NULL
  820. +#define armctrl_resume NULL
  821. +#define armctrl_set_wake NULL
  822. +#endif /* CONFIG_PM */
  823. +
  824. +static struct syscore_ops armctrl_syscore_ops = {
  825. + .suspend = armctrl_suspend,
  826. + .resume = armctrl_resume,
  827. +};
  828. +
  829. +/**
  830. + * armctrl_syscore_init - initicall to register VIC pm functions
  831. + *
  832. + * This is called via late_initcall() to register
  833. + * the resources for the VICs due to the early
  834. + * nature of the VIC's registration.
  835. +*/
  836. +static int __init armctrl_syscore_init(void)
  837. +{
  838. + register_syscore_ops(&armctrl_syscore_ops);
  839. + return 0;
  840. +}
  841. +
  842. +late_initcall(armctrl_syscore_init);
  843. +
  844. +static struct irq_chip armctrl_chip = {
  845. + .name = "ARMCTRL",
  846. + .irq_ack = NULL,
  847. + .irq_mask = armctrl_mask_irq,
  848. + .irq_unmask = armctrl_unmask_irq,
  849. + .irq_set_wake = armctrl_set_wake,
  850. +};
  851. +
  852. +/**
  853. + * armctrl_init - initialise a vectored interrupt controller
  854. + * @base: iomem base address
  855. + * @irq_start: starting interrupt number, must be muliple of 32
  856. + * @armctrl_sources: bitmask of interrupt sources to allow
  857. + * @resume_sources: bitmask of interrupt sources to allow for resume
  858. + */
  859. +int __init armctrl_init(void __iomem * base, unsigned int irq_start,
  860. + u32 armctrl_sources, u32 resume_sources)
  861. +{
  862. + unsigned int irq;
  863. +
  864. + for (irq = 0; irq < BCM2708_ALLOC_IRQS; irq++) {
  865. + unsigned int data = irq;
  866. + if (irq >= INTERRUPT_JPEG && irq <= INTERRUPT_ARASANSDIO)
  867. + data = remap_irqs[irq - INTERRUPT_JPEG];
  868. +
  869. + irq_set_chip(irq, &armctrl_chip);
  870. + irq_set_chip_data(irq, (void *)data);
  871. + irq_set_handler(irq, handle_level_irq);
  872. + set_irq_flags(irq, IRQF_VALID | IRQF_PROBE | IRQF_DISABLED);
  873. + }
  874. +
  875. + armctrl_pm_register(base, irq_start, resume_sources);
  876. + return 0;
  877. +}
  878. --- /dev/null
  879. +++ b/arch/arm/mach-bcm2708/armctrl.h
  880. @@ -0,0 +1,27 @@
  881. +/*
  882. + * linux/arch/arm/mach-bcm2708/armctrl.h
  883. + *
  884. + * Copyright (C) 2010 Broadcom
  885. + *
  886. + * This program is free software; you can redistribute it and/or modify
  887. + * it under the terms of the GNU General Public License as published by
  888. + * the Free Software Foundation; either version 2 of the License, or
  889. + * (at your option) any later version.
  890. + *
  891. + * This program is distributed in the hope that it will be useful,
  892. + * but WITHOUT ANY WARRANTY; without even the implied warranty of
  893. + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  894. + * GNU General Public License for more details.
  895. + *
  896. + * You should have received a copy of the GNU General Public License
  897. + * along with this program; if not, write to the Free Software
  898. + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
  899. + */
  900. +
  901. +#ifndef __BCM2708_ARMCTRL_H
  902. +#define __BCM2708_ARMCTRL_H
  903. +
  904. +extern int __init armctrl_init(void __iomem * base, unsigned int irq_start,
  905. + u32 armctrl_sources, u32 resume_sources);
  906. +
  907. +#endif
  908. --- /dev/null
  909. +++ b/arch/arm/mach-bcm2708/bcm2708.c
  910. @@ -0,0 +1,662 @@
  911. +/*
  912. + * linux/arch/arm/mach-bcm2708/bcm2708.c
  913. + *
  914. + * Copyright (C) 2010 Broadcom
  915. + *
  916. + * This program is free software; you can redistribute it and/or modify
  917. + * it under the terms of the GNU General Public License as published by
  918. + * the Free Software Foundation; either version 2 of the License, or
  919. + * (at your option) any later version.
  920. + *
  921. + * This program is distributed in the hope that it will be useful,
  922. + * but WITHOUT ANY WARRANTY; without even the implied warranty of
  923. + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  924. + * GNU General Public License for more details.
  925. + *
  926. + * You should have received a copy of the GNU General Public License
  927. + * along with this program; if not, write to the Free Software
  928. + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
  929. + */
  930. +
  931. +#include <linux/init.h>
  932. +#include <linux/device.h>
  933. +#include <linux/dma-mapping.h>
  934. +#include <linux/serial_8250.h>
  935. +#include <linux/platform_device.h>
  936. +#include <linux/syscore_ops.h>
  937. +#include <linux/interrupt.h>
  938. +#include <linux/amba/bus.h>
  939. +#include <linux/amba/clcd.h>
  940. +#include <linux/clockchips.h>
  941. +#include <linux/cnt32_to_63.h>
  942. +#include <linux/io.h>
  943. +#include <linux/module.h>
  944. +
  945. +#include <linux/version.h>
  946. +#include <linux/clkdev.h>
  947. +#include <asm/system_info.h>
  948. +#include <mach/hardware.h>
  949. +#include <asm/irq.h>
  950. +#include <linux/leds.h>
  951. +#include <asm/mach-types.h>
  952. +#include <linux/sched_clock.h>
  953. +
  954. +#include <asm/mach/arch.h>
  955. +#include <asm/mach/flash.h>
  956. +#include <asm/mach/irq.h>
  957. +#include <asm/mach/time.h>
  958. +#include <asm/mach/map.h>
  959. +
  960. +#include <mach/timex.h>
  961. +#include <mach/dma.h>
  962. +#include <mach/vcio.h>
  963. +#include <mach/system.h>
  964. +
  965. +#include <linux/delay.h>
  966. +
  967. +#include "bcm2708.h"
  968. +#include "armctrl.h"
  969. +#include "clock.h"
  970. +
  971. +#ifdef CONFIG_BCM_VC_CMA
  972. +#include <linux/broadcom/vc_cma.h>
  973. +#endif
  974. +
  975. +
  976. +/* Effectively we have an IOMMU (ARM<->VideoCore map) that is set up to
  977. + * give us IO access only to 64Mbytes of physical memory (26 bits). We could
  978. + * represent this window by setting our dmamasks to 26 bits but, in fact
  979. + * we're not going to use addresses outside this range (they're not in real
  980. + * memory) so we don't bother.
  981. + *
  982. + * In the future we might include code to use this IOMMU to remap other
  983. + * physical addresses onto VideoCore memory then the use of 32-bits would be
  984. + * more legitimate.
  985. + */
  986. +#define DMA_MASK_BITS_COMMON 32
  987. +
  988. +/* command line parameters */
  989. +static unsigned boardrev, serial;
  990. +static unsigned uart_clock;
  991. +static unsigned disk_led_gpio = 16;
  992. +static unsigned disk_led_active_low = 1;
  993. +static unsigned reboot_part = 0;
  994. +
  995. +static void __init bcm2708_init_led(void);
  996. +
  997. +void __init bcm2708_init_irq(void)
  998. +{
  999. + armctrl_init(__io_address(ARMCTRL_IC_BASE), 0, 0, 0);
  1000. +}
  1001. +
  1002. +static struct map_desc bcm2708_io_desc[] __initdata = {
  1003. + {
  1004. + .virtual = IO_ADDRESS(ARMCTRL_BASE),
  1005. + .pfn = __phys_to_pfn(ARMCTRL_BASE),
  1006. + .length = SZ_4K,
  1007. + .type = MT_DEVICE},
  1008. + {
  1009. + .virtual = IO_ADDRESS(UART0_BASE),
  1010. + .pfn = __phys_to_pfn(UART0_BASE),
  1011. + .length = SZ_4K,
  1012. + .type = MT_DEVICE},
  1013. + {
  1014. + .virtual = IO_ADDRESS(UART1_BASE),
  1015. + .pfn = __phys_to_pfn(UART1_BASE),
  1016. + .length = SZ_4K,
  1017. + .type = MT_DEVICE},
  1018. + {
  1019. + .virtual = IO_ADDRESS(DMA_BASE),
  1020. + .pfn = __phys_to_pfn(DMA_BASE),
  1021. + .length = SZ_4K,
  1022. + .type = MT_DEVICE},
  1023. + {
  1024. + .virtual = IO_ADDRESS(MCORE_BASE),
  1025. + .pfn = __phys_to_pfn(MCORE_BASE),
  1026. + .length = SZ_4K,
  1027. + .type = MT_DEVICE},
  1028. + {
  1029. + .virtual = IO_ADDRESS(ST_BASE),
  1030. + .pfn = __phys_to_pfn(ST_BASE),
  1031. + .length = SZ_4K,
  1032. + .type = MT_DEVICE},
  1033. + {
  1034. + .virtual = IO_ADDRESS(USB_BASE),
  1035. + .pfn = __phys_to_pfn(USB_BASE),
  1036. + .length = SZ_128K,
  1037. + .type = MT_DEVICE},
  1038. + {
  1039. + .virtual = IO_ADDRESS(PM_BASE),
  1040. + .pfn = __phys_to_pfn(PM_BASE),
  1041. + .length = SZ_4K,
  1042. + .type = MT_DEVICE},
  1043. + {
  1044. + .virtual = IO_ADDRESS(GPIO_BASE),
  1045. + .pfn = __phys_to_pfn(GPIO_BASE),
  1046. + .length = SZ_4K,
  1047. + .type = MT_DEVICE}
  1048. +};
  1049. +
  1050. +void __init bcm2708_map_io(void)
  1051. +{
  1052. + iotable_init(bcm2708_io_desc, ARRAY_SIZE(bcm2708_io_desc));
  1053. +}
  1054. +
  1055. +/* The STC is a free running counter that increments at the rate of 1MHz */
  1056. +#define STC_FREQ_HZ 1000000
  1057. +
  1058. +static inline uint32_t timer_read(void)
  1059. +{
  1060. + /* STC: a free running counter that increments at the rate of 1MHz */
  1061. + return readl(__io_address(ST_BASE + 0x04));
  1062. +}
  1063. +
  1064. +static unsigned long bcm2708_read_current_timer(void)
  1065. +{
  1066. + return timer_read();
  1067. +}
  1068. +
  1069. +static u64 notrace bcm2708_read_sched_clock(void)
  1070. +{
  1071. + return timer_read();
  1072. +}
  1073. +
  1074. +static cycle_t clksrc_read(struct clocksource *cs)
  1075. +{
  1076. + return timer_read();
  1077. +}
  1078. +
  1079. +static struct clocksource clocksource_stc = {
  1080. + .name = "stc",
  1081. + .rating = 300,
  1082. + .read = clksrc_read,
  1083. + .mask = CLOCKSOURCE_MASK(32),
  1084. + .flags = CLOCK_SOURCE_IS_CONTINUOUS,
  1085. +};
  1086. +
  1087. +unsigned long frc_clock_ticks32(void)
  1088. +{
  1089. + return timer_read();
  1090. +}
  1091. +
  1092. +static void __init bcm2708_clocksource_init(void)
  1093. +{
  1094. + if (clocksource_register_hz(&clocksource_stc, STC_FREQ_HZ)) {
  1095. + printk(KERN_ERR "timer: failed to initialize clock "
  1096. + "source %s\n", clocksource_stc.name);
  1097. + }
  1098. +}
  1099. +
  1100. +
  1101. +/*
  1102. + * These are fixed clocks.
  1103. + */
  1104. +static struct clk ref24_clk = {
  1105. + .rate = UART0_CLOCK, /* The UART is clocked at 3MHz via APB_CLK */
  1106. +};
  1107. +
  1108. +static struct clk osc_clk = {
  1109. +#ifdef CONFIG_ARCH_BCM2708_CHIPIT
  1110. + .rate = 27000000,
  1111. +#else
  1112. + .rate = 500000000, /* ARM clock is set from the VideoCore booter */
  1113. +#endif
  1114. +};
  1115. +
  1116. +/* warning - the USB needs a clock > 34MHz */
  1117. +
  1118. +#ifdef CONFIG_MMC_BCM2708
  1119. +static struct clk sdhost_clk = {
  1120. +#ifdef CONFIG_ARCH_BCM2708_CHIPIT
  1121. + .rate = 4000000, /* 4MHz */
  1122. +#else
  1123. + .rate = 250000000, /* 250MHz */
  1124. +#endif
  1125. +};
  1126. +#endif
  1127. +
  1128. +static struct clk_lookup lookups[] = {
  1129. + { /* UART0 */
  1130. + .dev_id = "dev:f1",
  1131. + .clk = &ref24_clk,
  1132. + },
  1133. + { /* USB */
  1134. + .dev_id = "bcm2708_usb",
  1135. + .clk = &osc_clk,
  1136. + }
  1137. +};
  1138. +
  1139. +#define UART0_IRQ { IRQ_UART, 0 /*NO_IRQ*/ }
  1140. +#define UART0_DMA { 15, 14 }
  1141. +
  1142. +AMBA_DEVICE(uart0, "dev:f1", UART0, NULL);
  1143. +
  1144. +static struct amba_device *amba_devs[] __initdata = {
  1145. + &uart0_device,
  1146. +};
  1147. +
  1148. +static struct resource bcm2708_dmaman_resources[] = {
  1149. + {
  1150. + .start = DMA_BASE,
  1151. + .end = DMA_BASE + SZ_4K - 1,
  1152. + .flags = IORESOURCE_MEM,
  1153. + }
  1154. +};
  1155. +
  1156. +static struct platform_device bcm2708_dmaman_device = {
  1157. + .name = BCM_DMAMAN_DRIVER_NAME,
  1158. + .id = 0, /* first bcm2708_dma */
  1159. + .resource = bcm2708_dmaman_resources,
  1160. + .num_resources = ARRAY_SIZE(bcm2708_dmaman_resources),
  1161. +};
  1162. +
  1163. +static u64 fb_dmamask = DMA_BIT_MASK(DMA_MASK_BITS_COMMON);
  1164. +
  1165. +static struct platform_device bcm2708_fb_device = {
  1166. + .name = "bcm2708_fb",
  1167. + .id = -1, /* only one bcm2708_fb */
  1168. + .resource = NULL,
  1169. + .num_resources = 0,
  1170. + .dev = {
  1171. + .dma_mask = &fb_dmamask,
  1172. + .coherent_dma_mask = DMA_BIT_MASK(DMA_MASK_BITS_COMMON),
  1173. + },
  1174. +};
  1175. +
  1176. +static struct plat_serial8250_port bcm2708_uart1_platform_data[] = {
  1177. + {
  1178. + .mapbase = UART1_BASE + 0x40,
  1179. + .irq = IRQ_AUX,
  1180. + .uartclk = 125000000,
  1181. + .regshift = 2,
  1182. + .iotype = UPIO_MEM,
  1183. + .flags = UPF_FIXED_TYPE | UPF_IOREMAP | UPF_SKIP_TEST,
  1184. + .type = PORT_8250,
  1185. + },
  1186. + {},
  1187. +};
  1188. +
  1189. +static struct platform_device bcm2708_uart1_device = {
  1190. + .name = "serial8250",
  1191. + .id = PLAT8250_DEV_PLATFORM,
  1192. + .dev = {
  1193. + .platform_data = bcm2708_uart1_platform_data,
  1194. + },
  1195. +};
  1196. +
  1197. +static struct resource bcm2708_usb_resources[] = {
  1198. + [0] = {
  1199. + .start = USB_BASE,
  1200. + .end = USB_BASE + SZ_128K - 1,
  1201. + .flags = IORESOURCE_MEM,
  1202. + },
  1203. + [1] = {
  1204. + .start = IRQ_USB,
  1205. + .end = IRQ_USB,
  1206. + .flags = IORESOURCE_IRQ,
  1207. + },
  1208. +};
  1209. +
  1210. +static u64 usb_dmamask = DMA_BIT_MASK(DMA_MASK_BITS_COMMON);
  1211. +
  1212. +static struct platform_device bcm2708_usb_device = {
  1213. + .name = "bcm2708_usb",
  1214. + .id = -1, /* only one bcm2708_usb */
  1215. + .resource = bcm2708_usb_resources,
  1216. + .num_resources = ARRAY_SIZE(bcm2708_usb_resources),
  1217. + .dev = {
  1218. + .dma_mask = &usb_dmamask,
  1219. + .coherent_dma_mask = DMA_BIT_MASK(DMA_MASK_BITS_COMMON),
  1220. + },
  1221. +};
  1222. +
  1223. +static struct resource bcm2708_vcio_resources[] = {
  1224. + [0] = { /* mailbox/semaphore/doorbell access */
  1225. + .start = MCORE_BASE,
  1226. + .end = MCORE_BASE + SZ_4K - 1,
  1227. + .flags = IORESOURCE_MEM,
  1228. + },
  1229. +};
  1230. +
  1231. +static u64 vcio_dmamask = DMA_BIT_MASK(DMA_MASK_BITS_COMMON);
  1232. +
  1233. +static struct platform_device bcm2708_vcio_device = {
  1234. + .name = BCM_VCIO_DRIVER_NAME,
  1235. + .id = -1, /* only one VideoCore I/O area */
  1236. + .resource = bcm2708_vcio_resources,
  1237. + .num_resources = ARRAY_SIZE(bcm2708_vcio_resources),
  1238. + .dev = {
  1239. + .dma_mask = &vcio_dmamask,
  1240. + .coherent_dma_mask = DMA_BIT_MASK(DMA_MASK_BITS_COMMON),
  1241. + },
  1242. +};
  1243. +
  1244. +static struct resource bcm2708_systemtimer_resources[] = {
  1245. + [0] = { /* system timer access */
  1246. + .start = ST_BASE,
  1247. + .end = ST_BASE + SZ_4K - 1,
  1248. + .flags = IORESOURCE_MEM,
  1249. + },
  1250. + {
  1251. + .start = IRQ_TIMER3,
  1252. + .end = IRQ_TIMER3,
  1253. + .flags = IORESOURCE_IRQ,
  1254. + }
  1255. +
  1256. +};
  1257. +
  1258. +static u64 systemtimer_dmamask = DMA_BIT_MASK(DMA_MASK_BITS_COMMON);
  1259. +
  1260. +static struct platform_device bcm2708_systemtimer_device = {
  1261. + .name = "bcm2708_systemtimer",
  1262. + .id = -1, /* only one VideoCore I/O area */
  1263. + .resource = bcm2708_systemtimer_resources,
  1264. + .num_resources = ARRAY_SIZE(bcm2708_systemtimer_resources),
  1265. + .dev = {
  1266. + .dma_mask = &systemtimer_dmamask,
  1267. + .coherent_dma_mask = DMA_BIT_MASK(DMA_MASK_BITS_COMMON),
  1268. + },
  1269. +};
  1270. +
  1271. +static struct resource bcm2708_powerman_resources[] = {
  1272. + [0] = {
  1273. + .start = PM_BASE,
  1274. + .end = PM_BASE + SZ_256 - 1,
  1275. + .flags = IORESOURCE_MEM,
  1276. + },
  1277. +};
  1278. +
  1279. +static u64 powerman_dmamask = DMA_BIT_MASK(DMA_MASK_BITS_COMMON);
  1280. +
  1281. +struct platform_device bcm2708_powerman_device = {
  1282. + .name = "bcm2708_powerman",
  1283. + .id = 0,
  1284. + .num_resources = ARRAY_SIZE(bcm2708_powerman_resources),
  1285. + .resource = bcm2708_powerman_resources,
  1286. + .dev = {
  1287. + .dma_mask = &powerman_dmamask,
  1288. + .coherent_dma_mask = 0xffffffffUL},
  1289. +};
  1290. +
  1291. +int __init bcm_register_device(struct platform_device *pdev)
  1292. +{
  1293. + int ret;
  1294. +
  1295. + ret = platform_device_register(pdev);
  1296. + if (ret)
  1297. + pr_debug("Unable to register platform device '%s': %d\n",
  1298. + pdev->name, ret);
  1299. +
  1300. + return ret;
  1301. +}
  1302. +
  1303. +int calc_rsts(int partition)
  1304. +{
  1305. + return PM_PASSWORD |
  1306. + ((partition & (1 << 0)) << 0) |
  1307. + ((partition & (1 << 1)) << 1) |
  1308. + ((partition & (1 << 2)) << 2) |
  1309. + ((partition & (1 << 3)) << 3) |
  1310. + ((partition & (1 << 4)) << 4) |
  1311. + ((partition & (1 << 5)) << 5);
  1312. +}
  1313. +
  1314. +static void bcm2708_restart(enum reboot_mode mode, const char *cmd)
  1315. +{
  1316. + extern char bcm2708_reboot_mode;
  1317. + uint32_t pm_rstc, pm_wdog;
  1318. + uint32_t timeout = 10;
  1319. + uint32_t pm_rsts = 0;
  1320. +
  1321. + if(bcm2708_reboot_mode == 'q')
  1322. + {
  1323. + // NOOBS < 1.3 booting with reboot=q
  1324. + pm_rsts = readl(__io_address(PM_RSTS));
  1325. + pm_rsts = PM_PASSWORD | pm_rsts | PM_RSTS_HADWRQ_SET;
  1326. + }
  1327. + else if(bcm2708_reboot_mode == 'p')
  1328. + {
  1329. + // NOOBS < 1.3 halting
  1330. + pm_rsts = readl(__io_address(PM_RSTS));
  1331. + pm_rsts = PM_PASSWORD | pm_rsts | PM_RSTS_HADWRH_SET;
  1332. + }
  1333. + else
  1334. + {
  1335. + pm_rsts = calc_rsts(reboot_part);
  1336. + }
  1337. +
  1338. + writel(pm_rsts, __io_address(PM_RSTS));
  1339. +
  1340. + /* Setup watchdog for reset */
  1341. + pm_rstc = readl(__io_address(PM_RSTC));
  1342. +
  1343. + pm_wdog = PM_PASSWORD | (timeout & PM_WDOG_TIME_SET); // watchdog timer = timer clock / 16; need password (31:16) + value (11:0)
  1344. + pm_rstc = PM_PASSWORD | (pm_rstc & PM_RSTC_WRCFG_CLR) | PM_RSTC_WRCFG_FULL_RESET;
  1345. +
  1346. + writel(pm_wdog, __io_address(PM_WDOG));
  1347. + writel(pm_rstc, __io_address(PM_RSTC));
  1348. +}
  1349. +
  1350. +/* 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 */
  1351. +static void bcm2708_power_off(void)
  1352. +{
  1353. + extern char bcm2708_reboot_mode;
  1354. + if(bcm2708_reboot_mode == 'q')
  1355. + {
  1356. + // NOOBS < v1.3
  1357. + bcm2708_restart('p', "");
  1358. + }
  1359. + else
  1360. + {
  1361. + /* partition 63 is special code for HALT the bootloader knows not to boot*/
  1362. + reboot_part = 63;
  1363. + /* continue with normal reset mechanism */
  1364. + bcm2708_restart(0, "");
  1365. + }
  1366. +}
  1367. +
  1368. +void __init bcm2708_init(void)
  1369. +{
  1370. + int i;
  1371. +
  1372. +#if defined(CONFIG_BCM_VC_CMA)
  1373. + vc_cma_early_init();
  1374. +#endif
  1375. + printk("bcm2708.uart_clock = %d\n", uart_clock);
  1376. + pm_power_off = bcm2708_power_off;
  1377. +
  1378. + if (uart_clock)
  1379. + lookups[0].clk->rate = uart_clock;
  1380. +
  1381. + for (i = 0; i < ARRAY_SIZE(lookups); i++)
  1382. + clkdev_add(&lookups[i]);
  1383. +
  1384. + bcm_register_device(&bcm2708_dmaman_device);
  1385. + bcm_register_device(&bcm2708_vcio_device);
  1386. + bcm_register_device(&bcm2708_systemtimer_device);
  1387. + bcm_register_device(&bcm2708_fb_device);
  1388. + bcm_register_device(&bcm2708_usb_device);
  1389. + bcm_register_device(&bcm2708_uart1_device);
  1390. + bcm_register_device(&bcm2708_powerman_device);
  1391. +
  1392. + bcm2708_init_led();
  1393. +
  1394. + for (i = 0; i < ARRAY_SIZE(amba_devs); i++) {
  1395. + struct amba_device *d = amba_devs[i];
  1396. + amba_device_register(d, &iomem_resource);
  1397. + }
  1398. + system_rev = boardrev;
  1399. + system_serial_low = serial;
  1400. +}
  1401. +
  1402. +static void timer_set_mode(enum clock_event_mode mode,
  1403. + struct clock_event_device *clk)
  1404. +{
  1405. + switch (mode) {
  1406. + case CLOCK_EVT_MODE_ONESHOT: /* Leave the timer disabled, .set_next_event will enable it */
  1407. + case CLOCK_EVT_MODE_SHUTDOWN:
  1408. + break;
  1409. + case CLOCK_EVT_MODE_PERIODIC:
  1410. +
  1411. + case CLOCK_EVT_MODE_UNUSED:
  1412. + case CLOCK_EVT_MODE_RESUME:
  1413. +
  1414. + default:
  1415. + printk(KERN_ERR "timer_set_mode: unhandled mode:%d\n",
  1416. + (int)mode);
  1417. + break;
  1418. + }
  1419. +
  1420. +}
  1421. +
  1422. +static int timer_set_next_event(unsigned long cycles,
  1423. + struct clock_event_device *unused)
  1424. +{
  1425. + unsigned long stc;
  1426. + do {
  1427. + stc = readl(__io_address(ST_BASE + 0x04));
  1428. + /* We could take a FIQ here, which may push ST above STC3 */
  1429. + writel(stc + cycles, __io_address(ST_BASE + 0x18));
  1430. + } while ((signed long) cycles >= 0 &&
  1431. + (signed long) (readl(__io_address(ST_BASE + 0x04)) - stc)
  1432. + >= (signed long) cycles);
  1433. + return 0;
  1434. +}
  1435. +
  1436. +static struct clock_event_device timer0_clockevent = {
  1437. + .name = "timer0",
  1438. + .shift = 32,
  1439. + .features = CLOCK_EVT_FEAT_ONESHOT,
  1440. + .set_mode = timer_set_mode,
  1441. + .set_next_event = timer_set_next_event,
  1442. +};
  1443. +
  1444. +/*
  1445. + * IRQ handler for the timer
  1446. + */
  1447. +static irqreturn_t bcm2708_timer_interrupt(int irq, void *dev_id)
  1448. +{
  1449. + struct clock_event_device *evt = &timer0_clockevent;
  1450. +
  1451. + writel(1 << 3, __io_address(ST_BASE + 0x00)); /* stcs clear timer int */
  1452. +
  1453. + evt->event_handler(evt);
  1454. +
  1455. + return IRQ_HANDLED;
  1456. +}
  1457. +
  1458. +static struct irqaction bcm2708_timer_irq = {
  1459. + .name = "BCM2708 Timer Tick",
  1460. + .flags = IRQF_DISABLED | IRQF_TIMER | IRQF_IRQPOLL,
  1461. + .handler = bcm2708_timer_interrupt,
  1462. +};
  1463. +
  1464. +/*
  1465. + * Set up timer interrupt, and return the current time in seconds.
  1466. + */
  1467. +
  1468. +static struct delay_timer bcm2708_delay_timer = {
  1469. + .read_current_timer = bcm2708_read_current_timer,
  1470. + .freq = STC_FREQ_HZ,
  1471. +};
  1472. +
  1473. +static void __init bcm2708_timer_init(void)
  1474. +{
  1475. + /* init high res timer */
  1476. + bcm2708_clocksource_init();
  1477. +
  1478. + /*
  1479. + * Initialise to a known state (all timers off)
  1480. + */
  1481. + writel(0, __io_address(ARM_T_CONTROL));
  1482. + /*
  1483. + * Make irqs happen for the system timer
  1484. + */
  1485. + setup_irq(IRQ_TIMER3, &bcm2708_timer_irq);
  1486. +
  1487. + sched_clock_register(bcm2708_read_sched_clock, 32, STC_FREQ_HZ);
  1488. +
  1489. + timer0_clockevent.mult =
  1490. + div_sc(STC_FREQ_HZ, NSEC_PER_SEC, timer0_clockevent.shift);
  1491. + timer0_clockevent.max_delta_ns =
  1492. + clockevent_delta2ns(0xffffffff, &timer0_clockevent);
  1493. + timer0_clockevent.min_delta_ns =
  1494. + clockevent_delta2ns(0xf, &timer0_clockevent);
  1495. +
  1496. + timer0_clockevent.cpumask = cpumask_of(0);
  1497. + clockevents_register_device(&timer0_clockevent);
  1498. +
  1499. + register_current_timer_delay(&bcm2708_delay_timer);
  1500. +}
  1501. +
  1502. +#if defined(CONFIG_LEDS_GPIO) || defined(CONFIG_LEDS_GPIO_MODULE)
  1503. +#include <linux/leds.h>
  1504. +
  1505. +static struct gpio_led bcm2708_leds[] = {
  1506. + [0] = {
  1507. + .gpio = 16,
  1508. + .name = "led0",
  1509. + .default_trigger = "mmc0",
  1510. + .active_low = 1,
  1511. + },
  1512. +};
  1513. +
  1514. +static struct gpio_led_platform_data bcm2708_led_pdata = {
  1515. + .num_leds = ARRAY_SIZE(bcm2708_leds),
  1516. + .leds = bcm2708_leds,
  1517. +};
  1518. +
  1519. +static struct platform_device bcm2708_led_device = {
  1520. + .name = "leds-gpio",
  1521. + .id = -1,
  1522. + .dev = {
  1523. + .platform_data = &bcm2708_led_pdata,
  1524. + },
  1525. +};
  1526. +
  1527. +static void __init bcm2708_init_led(void)
  1528. +{
  1529. + bcm2708_leds[0].gpio = disk_led_gpio;
  1530. + bcm2708_leds[0].active_low = disk_led_active_low;
  1531. + platform_device_register(&bcm2708_led_device);
  1532. +}
  1533. +#else
  1534. +static inline void bcm2708_init_led(void)
  1535. +{
  1536. +}
  1537. +#endif
  1538. +
  1539. +void __init bcm2708_init_early(void)
  1540. +{
  1541. + /*
  1542. + * Some devices allocate their coherent buffers from atomic
  1543. + * context. Increase size of atomic coherent pool to make sure such
  1544. + * the allocations won't fail.
  1545. + */
  1546. + init_dma_coherent_pool_size(SZ_4M);
  1547. +}
  1548. +
  1549. +static void __init board_reserve(void)
  1550. +{
  1551. +#if defined(CONFIG_BCM_VC_CMA)
  1552. + vc_cma_reserve();
  1553. +#endif
  1554. +}
  1555. +
  1556. +MACHINE_START(BCM2708, "BCM2708")
  1557. + /* Maintainer: Broadcom Europe Ltd. */
  1558. + .map_io = bcm2708_map_io,
  1559. + .init_irq = bcm2708_init_irq,
  1560. + .init_time = bcm2708_timer_init,
  1561. + .init_machine = bcm2708_init,
  1562. + .init_early = bcm2708_init_early,
  1563. + .reserve = board_reserve,
  1564. + .restart = bcm2708_restart,
  1565. +MACHINE_END
  1566. +
  1567. +module_param(boardrev, uint, 0644);
  1568. +module_param(serial, uint, 0644);
  1569. +module_param(uart_clock, uint, 0644);
  1570. +module_param(disk_led_gpio, uint, 0644);
  1571. +module_param(disk_led_active_low, uint, 0644);
  1572. +module_param(reboot_part, uint, 0644);
  1573. --- /dev/null
  1574. +++ b/arch/arm/mach-bcm2708/bcm2708.h
  1575. @@ -0,0 +1,49 @@
  1576. +/*
  1577. + * linux/arch/arm/mach-bcm2708/bcm2708.h
  1578. + *
  1579. + * BCM2708 machine support header
  1580. + *
  1581. + * Copyright (C) 2010 Broadcom
  1582. + *
  1583. + * This program is free software; you can redistribute it and/or modify
  1584. + * it under the terms of the GNU General Public License as published by
  1585. + * the Free Software Foundation; either version 2 of the License, or
  1586. + * (at your option) any later version.
  1587. + *
  1588. + * This program is distributed in the hope that it will be useful,
  1589. + * but WITHOUT ANY WARRANTY; without even the implied warranty of
  1590. + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  1591. + * GNU General Public License for more details.
  1592. + *
  1593. + * You should have received a copy of the GNU General Public License
  1594. + * along with this program; if not, write to the Free Software
  1595. + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
  1596. + */
  1597. +
  1598. +#ifndef __BCM2708_BCM2708_H
  1599. +#define __BCM2708_BCM2708_H
  1600. +
  1601. +#include <linux/amba/bus.h>
  1602. +
  1603. +extern void __init bcm2708_init(void);
  1604. +extern void __init bcm2708_init_irq(void);
  1605. +extern void __init bcm2708_map_io(void);
  1606. +extern struct sys_timer bcm2708_timer;
  1607. +extern unsigned int mmc_status(struct device *dev);
  1608. +
  1609. +#define AMBA_DEVICE(name, busid, base, plat) \
  1610. +static struct amba_device name##_device = { \
  1611. + .dev = { \
  1612. + .coherent_dma_mask = ~0, \
  1613. + .init_name = busid, \
  1614. + .platform_data = plat, \
  1615. + }, \
  1616. + .res = { \
  1617. + .start = base##_BASE, \
  1618. + .end = (base##_BASE) + SZ_4K - 1,\
  1619. + .flags = IORESOURCE_MEM, \
  1620. + }, \
  1621. + .irq = base##_IRQ, \
  1622. +}
  1623. +
  1624. +#endif
  1625. --- /dev/null
  1626. +++ b/arch/arm/mach-bcm2708/clock.c
  1627. @@ -0,0 +1,61 @@
  1628. +/*
  1629. + * linux/arch/arm/mach-bcm2708/clock.c
  1630. + *
  1631. + * Copyright (C) 2010 Broadcom
  1632. + *
  1633. + * This program is free software; you can redistribute it and/or modify
  1634. + * it under the terms of the GNU General Public License as published by
  1635. + * the Free Software Foundation; either version 2 of the License, or
  1636. + * (at your option) any later version.
  1637. + *
  1638. + * This program is distributed in the hope that it will be useful,
  1639. + * but WITHOUT ANY WARRANTY; without even the implied warranty of
  1640. + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  1641. + * GNU General Public License for more details.
  1642. + *
  1643. + * You should have received a copy of the GNU General Public License
  1644. + * along with this program; if not, write to the Free Software
  1645. + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
  1646. + */
  1647. +#include <linux/module.h>
  1648. +#include <linux/kernel.h>
  1649. +#include <linux/device.h>
  1650. +#include <linux/list.h>
  1651. +#include <linux/errno.h>
  1652. +#include <linux/err.h>
  1653. +#include <linux/string.h>
  1654. +#include <linux/clk.h>
  1655. +#include <linux/mutex.h>
  1656. +
  1657. +#include <asm/clkdev.h>
  1658. +
  1659. +#include "clock.h"
  1660. +
  1661. +int clk_enable(struct clk *clk)
  1662. +{
  1663. + return 0;
  1664. +}
  1665. +EXPORT_SYMBOL(clk_enable);
  1666. +
  1667. +void clk_disable(struct clk *clk)
  1668. +{
  1669. +}
  1670. +EXPORT_SYMBOL(clk_disable);
  1671. +
  1672. +unsigned long clk_get_rate(struct clk *clk)
  1673. +{
  1674. + return clk->rate;
  1675. +}
  1676. +EXPORT_SYMBOL(clk_get_rate);
  1677. +
  1678. +long clk_round_rate(struct clk *clk, unsigned long rate)
  1679. +{
  1680. + return clk->rate;
  1681. +}
  1682. +EXPORT_SYMBOL(clk_round_rate);
  1683. +
  1684. +int clk_set_rate(struct clk *clk, unsigned long rate)
  1685. +{
  1686. + return -EIO;
  1687. +}
  1688. +EXPORT_SYMBOL(clk_set_rate);
  1689. --- /dev/null
  1690. +++ b/arch/arm/mach-bcm2708/clock.h
  1691. @@ -0,0 +1,24 @@
  1692. +/*
  1693. + * linux/arch/arm/mach-bcm2708/clock.h
  1694. + *
  1695. + * Copyright (C) 2010 Broadcom
  1696. + *
  1697. + * This program is free software; you can redistribute it and/or modify
  1698. + * it under the terms of the GNU General Public License as published by
  1699. + * the Free Software Foundation; either version 2 of the License, or
  1700. + * (at your option) any later version.
  1701. + *
  1702. + * This program is distributed in the hope that it will be useful,
  1703. + * but WITHOUT ANY WARRANTY; without even the implied warranty of
  1704. + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  1705. + * GNU General Public License for more details.
  1706. + *
  1707. + * You should have received a copy of the GNU General Public License
  1708. + * along with this program; if not, write to the Free Software
  1709. + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
  1710. + */
  1711. +struct module;
  1712. +
  1713. +struct clk {
  1714. + unsigned long rate;
  1715. +};
  1716. --- /dev/null
  1717. +++ b/arch/arm/mach-bcm2708/dma.c
  1718. @@ -0,0 +1,399 @@
  1719. +/*
  1720. + * linux/arch/arm/mach-bcm2708/dma.c
  1721. + *
  1722. + * Copyright (C) 2010 Broadcom
  1723. + *
  1724. + * This program is free software; you can redistribute it and/or modify
  1725. + * it under the terms of the GNU General Public License version 2 as
  1726. + * published by the Free Software Foundation.
  1727. + */
  1728. +
  1729. +#include <linux/slab.h>
  1730. +#include <linux/device.h>
  1731. +#include <linux/platform_device.h>
  1732. +#include <linux/module.h>
  1733. +#include <linux/scatterlist.h>
  1734. +
  1735. +#include <mach/dma.h>
  1736. +#include <mach/irqs.h>
  1737. +
  1738. +/*****************************************************************************\
  1739. + * *
  1740. + * Configuration *
  1741. + * *
  1742. +\*****************************************************************************/
  1743. +
  1744. +#define CACHE_LINE_MASK 31
  1745. +#define DRIVER_NAME BCM_DMAMAN_DRIVER_NAME
  1746. +#define DEFAULT_DMACHAN_BITMAP 0x10 /* channel 4 only */
  1747. +
  1748. +/* valid only for channels 0 - 14, 15 has its own base address */
  1749. +#define BCM2708_DMA_CHAN(n) ((n)<<8) /* base address */
  1750. +#define BCM2708_DMA_CHANIO(dma_base, n) \
  1751. + ((void __iomem *)((char *)(dma_base)+BCM2708_DMA_CHAN(n)))
  1752. +
  1753. +
  1754. +/*****************************************************************************\
  1755. + * *
  1756. + * DMA Auxilliary Functions *
  1757. + * *
  1758. +\*****************************************************************************/
  1759. +
  1760. +/* A DMA buffer on an arbitrary boundary may separate a cache line into a
  1761. + section inside the DMA buffer and another section outside it.
  1762. + Even if we flush DMA buffers from the cache there is always the chance that
  1763. + during a DMA someone will access the part of a cache line that is outside
  1764. + the DMA buffer - which will then bring in unwelcome data.
  1765. + Without being able to dictate our own buffer pools we must insist that
  1766. + DMA buffers consist of a whole number of cache lines.
  1767. +*/
  1768. +
  1769. +extern int
  1770. +bcm_sg_suitable_for_dma(struct scatterlist *sg_ptr, int sg_len)
  1771. +{
  1772. + int i;
  1773. +
  1774. + for (i = 0; i < sg_len; i++) {
  1775. + if (sg_ptr[i].offset & CACHE_LINE_MASK ||
  1776. + sg_ptr[i].length & CACHE_LINE_MASK)
  1777. + return 0;
  1778. + }
  1779. +
  1780. + return 1;
  1781. +}
  1782. +EXPORT_SYMBOL_GPL(bcm_sg_suitable_for_dma);
  1783. +
  1784. +extern void
  1785. +bcm_dma_start(void __iomem *dma_chan_base, dma_addr_t control_block)
  1786. +{
  1787. + dsb(); /* ARM data synchronization (push) operation */
  1788. +
  1789. + writel(control_block, dma_chan_base + BCM2708_DMA_ADDR);
  1790. + writel(BCM2708_DMA_ACTIVE, dma_chan_base + BCM2708_DMA_CS);
  1791. +}
  1792. +
  1793. +extern void bcm_dma_wait_idle(void __iomem *dma_chan_base)
  1794. +{
  1795. + dsb();
  1796. +
  1797. + /* ugly busy wait only option for now */
  1798. + while (readl(dma_chan_base + BCM2708_DMA_CS) & BCM2708_DMA_ACTIVE)
  1799. + cpu_relax();
  1800. +}
  1801. +
  1802. +EXPORT_SYMBOL_GPL(bcm_dma_start);
  1803. +
  1804. +/* Complete an ongoing DMA (assuming its results are to be ignored)
  1805. + Does nothing if there is no DMA in progress.
  1806. + This routine waits for the current AXI transfer to complete before
  1807. + terminating the current DMA. If the current transfer is hung on a DREQ used
  1808. + by an uncooperative peripheral the AXI transfer may never complete. In this
  1809. + case the routine times out and return a non-zero error code.
  1810. + Use of this routine doesn't guarantee that the ongoing or aborted DMA
  1811. + does not produce an interrupt.
  1812. +*/
  1813. +extern int
  1814. +bcm_dma_abort(void __iomem *dma_chan_base)
  1815. +{
  1816. + unsigned long int cs;
  1817. + int rc = 0;
  1818. +
  1819. + cs = readl(dma_chan_base + BCM2708_DMA_CS);
  1820. +
  1821. + if (BCM2708_DMA_ACTIVE & cs) {
  1822. + long int timeout = 10000;
  1823. +
  1824. + /* write 0 to the active bit - pause the DMA */
  1825. + writel(0, dma_chan_base + BCM2708_DMA_CS);
  1826. +
  1827. + /* wait for any current AXI transfer to complete */
  1828. + while (0 != (cs & BCM2708_DMA_ISPAUSED) && --timeout >= 0)
  1829. + cs = readl(dma_chan_base + BCM2708_DMA_CS);
  1830. +
  1831. + if (0 != (cs & BCM2708_DMA_ISPAUSED)) {
  1832. + /* we'll un-pause when we set of our next DMA */
  1833. + rc = -ETIMEDOUT;
  1834. +
  1835. + } else if (BCM2708_DMA_ACTIVE & cs) {
  1836. + /* terminate the control block chain */
  1837. + writel(0, dma_chan_base + BCM2708_DMA_NEXTCB);
  1838. +
  1839. + /* abort the whole DMA */
  1840. + writel(BCM2708_DMA_ABORT | BCM2708_DMA_ACTIVE,
  1841. + dma_chan_base + BCM2708_DMA_CS);
  1842. + }
  1843. + }
  1844. +
  1845. + return rc;
  1846. +}
  1847. +EXPORT_SYMBOL_GPL(bcm_dma_abort);
  1848. +
  1849. +
  1850. +/***************************************************************************** \
  1851. + * *
  1852. + * DMA Manager Device Methods *
  1853. + * *
  1854. +\*****************************************************************************/
  1855. +
  1856. +struct vc_dmaman {
  1857. + void __iomem *dma_base;
  1858. + u32 chan_available; /* bitmap of available channels */
  1859. + u32 has_feature[BCM_DMA_FEATURE_COUNT]; /* bitmap of feature presence */
  1860. +};
  1861. +
  1862. +static void vc_dmaman_init(struct vc_dmaman *dmaman, void __iomem *dma_base,
  1863. + u32 chans_available)
  1864. +{
  1865. + dmaman->dma_base = dma_base;
  1866. + dmaman->chan_available = chans_available;
  1867. + dmaman->has_feature[BCM_DMA_FEATURE_FAST_ORD] = 0x0c; /* chans 2 & 3 */
  1868. + dmaman->has_feature[BCM_DMA_FEATURE_BULK_ORD] = 0x01; /* chan 0 */
  1869. +}
  1870. +
  1871. +static int vc_dmaman_chan_alloc(struct vc_dmaman *dmaman,
  1872. + unsigned preferred_feature_set)
  1873. +{
  1874. + u32 chans;
  1875. + int feature;
  1876. +
  1877. + chans = dmaman->chan_available;
  1878. + for (feature = 0; feature < BCM_DMA_FEATURE_COUNT; feature++)
  1879. + /* select the subset of available channels with the desired
  1880. + feature so long as some of the candidate channels have that
  1881. + feature */
  1882. + if ((preferred_feature_set & (1 << feature)) &&
  1883. + (chans & dmaman->has_feature[feature]))
  1884. + chans &= dmaman->has_feature[feature];
  1885. +
  1886. + if (chans) {
  1887. + int chan = 0;
  1888. + /* return the ordinal of the first channel in the bitmap */
  1889. + while (chans != 0 && (chans & 1) == 0) {
  1890. + chans >>= 1;
  1891. + chan++;
  1892. + }
  1893. + /* claim the channel */
  1894. + dmaman->chan_available &= ~(1 << chan);
  1895. + return chan;
  1896. + } else
  1897. + return -ENOMEM;
  1898. +}
  1899. +
  1900. +static int vc_dmaman_chan_free(struct vc_dmaman *dmaman, int chan)
  1901. +{
  1902. + if (chan < 0)
  1903. + return -EINVAL;
  1904. + else if ((1 << chan) & dmaman->chan_available)
  1905. + return -EIDRM;
  1906. + else {
  1907. + dmaman->chan_available |= (1 << chan);
  1908. + return 0;
  1909. + }
  1910. +}
  1911. +
  1912. +/*****************************************************************************\
  1913. + * *
  1914. + * DMA IRQs *
  1915. + * *
  1916. +\*****************************************************************************/
  1917. +
  1918. +static unsigned char bcm_dma_irqs[] = {
  1919. + IRQ_DMA0,
  1920. + IRQ_DMA1,
  1921. + IRQ_DMA2,
  1922. + IRQ_DMA3,
  1923. + IRQ_DMA4,
  1924. + IRQ_DMA5,
  1925. + IRQ_DMA6,
  1926. + IRQ_DMA7,
  1927. + IRQ_DMA8,
  1928. + IRQ_DMA9,
  1929. + IRQ_DMA10,
  1930. + IRQ_DMA11,
  1931. + IRQ_DMA12
  1932. +};
  1933. +
  1934. +
  1935. +/***************************************************************************** \
  1936. + * *
  1937. + * DMA Manager Monitor *
  1938. + * *
  1939. +\*****************************************************************************/
  1940. +
  1941. +static struct device *dmaman_dev; /* we assume there's only one! */
  1942. +
  1943. +extern int bcm_dma_chan_alloc(unsigned preferred_feature_set,
  1944. + void __iomem **out_dma_base, int *out_dma_irq)
  1945. +{
  1946. + if (!dmaman_dev)
  1947. + return -ENODEV;
  1948. + else {
  1949. + struct vc_dmaman *dmaman = dev_get_drvdata(dmaman_dev);
  1950. + int rc;
  1951. +
  1952. + device_lock(dmaman_dev);
  1953. + rc = vc_dmaman_chan_alloc(dmaman, preferred_feature_set);
  1954. + if (rc >= 0) {
  1955. + *out_dma_base = BCM2708_DMA_CHANIO(dmaman->dma_base,
  1956. + rc);
  1957. + *out_dma_irq = bcm_dma_irqs[rc];
  1958. + }
  1959. + device_unlock(dmaman_dev);
  1960. +
  1961. + return rc;
  1962. + }
  1963. +}
  1964. +EXPORT_SYMBOL_GPL(bcm_dma_chan_alloc);
  1965. +
  1966. +extern int bcm_dma_chan_free(int channel)
  1967. +{
  1968. + if (dmaman_dev) {
  1969. + struct vc_dmaman *dmaman = dev_get_drvdata(dmaman_dev);
  1970. + int rc;
  1971. +
  1972. + device_lock(dmaman_dev);
  1973. + rc = vc_dmaman_chan_free(dmaman, channel);
  1974. + device_unlock(dmaman_dev);
  1975. +
  1976. + return rc;
  1977. + } else
  1978. + return -ENODEV;
  1979. +}
  1980. +EXPORT_SYMBOL_GPL(bcm_dma_chan_free);
  1981. +
  1982. +static int dev_dmaman_register(const char *dev_name, struct device *dev)
  1983. +{
  1984. + int rc = dmaman_dev ? -EINVAL : 0;
  1985. + dmaman_dev = dev;
  1986. + return rc;
  1987. +}
  1988. +
  1989. +static void dev_dmaman_deregister(const char *dev_name, struct device *dev)
  1990. +{
  1991. + dmaman_dev = NULL;
  1992. +}
  1993. +
  1994. +/*****************************************************************************\
  1995. + * *
  1996. + * DMA Device *
  1997. + * *
  1998. +\*****************************************************************************/
  1999. +
  2000. +static int dmachans = -1; /* module parameter */
  2001. +
  2002. +static int bcm_dmaman_probe(struct platform_device *pdev)
  2003. +{
  2004. + int ret = 0;
  2005. + struct vc_dmaman *dmaman;
  2006. + struct resource *dma_res = NULL;
  2007. + void __iomem *dma_base = NULL;
  2008. + int have_dma_region = 0;
  2009. +
  2010. + dmaman = kzalloc(sizeof(*dmaman), GFP_KERNEL);
  2011. + if (NULL == dmaman) {
  2012. + printk(KERN_ERR DRIVER_NAME ": failed to allocate "
  2013. + "DMA management memory\n");
  2014. + ret = -ENOMEM;
  2015. + } else {
  2016. +
  2017. + dma_res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
  2018. + if (dma_res == NULL) {
  2019. + printk(KERN_ERR DRIVER_NAME ": failed to obtain memory "
  2020. + "resource\n");
  2021. + ret = -ENODEV;
  2022. + } else if (!request_mem_region(dma_res->start,
  2023. + resource_size(dma_res),
  2024. + DRIVER_NAME)) {
  2025. + dev_err(&pdev->dev, "cannot obtain DMA region\n");
  2026. + ret = -EBUSY;
  2027. + } else {
  2028. + have_dma_region = 1;
  2029. + dma_base = ioremap(dma_res->start,
  2030. + resource_size(dma_res));
  2031. + if (!dma_base) {
  2032. + dev_err(&pdev->dev, "cannot map DMA region\n");
  2033. + ret = -ENOMEM;
  2034. + } else {
  2035. + /* use module parameter if one was provided */
  2036. + if (dmachans > 0)
  2037. + vc_dmaman_init(dmaman, dma_base,
  2038. + dmachans);
  2039. + else
  2040. + vc_dmaman_init(dmaman, dma_base,
  2041. + DEFAULT_DMACHAN_BITMAP);
  2042. +
  2043. + platform_set_drvdata(pdev, dmaman);
  2044. + dev_dmaman_register(DRIVER_NAME, &pdev->dev);
  2045. +
  2046. + printk(KERN_INFO DRIVER_NAME ": DMA manager "
  2047. + "at %p\n", dma_base);
  2048. + }
  2049. + }
  2050. + }
  2051. + if (ret != 0) {
  2052. + if (dma_base)
  2053. + iounmap(dma_base);
  2054. + if (dma_res && have_dma_region)
  2055. + release_mem_region(dma_res->start,
  2056. + resource_size(dma_res));
  2057. + if (dmaman)
  2058. + kfree(dmaman);
  2059. + }
  2060. + return ret;
  2061. +}
  2062. +
  2063. +static int bcm_dmaman_remove(struct platform_device *pdev)
  2064. +{
  2065. + struct vc_dmaman *dmaman = platform_get_drvdata(pdev);
  2066. +
  2067. + platform_set_drvdata(pdev, NULL);
  2068. + dev_dmaman_deregister(DRIVER_NAME, &pdev->dev);
  2069. + kfree(dmaman);
  2070. +
  2071. + return 0;
  2072. +}
  2073. +
  2074. +static struct platform_driver bcm_dmaman_driver = {
  2075. + .probe = bcm_dmaman_probe,
  2076. + .remove = bcm_dmaman_remove,
  2077. +
  2078. + .driver = {
  2079. + .name = DRIVER_NAME,
  2080. + .owner = THIS_MODULE,
  2081. + },
  2082. +};
  2083. +
  2084. +/*****************************************************************************\
  2085. + * *
  2086. + * Driver init/exit *
  2087. + * *
  2088. +\*****************************************************************************/
  2089. +
  2090. +static int __init bcm_dmaman_drv_init(void)
  2091. +{
  2092. + int ret;
  2093. +
  2094. + ret = platform_driver_register(&bcm_dmaman_driver);
  2095. + if (ret != 0) {
  2096. + printk(KERN_ERR DRIVER_NAME ": failed to register "
  2097. + "on platform\n");
  2098. + }
  2099. +
  2100. + return ret;
  2101. +}
  2102. +
  2103. +static void __exit bcm_dmaman_drv_exit(void)
  2104. +{
  2105. + platform_driver_unregister(&bcm_dmaman_driver);
  2106. +}
  2107. +
  2108. +module_init(bcm_dmaman_drv_init);
  2109. +module_exit(bcm_dmaman_drv_exit);
  2110. +
  2111. +module_param(dmachans, int, 0644);
  2112. +
  2113. +MODULE_AUTHOR("Gray Girling <grayg@broadcom.com>");
  2114. +MODULE_DESCRIPTION("DMA channel manager driver");
  2115. +MODULE_LICENSE("GPL");
  2116. +
  2117. +MODULE_PARM_DESC(dmachans, "Bitmap of DMA channels available to the ARM");
  2118. --- /dev/null
  2119. +++ b/arch/arm/mach-bcm2708/include/mach/arm_control.h
  2120. @@ -0,0 +1,419 @@
  2121. +/*
  2122. + * linux/arch/arm/mach-bcm2708/arm_control.h
  2123. + *
  2124. + * Copyright (C) 2010 Broadcom
  2125. + *
  2126. + * This program is free software; you can redistribute it and/or modify
  2127. + * it under the terms of the GNU General Public License as published by
  2128. + * the Free Software Foundation; either version 2 of the License, or
  2129. + * (at your option) any later version.
  2130. + *
  2131. + * This program is distributed in the hope that it will be useful,
  2132. + * but WITHOUT ANY WARRANTY; without even the implied warranty of
  2133. + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  2134. + * GNU General Public License for more details.
  2135. + *
  2136. + * You should have received a copy of the GNU General Public License
  2137. + * along with this program; if not, write to the Free Software
  2138. + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
  2139. + */
  2140. +
  2141. +#ifndef __BCM2708_ARM_CONTROL_H
  2142. +#define __BCM2708_ARM_CONTROL_H
  2143. +
  2144. +/*
  2145. + * Definitions and addresses for the ARM CONTROL logic
  2146. + * This file is manually generated.
  2147. + */
  2148. +
  2149. +#define ARM_BASE 0x7E00B000
  2150. +
  2151. +/* Basic configuration */
  2152. +#define ARM_CONTROL0 HW_REGISTER_RW(ARM_BASE+0x000)
  2153. +#define ARM_C0_SIZ128M 0x00000000
  2154. +#define ARM_C0_SIZ256M 0x00000001
  2155. +#define ARM_C0_SIZ512M 0x00000002
  2156. +#define ARM_C0_SIZ1G 0x00000003
  2157. +#define ARM_C0_BRESP0 0x00000000
  2158. +#define ARM_C0_BRESP1 0x00000004
  2159. +#define ARM_C0_BRESP2 0x00000008
  2160. +#define ARM_C0_BOOTHI 0x00000010
  2161. +#define ARM_C0_UNUSED05 0x00000020 /* free */
  2162. +#define ARM_C0_FULLPERI 0x00000040
  2163. +#define ARM_C0_UNUSED78 0x00000180 /* free */
  2164. +#define ARM_C0_JTAGMASK 0x00000E00
  2165. +#define ARM_C0_JTAGOFF 0x00000000
  2166. +#define ARM_C0_JTAGBASH 0x00000800 /* Debug on GPIO off */
  2167. +#define ARM_C0_JTAGGPIO 0x00000C00 /* Debug on GPIO on */
  2168. +#define ARM_C0_APROTMSK 0x0000F000
  2169. +#define ARM_C0_DBG0SYNC 0x00010000 /* VPU0 halt sync */
  2170. +#define ARM_C0_DBG1SYNC 0x00020000 /* VPU1 halt sync */
  2171. +#define ARM_C0_SWDBGREQ 0x00040000 /* HW debug request */
  2172. +#define ARM_C0_PASSHALT 0x00080000 /* ARM halt passed to debugger */
  2173. +#define ARM_C0_PRIO_PER 0x00F00000 /* per priority mask */
  2174. +#define ARM_C0_PRIO_L2 0x0F000000
  2175. +#define ARM_C0_PRIO_UC 0xF0000000
  2176. +
  2177. +#define ARM_C0_APROTPASS 0x0000A000 /* Translate 1:1 */
  2178. +#define ARM_C0_APROTUSER 0x00000000 /* Only user mode */
  2179. +#define ARM_C0_APROTSYST 0x0000F000 /* Only system mode */
  2180. +
  2181. +
  2182. +#define ARM_CONTROL1 HW_REGISTER_RW(ARM_BASE+0x440)
  2183. +#define ARM_C1_TIMER 0x00000001 /* re-route timer IRQ to VC */
  2184. +#define ARM_C1_MAIL 0x00000002 /* re-route Mail IRQ to VC */
  2185. +#define ARM_C1_BELL0 0x00000004 /* re-route Doorbell 0 to VC */
  2186. +#define ARM_C1_BELL1 0x00000008 /* re-route Doorbell 1 to VC */
  2187. +#define ARM_C1_PERSON 0x00000100 /* peripherals on */
  2188. +#define ARM_C1_REQSTOP 0x00000200 /* ASYNC bridge request stop */
  2189. +
  2190. +#define ARM_STATUS HW_REGISTER_RW(ARM_BASE+0x444)
  2191. +#define ARM_S_ACKSTOP 0x80000000 /* Bridge stopped */
  2192. +#define ARM_S_READPEND 0x000003FF /* pending reads counter */
  2193. +#define ARM_S_WRITPEND 0x000FFC00 /* pending writes counter */
  2194. +
  2195. +#define ARM_ERRHALT HW_REGISTER_RW(ARM_BASE+0x448)
  2196. +#define ARM_EH_PERIBURST 0x00000001 /* Burst write seen on peri bus */
  2197. +#define ARM_EH_ILLADDRS1 0x00000002 /* Address bits 25-27 error */
  2198. +#define ARM_EH_ILLADDRS2 0x00000004 /* Address bits 31-28 error */
  2199. +#define ARM_EH_VPU0HALT 0x00000008 /* VPU0 halted & in debug mode */
  2200. +#define ARM_EH_VPU1HALT 0x00000010 /* VPU1 halted & in debug mode */
  2201. +#define ARM_EH_ARMHALT 0x00000020 /* ARM in halted debug mode */
  2202. +
  2203. +#define ARM_ID_SECURE HW_REGISTER_RW(ARM_BASE+0x00C)
  2204. +#define ARM_ID HW_REGISTER_RW(ARM_BASE+0x44C)
  2205. +#define ARM_IDVAL 0x364D5241
  2206. +
  2207. +/* Translation memory */
  2208. +#define ARM_TRANSLATE HW_REGISTER_RW(ARM_BASE+0x100)
  2209. +/* 32 locations: 0x100.. 0x17F */
  2210. +/* 32 spare means we CAN go to 64 pages.... */
  2211. +
  2212. +
  2213. +/* Interrupts */
  2214. +#define ARM_IRQ_PEND0 HW_REGISTER_RW(ARM_BASE+0x200) /* Top IRQ bits */
  2215. +#define ARM_I0_TIMER 0x00000001 /* timer IRQ */
  2216. +#define ARM_I0_MAIL 0x00000002 /* Mail IRQ */
  2217. +#define ARM_I0_BELL0 0x00000004 /* Doorbell 0 */
  2218. +#define ARM_I0_BELL1 0x00000008 /* Doorbell 1 */
  2219. +#define ARM_I0_BANK1 0x00000100 /* Bank1 IRQ */
  2220. +#define ARM_I0_BANK2 0x00000200 /* Bank2 IRQ */
  2221. +
  2222. +#define ARM_IRQ_PEND1 HW_REGISTER_RW(ARM_BASE+0x204) /* All bank1 IRQ bits */
  2223. +/* todo: all I1_interrupt sources */
  2224. +#define ARM_IRQ_PEND2 HW_REGISTER_RW(ARM_BASE+0x208) /* All bank2 IRQ bits */
  2225. +/* todo: all I2_interrupt sources */
  2226. +
  2227. +#define ARM_IRQ_FAST HW_REGISTER_RW(ARM_BASE+0x20C) /* FIQ control */
  2228. +#define ARM_IF_INDEX 0x0000007F /* FIQ select */
  2229. +#define ARM_IF_ENABLE 0x00000080 /* FIQ enable */
  2230. +#define ARM_IF_VCMASK 0x0000003F /* FIQ = (index from VC source) */
  2231. +#define ARM_IF_TIMER 0x00000040 /* FIQ = ARM timer */
  2232. +#define ARM_IF_MAIL 0x00000041 /* FIQ = ARM Mail */
  2233. +#define ARM_IF_BELL0 0x00000042 /* FIQ = ARM Doorbell 0 */
  2234. +#define ARM_IF_BELL1 0x00000043 /* FIQ = ARM Doorbell 1 */
  2235. +#define ARM_IF_VP0HALT 0x00000044 /* FIQ = VPU0 Halt seen */
  2236. +#define ARM_IF_VP1HALT 0x00000045 /* FIQ = VPU1 Halt seen */
  2237. +#define ARM_IF_ILLEGAL 0x00000046 /* FIQ = Illegal access seen */
  2238. +
  2239. +#define ARM_IRQ_ENBL1 HW_REGISTER_RW(ARM_BASE+0x210) /* Bank1 enable bits */
  2240. +#define ARM_IRQ_ENBL2 HW_REGISTER_RW(ARM_BASE+0x214) /* Bank2 enable bits */
  2241. +#define ARM_IRQ_ENBL3 HW_REGISTER_RW(ARM_BASE+0x218) /* ARM irqs enable bits */
  2242. +#define ARM_IRQ_DIBL1 HW_REGISTER_RW(ARM_BASE+0x21C) /* Bank1 disable bits */
  2243. +#define ARM_IRQ_DIBL2 HW_REGISTER_RW(ARM_BASE+0x220) /* Bank2 disable bits */
  2244. +#define ARM_IRQ_DIBL3 HW_REGISTER_RW(ARM_BASE+0x224) /* ARM irqs disable bits */
  2245. +#define ARM_IE_TIMER 0x00000001 /* Timer IRQ */
  2246. +#define ARM_IE_MAIL 0x00000002 /* Mail IRQ */
  2247. +#define ARM_IE_BELL0 0x00000004 /* Doorbell 0 */
  2248. +#define ARM_IE_BELL1 0x00000008 /* Doorbell 1 */
  2249. +#define ARM_IE_VP0HALT 0x00000010 /* VPU0 Halt */
  2250. +#define ARM_IE_VP1HALT 0x00000020 /* VPU1 Halt */
  2251. +#define ARM_IE_ILLEGAL 0x00000040 /* Illegal access seen */
  2252. +
  2253. +/* Timer */
  2254. +/* For reg. fields see sp804 spec. */
  2255. +#define ARM_T_LOAD HW_REGISTER_RW(ARM_BASE+0x400)
  2256. +#define ARM_T_VALUE HW_REGISTER_RW(ARM_BASE+0x404)
  2257. +#define ARM_T_CONTROL HW_REGISTER_RW(ARM_BASE+0x408)
  2258. +#define ARM_T_IRQCNTL HW_REGISTER_RW(ARM_BASE+0x40C)
  2259. +#define ARM_T_RAWIRQ HW_REGISTER_RW(ARM_BASE+0x410)
  2260. +#define ARM_T_MSKIRQ HW_REGISTER_RW(ARM_BASE+0x414)
  2261. +#define ARM_T_RELOAD HW_REGISTER_RW(ARM_BASE+0x418)
  2262. +#define ARM_T_PREDIV HW_REGISTER_RW(ARM_BASE+0x41c)
  2263. +#define ARM_T_FREECNT HW_REGISTER_RW(ARM_BASE+0x420)
  2264. +
  2265. +#define TIMER_CTRL_ONESHOT (1 << 0)
  2266. +#define TIMER_CTRL_32BIT (1 << 1)
  2267. +#define TIMER_CTRL_DIV1 (0 << 2)
  2268. +#define TIMER_CTRL_DIV16 (1 << 2)
  2269. +#define TIMER_CTRL_DIV256 (2 << 2)
  2270. +#define TIMER_CTRL_IE (1 << 5)
  2271. +#define TIMER_CTRL_PERIODIC (1 << 6)
  2272. +#define TIMER_CTRL_ENABLE (1 << 7)
  2273. +#define TIMER_CTRL_DBGHALT (1 << 8)
  2274. +#define TIMER_CTRL_ENAFREE (1 << 9)
  2275. +#define TIMER_CTRL_FREEDIV_SHIFT 16)
  2276. +#define TIMER_CTRL_FREEDIV_MASK 0xff
  2277. +
  2278. +/* Semaphores, Doorbells, Mailboxes */
  2279. +#define ARM_SBM_OWN0 (ARM_BASE+0x800)
  2280. +#define ARM_SBM_OWN1 (ARM_BASE+0x900)
  2281. +#define ARM_SBM_OWN2 (ARM_BASE+0xA00)
  2282. +#define ARM_SBM_OWN3 (ARM_BASE+0xB00)
  2283. +
  2284. +/* MAILBOXES
  2285. + * Register flags are common across all
  2286. + * owner registers. See end of this section
  2287. + *
  2288. + * Semaphores, Doorbells, Mailboxes Owner 0
  2289. + *
  2290. + */
  2291. +
  2292. +#define ARM_0_SEMS HW_REGISTER_RW(ARM_SBM_OWN0+0x00)
  2293. +#define ARM_0_SEM0 HW_REGISTER_RW(ARM_SBM_OWN0+0x00)
  2294. +#define ARM_0_SEM1 HW_REGISTER_RW(ARM_SBM_OWN0+0x04)
  2295. +#define ARM_0_SEM2 HW_REGISTER_RW(ARM_SBM_OWN0+0x08)
  2296. +#define ARM_0_SEM3 HW_REGISTER_RW(ARM_SBM_OWN0+0x0C)
  2297. +#define ARM_0_SEM4 HW_REGISTER_RW(ARM_SBM_OWN0+0x10)
  2298. +#define ARM_0_SEM5 HW_REGISTER_RW(ARM_SBM_OWN0+0x14)
  2299. +#define ARM_0_SEM6 HW_REGISTER_RW(ARM_SBM_OWN0+0x18)
  2300. +#define ARM_0_SEM7 HW_REGISTER_RW(ARM_SBM_OWN0+0x1C)
  2301. +#define ARM_0_BELL0 HW_REGISTER_RW(ARM_SBM_OWN0+0x40)
  2302. +#define ARM_0_BELL1 HW_REGISTER_RW(ARM_SBM_OWN0+0x44)
  2303. +#define ARM_0_BELL2 HW_REGISTER_RW(ARM_SBM_OWN0+0x48)
  2304. +#define ARM_0_BELL3 HW_REGISTER_RW(ARM_SBM_OWN0+0x4C)
  2305. +/* MAILBOX 0 access in Owner 0 area */
  2306. +/* Some addresses should ONLY be used by owner 0 */
  2307. +#define ARM_0_MAIL0_WRT HW_REGISTER_RW(ARM_SBM_OWN0+0x80) /* .. 0x8C (4 locations) */
  2308. +#define ARM_0_MAIL0_RD HW_REGISTER_RW(ARM_SBM_OWN0+0x80) /* .. 0x8C (4 locations) Normal read */
  2309. +#define ARM_0_MAIL0_POL HW_REGISTER_RW(ARM_SBM_OWN0+0x90) /* none-pop read */
  2310. +#define ARM_0_MAIL0_SND HW_REGISTER_RW(ARM_SBM_OWN0+0x94) /* Sender read (only LS 2 bits) */
  2311. +#define ARM_0_MAIL0_STA HW_REGISTER_RW(ARM_SBM_OWN0+0x98) /* Status read */
  2312. +#define ARM_0_MAIL0_CNF HW_REGISTER_RW(ARM_SBM_OWN0+0x9C) /* Config read/write */
  2313. +/* MAILBOX 1 access in Owner 0 area */
  2314. +/* Owner 0 should only WRITE to this mailbox */
  2315. +#define ARM_0_MAIL1_WRT HW_REGISTER_RW(ARM_SBM_OWN0+0xA0) /* .. 0xAC (4 locations) */
  2316. +/*#define ARM_0_MAIL1_RD HW_REGISTER_RW(ARM_SBM_OWN0+0xA0) */ /* DO NOT USE THIS !!!!! */
  2317. +/*#define ARM_0_MAIL1_POL HW_REGISTER_RW(ARM_SBM_OWN0+0xB0) */ /* DO NOT USE THIS !!!!! */
  2318. +/*#define ARM_0_MAIL1_SND HW_REGISTER_RW(ARM_SBM_OWN0+0xB4) */ /* DO NOT USE THIS !!!!! */
  2319. +#define ARM_0_MAIL1_STA HW_REGISTER_RW(ARM_SBM_OWN0+0xB8) /* Status read */
  2320. +/*#define ARM_0_MAIL1_CNF HW_REGISTER_RW(ARM_SBM_OWN0+0xBC) */ /* DO NOT USE THIS !!!!! */
  2321. +/* General SEM, BELL, MAIL config/status */
  2322. +#define ARM_0_SEMCLRDBG HW_REGISTER_RW(ARM_SBM_OWN0+0xE0) /* semaphore clear/debug register */
  2323. +#define ARM_0_BELLCLRDBG HW_REGISTER_RW(ARM_SBM_OWN0+0xE4) /* Doorbells clear/debug register */
  2324. +#define ARM_0_ALL_IRQS HW_REGISTER_RW(ARM_SBM_OWN0+0xF8) /* ALL interrupts */
  2325. +#define ARM_0_MY_IRQS HW_REGISTER_RW(ARM_SBM_OWN0+0xFC) /* IRQS pending for owner 0 */
  2326. +
  2327. +/* Semaphores, Doorbells, Mailboxes Owner 1 */
  2328. +#define ARM_1_SEMS HW_REGISTER_RW(ARM_SBM_OWN1+0x00)
  2329. +#define ARM_1_SEM0 HW_REGISTER_RW(ARM_SBM_OWN1+0x00)
  2330. +#define ARM_1_SEM1 HW_REGISTER_RW(ARM_SBM_OWN1+0x04)
  2331. +#define ARM_1_SEM2 HW_REGISTER_RW(ARM_SBM_OWN1+0x08)
  2332. +#define ARM_1_SEM3 HW_REGISTER_RW(ARM_SBM_OWN1+0x0C)
  2333. +#define ARM_1_SEM4 HW_REGISTER_RW(ARM_SBM_OWN1+0x10)
  2334. +#define ARM_1_SEM5 HW_REGISTER_RW(ARM_SBM_OWN1+0x14)
  2335. +#define ARM_1_SEM6 HW_REGISTER_RW(ARM_SBM_OWN1+0x18)
  2336. +#define ARM_1_SEM7 HW_REGISTER_RW(ARM_SBM_OWN1+0x1C)
  2337. +#define ARM_1_BELL0 HW_REGISTER_RW(ARM_SBM_OWN1+0x40)
  2338. +#define ARM_1_BELL1 HW_REGISTER_RW(ARM_SBM_OWN1+0x44)
  2339. +#define ARM_1_BELL2 HW_REGISTER_RW(ARM_SBM_OWN1+0x48)
  2340. +#define ARM_1_BELL3 HW_REGISTER_RW(ARM_SBM_OWN1+0x4C)
  2341. +/* MAILBOX 0 access in Owner 0 area */
  2342. +/* Owner 1 should only WRITE to this mailbox */
  2343. +#define ARM_1_MAIL0_WRT HW_REGISTER_RW(ARM_SBM_OWN1+0x80) /* .. 0x8C (4 locations) */
  2344. +/*#define ARM_1_MAIL0_RD HW_REGISTER_RW(ARM_SBM_OWN1+0x80) */ /* DO NOT USE THIS !!!!! */
  2345. +/*#define ARM_1_MAIL0_POL HW_REGISTER_RW(ARM_SBM_OWN1+0x90) */ /* DO NOT USE THIS !!!!! */
  2346. +/*#define ARM_1_MAIL0_SND HW_REGISTER_RW(ARM_SBM_OWN1+0x94) */ /* DO NOT USE THIS !!!!! */
  2347. +#define ARM_1_MAIL0_STA HW_REGISTER_RW(ARM_SBM_OWN1+0x98) /* Status read */
  2348. +/*#define ARM_1_MAIL0_CNF HW_REGISTER_RW(ARM_SBM_OWN1+0x9C) */ /* DO NOT USE THIS !!!!! */
  2349. +/* MAILBOX 1 access in Owner 0 area */
  2350. +#define ARM_1_MAIL1_WRT HW_REGISTER_RW(ARM_SBM_OWN1+0xA0) /* .. 0xAC (4 locations) */
  2351. +#define ARM_1_MAIL1_RD HW_REGISTER_RW(ARM_SBM_OWN1+0xA0) /* .. 0xAC (4 locations) Normal read */
  2352. +#define ARM_1_MAIL1_POL HW_REGISTER_RW(ARM_SBM_OWN1+0xB0) /* none-pop read */
  2353. +#define ARM_1_MAIL1_SND HW_REGISTER_RW(ARM_SBM_OWN1+0xB4) /* Sender read (only LS 2 bits) */
  2354. +#define ARM_1_MAIL1_STA HW_REGISTER_RW(ARM_SBM_OWN1+0xB8) /* Status read */
  2355. +#define ARM_1_MAIL1_CNF HW_REGISTER_RW(ARM_SBM_OWN1+0xBC)
  2356. +/* General SEM, BELL, MAIL config/status */
  2357. +#define ARM_1_SEMCLRDBG HW_REGISTER_RW(ARM_SBM_OWN1+0xE0) /* semaphore clear/debug register */
  2358. +#define ARM_1_BELLCLRDBG HW_REGISTER_RW(ARM_SBM_OWN1+0xE4) /* Doorbells clear/debug register */
  2359. +#define ARM_1_MY_IRQS HW_REGISTER_RW(ARM_SBM_OWN1+0xFC) /* IRQS pending for owner 1 */
  2360. +#define ARM_1_ALL_IRQS HW_REGISTER_RW(ARM_SBM_OWN1+0xF8) /* ALL interrupts */
  2361. +
  2362. +/* Semaphores, Doorbells, Mailboxes Owner 2 */
  2363. +#define ARM_2_SEMS HW_REGISTER_RW(ARM_SBM_OWN2+0x00)
  2364. +#define ARM_2_SEM0 HW_REGISTER_RW(ARM_SBM_OWN2+0x00)
  2365. +#define ARM_2_SEM1 HW_REGISTER_RW(ARM_SBM_OWN2+0x04)
  2366. +#define ARM_2_SEM2 HW_REGISTER_RW(ARM_SBM_OWN2+0x08)
  2367. +#define ARM_2_SEM3 HW_REGISTER_RW(ARM_SBM_OWN2+0x0C)
  2368. +#define ARM_2_SEM4 HW_REGISTER_RW(ARM_SBM_OWN2+0x10)
  2369. +#define ARM_2_SEM5 HW_REGISTER_RW(ARM_SBM_OWN2+0x14)
  2370. +#define ARM_2_SEM6 HW_REGISTER_RW(ARM_SBM_OWN2+0x18)
  2371. +#define ARM_2_SEM7 HW_REGISTER_RW(ARM_SBM_OWN2+0x1C)
  2372. +#define ARM_2_BELL0 HW_REGISTER_RW(ARM_SBM_OWN2+0x40)
  2373. +#define ARM_2_BELL1 HW_REGISTER_RW(ARM_SBM_OWN2+0x44)
  2374. +#define ARM_2_BELL2 HW_REGISTER_RW(ARM_SBM_OWN2+0x48)
  2375. +#define ARM_2_BELL3 HW_REGISTER_RW(ARM_SBM_OWN2+0x4C)
  2376. +/* MAILBOX 0 access in Owner 2 area */
  2377. +/* Owner 2 should only WRITE to this mailbox */
  2378. +#define ARM_2_MAIL0_WRT HW_REGISTER_RW(ARM_SBM_OWN2+0x80) /* .. 0x8C (4 locations) */
  2379. +/*#define ARM_2_MAIL0_RD HW_REGISTER_RW(ARM_SBM_OWN2+0x80) */ /* DO NOT USE THIS !!!!! */
  2380. +/*#define ARM_2_MAIL0_POL HW_REGISTER_RW(ARM_SBM_OWN2+0x90) */ /* DO NOT USE THIS !!!!! */
  2381. +/*#define ARM_2_MAIL0_SND HW_REGISTER_RW(ARM_SBM_OWN2+0x94) */ /* DO NOT USE THIS !!!!! */
  2382. +#define ARM_2_MAIL0_STA HW_REGISTER_RW(ARM_SBM_OWN2+0x98) /* Status read */
  2383. +/*#define ARM_2_MAIL0_CNF HW_REGISTER_RW(ARM_SBM_OWN2+0x9C) */ /* DO NOT USE THIS !!!!! */
  2384. +/* MAILBOX 1 access in Owner 2 area */
  2385. +/* Owner 2 should only WRITE to this mailbox */
  2386. +#define ARM_2_MAIL1_WRT HW_REGISTER_RW(ARM_SBM_OWN2+0xA0) /* .. 0xAC (4 locations) */
  2387. +/*#define ARM_2_MAIL1_RD HW_REGISTER_RW(ARM_SBM_OWN2+0xA0) */ /* DO NOT USE THIS !!!!! */
  2388. +/*#define ARM_2_MAIL1_POL HW_REGISTER_RW(ARM_SBM_OWN2+0xB0) */ /* DO NOT USE THIS !!!!! */
  2389. +/*#define ARM_2_MAIL1_SND HW_REGISTER_RW(ARM_SBM_OWN2+0xB4) */ /* DO NOT USE THIS !!!!! */
  2390. +#define ARM_2_MAIL1_STA HW_REGISTER_RW(ARM_SBM_OWN2+0xB8) /* Status read */
  2391. +/*#define ARM_2_MAIL1_CNF HW_REGISTER_RW(ARM_SBM_OWN2+0xBC) */ /* DO NOT USE THIS !!!!! */
  2392. +/* General SEM, BELL, MAIL config/status */
  2393. +#define ARM_2_SEMCLRDBG HW_REGISTER_RW(ARM_SBM_OWN2+0xE0) /* semaphore clear/debug register */
  2394. +#define ARM_2_BELLCLRDBG HW_REGISTER_RW(ARM_SBM_OWN2+0xE4) /* Doorbells clear/debug register */
  2395. +#define ARM_2_MY_IRQS HW_REGISTER_RW(ARM_SBM_OWN2+0xFC) /* IRQS pending for owner 2 */
  2396. +#define ARM_2_ALL_IRQS HW_REGISTER_RW(ARM_SBM_OWN2+0xF8) /* ALL interrupts */
  2397. +
  2398. +/* Semaphores, Doorbells, Mailboxes Owner 3 */
  2399. +#define ARM_3_SEMS HW_REGISTER_RW(ARM_SBM_OWN3+0x00)
  2400. +#define ARM_3_SEM0 HW_REGISTER_RW(ARM_SBM_OWN3+0x00)
  2401. +#define ARM_3_SEM1 HW_REGISTER_RW(ARM_SBM_OWN3+0x04)
  2402. +#define ARM_3_SEM2 HW_REGISTER_RW(ARM_SBM_OWN3+0x08)
  2403. +#define ARM_3_SEM3 HW_REGISTER_RW(ARM_SBM_OWN3+0x0C)
  2404. +#define ARM_3_SEM4 HW_REGISTER_RW(ARM_SBM_OWN3+0x10)
  2405. +#define ARM_3_SEM5 HW_REGISTER_RW(ARM_SBM_OWN3+0x14)
  2406. +#define ARM_3_SEM6 HW_REGISTER_RW(ARM_SBM_OWN3+0x18)
  2407. +#define ARM_3_SEM7 HW_REGISTER_RW(ARM_SBM_OWN3+0x1C)
  2408. +#define ARM_3_BELL0 HW_REGISTER_RW(ARM_SBM_OWN3+0x40)
  2409. +#define ARM_3_BELL1 HW_REGISTER_RW(ARM_SBM_OWN3+0x44)
  2410. +#define ARM_3_BELL2 HW_REGISTER_RW(ARM_SBM_OWN3+0x48)
  2411. +#define ARM_3_BELL3 HW_REGISTER_RW(ARM_SBM_OWN3+0x4C)
  2412. +/* MAILBOX 0 access in Owner 3 area */
  2413. +/* Owner 3 should only WRITE to this mailbox */
  2414. +#define ARM_3_MAIL0_WRT HW_REGISTER_RW(ARM_SBM_OWN3+0x80) /* .. 0x8C (4 locations) */
  2415. +/*#define ARM_3_MAIL0_RD HW_REGISTER_RW(ARM_SBM_OWN3+0x80) */ /* DO NOT USE THIS !!!!! */
  2416. +/*#define ARM_3_MAIL0_POL HW_REGISTER_RW(ARM_SBM_OWN3+0x90) */ /* DO NOT USE THIS !!!!! */
  2417. +/*#define ARM_3_MAIL0_SND HW_REGISTER_RW(ARM_SBM_OWN3+0x94) */ /* DO NOT USE THIS !!!!! */
  2418. +#define ARM_3_MAIL0_STA HW_REGISTER_RW(ARM_SBM_OWN3+0x98) /* Status read */
  2419. +/*#define ARM_3_MAIL0_CNF HW_REGISTER_RW(ARM_SBM_OWN3+0x9C) */ /* DO NOT USE THIS !!!!! */
  2420. +/* MAILBOX 1 access in Owner 3 area */
  2421. +/* Owner 3 should only WRITE to this mailbox */
  2422. +#define ARM_3_MAIL1_WRT HW_REGISTER_RW(ARM_SBM_OWN3+0xA0) /* .. 0xAC (4 locations) */
  2423. +/*#define ARM_3_MAIL1_RD HW_REGISTER_RW(ARM_SBM_OWN3+0xA0) */ /* DO NOT USE THIS !!!!! */
  2424. +/*#define ARM_3_MAIL1_POL HW_REGISTER_RW(ARM_SBM_OWN3+0xB0) */ /* DO NOT USE THIS !!!!! */
  2425. +/*#define ARM_3_MAIL1_SND HW_REGISTER_RW(ARM_SBM_OWN3+0xB4) */ /* DO NOT USE THIS !!!!! */
  2426. +#define ARM_3_MAIL1_STA HW_REGISTER_RW(ARM_SBM_OWN3+0xB8) /* Status read */
  2427. +/*#define ARM_3_MAIL1_CNF HW_REGISTER_RW(ARM_SBM_OWN3+0xBC) */ /* DO NOT USE THIS !!!!! */
  2428. +/* General SEM, BELL, MAIL config/status */
  2429. +#define ARM_3_SEMCLRDBG HW_REGISTER_RW(ARM_SBM_OWN3+0xE0) /* semaphore clear/debug register */
  2430. +#define ARM_3_BELLCLRDBG HW_REGISTER_RW(ARM_SBM_OWN3+0xE4) /* Doorbells clear/debug register */
  2431. +#define ARM_3_MY_IRQS HW_REGISTER_RW(ARM_SBM_OWN3+0xFC) /* IRQS pending for owner 3 */
  2432. +#define ARM_3_ALL_IRQS HW_REGISTER_RW(ARM_SBM_OWN3+0xF8) /* ALL interrupts */
  2433. +
  2434. +
  2435. +
  2436. +/* Mailbox flags. Valid for all owners */
  2437. +
  2438. +/* Mailbox status register (...0x98) */
  2439. +#define ARM_MS_FULL 0x80000000
  2440. +#define ARM_MS_EMPTY 0x40000000
  2441. +#define ARM_MS_LEVEL 0x400000FF /* Max. value depdnds on mailbox depth parameter */
  2442. +
  2443. +/* MAILBOX config/status register (...0x9C) */
  2444. +/* ANY write to this register clears the error bits! */
  2445. +#define ARM_MC_IHAVEDATAIRQEN 0x00000001 /* mailbox irq enable: has data */
  2446. +#define ARM_MC_IHAVESPACEIRQEN 0x00000002 /* mailbox irq enable: has space */
  2447. +#define ARM_MC_OPPISEMPTYIRQEN 0x00000004 /* mailbox irq enable: Opp. is empty */
  2448. +#define ARM_MC_MAIL_CLEAR 0x00000008 /* mailbox clear write 1, then 0 */
  2449. +#define ARM_MC_IHAVEDATAIRQPEND 0x00000010 /* mailbox irq pending: has space */
  2450. +#define ARM_MC_IHAVESPACEIRQPEND 0x00000020 /* mailbox irq pending: Opp. is empty */
  2451. +#define ARM_MC_OPPISEMPTYIRQPEND 0x00000040 /* mailbox irq pending */
  2452. +/* Bit 7 is unused */
  2453. +#define ARM_MC_ERRNOOWN 0x00000100 /* error : none owner read from mailbox */
  2454. +#define ARM_MC_ERROVERFLW 0x00000200 /* error : write to fill mailbox */
  2455. +#define ARM_MC_ERRUNDRFLW 0x00000400 /* error : read from empty mailbox */
  2456. +
  2457. +/* Semaphore clear/debug register (...0xE0) */
  2458. +#define ARM_SD_OWN0 0x00000003 /* Owner of sem 0 */
  2459. +#define ARM_SD_OWN1 0x0000000C /* Owner of sem 1 */
  2460. +#define ARM_SD_OWN2 0x00000030 /* Owner of sem 2 */
  2461. +#define ARM_SD_OWN3 0x000000C0 /* Owner of sem 3 */
  2462. +#define ARM_SD_OWN4 0x00000300 /* Owner of sem 4 */
  2463. +#define ARM_SD_OWN5 0x00000C00 /* Owner of sem 5 */
  2464. +#define ARM_SD_OWN6 0x00003000 /* Owner of sem 6 */
  2465. +#define ARM_SD_OWN7 0x0000C000 /* Owner of sem 7 */
  2466. +#define ARM_SD_SEM0 0x00010000 /* Status of sem 0 */
  2467. +#define ARM_SD_SEM1 0x00020000 /* Status of sem 1 */
  2468. +#define ARM_SD_SEM2 0x00040000 /* Status of sem 2 */
  2469. +#define ARM_SD_SEM3 0x00080000 /* Status of sem 3 */
  2470. +#define ARM_SD_SEM4 0x00100000 /* Status of sem 4 */
  2471. +#define ARM_SD_SEM5 0x00200000 /* Status of sem 5 */
  2472. +#define ARM_SD_SEM6 0x00400000 /* Status of sem 6 */
  2473. +#define ARM_SD_SEM7 0x00800000 /* Status of sem 7 */
  2474. +
  2475. +/* Doorbells clear/debug register (...0xE4) */
  2476. +#define ARM_BD_OWN0 0x00000003 /* Owner of doorbell 0 */
  2477. +#define ARM_BD_OWN1 0x0000000C /* Owner of doorbell 1 */
  2478. +#define ARM_BD_OWN2 0x00000030 /* Owner of doorbell 2 */
  2479. +#define ARM_BD_OWN3 0x000000C0 /* Owner of doorbell 3 */
  2480. +#define ARM_BD_BELL0 0x00000100 /* Status of doorbell 0 */
  2481. +#define ARM_BD_BELL1 0x00000200 /* Status of doorbell 1 */
  2482. +#define ARM_BD_BELL2 0x00000400 /* Status of doorbell 2 */
  2483. +#define ARM_BD_BELL3 0x00000800 /* Status of doorbell 3 */
  2484. +
  2485. +/* MY IRQS register (...0xF8) */
  2486. +#define ARM_MYIRQ_BELL 0x00000001 /* This owner has a doorbell IRQ */
  2487. +#define ARM_MYIRQ_MAIL 0x00000002 /* This owner has a mailbox IRQ */
  2488. +
  2489. +/* ALL IRQS register (...0xF8) */
  2490. +#define ARM_AIS_BELL0 0x00000001 /* Doorbell 0 IRQ pending */
  2491. +#define ARM_AIS_BELL1 0x00000002 /* Doorbell 1 IRQ pending */
  2492. +#define ARM_AIS_BELL2 0x00000004 /* Doorbell 2 IRQ pending */
  2493. +#define ARM_AIS_BELL3 0x00000008 /* Doorbell 3 IRQ pending */
  2494. +#define ARM_AIS0_HAVEDATA 0x00000010 /* MAIL 0 has data IRQ pending */
  2495. +#define ARM_AIS0_HAVESPAC 0x00000020 /* MAIL 0 has space IRQ pending */
  2496. +#define ARM_AIS0_OPPEMPTY 0x00000040 /* MAIL 0 opposite is empty IRQ */
  2497. +#define ARM_AIS1_HAVEDATA 0x00000080 /* MAIL 1 has data IRQ pending */
  2498. +#define ARM_AIS1_HAVESPAC 0x00000100 /* MAIL 1 has space IRQ pending */
  2499. +#define ARM_AIS1_OPPEMPTY 0x00000200 /* MAIL 1 opposite is empty IRQ */
  2500. +/* Note that bell-0, bell-1 and MAIL0 IRQ go only to the ARM */
  2501. +/* Whilst that bell-2, bell-3 and MAIL1 IRQ go only to the VC */
  2502. +/* */
  2503. +/* ARM JTAG BASH */
  2504. +/* */
  2505. +#define AJB_BASE 0x7e2000c0
  2506. +
  2507. +#define AJBCONF HW_REGISTER_RW(AJB_BASE+0x00)
  2508. +#define AJB_BITS0 0x000000
  2509. +#define AJB_BITS4 0x000004
  2510. +#define AJB_BITS8 0x000008
  2511. +#define AJB_BITS12 0x00000C
  2512. +#define AJB_BITS16 0x000010
  2513. +#define AJB_BITS20 0x000014
  2514. +#define AJB_BITS24 0x000018
  2515. +#define AJB_BITS28 0x00001C
  2516. +#define AJB_BITS32 0x000020
  2517. +#define AJB_BITS34 0x000022
  2518. +#define AJB_OUT_MS 0x000040
  2519. +#define AJB_OUT_LS 0x000000
  2520. +#define AJB_INV_CLK 0x000080
  2521. +#define AJB_D0_RISE 0x000100
  2522. +#define AJB_D0_FALL 0x000000
  2523. +#define AJB_D1_RISE 0x000200
  2524. +#define AJB_D1_FALL 0x000000
  2525. +#define AJB_IN_RISE 0x000400
  2526. +#define AJB_IN_FALL 0x000000
  2527. +#define AJB_ENABLE 0x000800
  2528. +#define AJB_HOLD0 0x000000
  2529. +#define AJB_HOLD1 0x001000
  2530. +#define AJB_HOLD2 0x002000
  2531. +#define AJB_HOLD3 0x003000
  2532. +#define AJB_RESETN 0x004000
  2533. +#define AJB_CLKSHFT 16
  2534. +#define AJB_BUSY 0x80000000
  2535. +#define AJBTMS HW_REGISTER_RW(AJB_BASE+0x04)
  2536. +#define AJBTDI HW_REGISTER_RW(AJB_BASE+0x08)
  2537. +#define AJBTDO HW_REGISTER_RW(AJB_BASE+0x0c)
  2538. +
  2539. +#endif
  2540. --- /dev/null
  2541. +++ b/arch/arm/mach-bcm2708/include/mach/arm_power.h
  2542. @@ -0,0 +1,62 @@
  2543. +/*
  2544. + * linux/arch/arm/mach-bcm2708/include/mach/arm_power.h
  2545. + *
  2546. + * Copyright (C) 2010 Broadcom
  2547. + *
  2548. + * This program is free software; you can redistribute it and/or modify
  2549. + * it under the terms of the GNU General Public License as published by
  2550. + * the Free Software Foundation; either version 2 of the License, or
  2551. + * (at your option) any later version.
  2552. + *
  2553. + * This program is distributed in the hope that it will be useful,
  2554. + * but WITHOUT ANY WARRANTY; without even the implied warranty of
  2555. + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  2556. + * GNU General Public License for more details.
  2557. + *
  2558. + * You should have received a copy of the GNU General Public License
  2559. + * along with this program; if not, write to the Free Software
  2560. + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
  2561. + */
  2562. +
  2563. +#ifndef _ARM_POWER_H
  2564. +#define _ARM_POWER_H
  2565. +
  2566. +/* Use meaningful names on each side */
  2567. +#ifdef __VIDEOCORE__
  2568. +#define PREFIX(x) ARM_##x
  2569. +#else
  2570. +#define PREFIX(x) BCM_##x
  2571. +#endif
  2572. +
  2573. +enum {
  2574. + PREFIX(POWER_SDCARD_BIT),
  2575. + PREFIX(POWER_UART_BIT),
  2576. + PREFIX(POWER_MINIUART_BIT),
  2577. + PREFIX(POWER_USB_BIT),
  2578. + PREFIX(POWER_I2C0_BIT),
  2579. + PREFIX(POWER_I2C1_BIT),
  2580. + PREFIX(POWER_I2C2_BIT),
  2581. + PREFIX(POWER_SPI_BIT),
  2582. + PREFIX(POWER_CCP2TX_BIT),
  2583. + PREFIX(POWER_DSI_BIT),
  2584. +
  2585. + PREFIX(POWER_MAX)
  2586. +};
  2587. +
  2588. +enum {
  2589. + PREFIX(POWER_SDCARD) = (1 << PREFIX(POWER_SDCARD_BIT)),
  2590. + PREFIX(POWER_UART) = (1 << PREFIX(POWER_UART_BIT)),
  2591. + PREFIX(POWER_MINIUART) = (1 << PREFIX(POWER_MINIUART_BIT)),
  2592. + PREFIX(POWER_USB) = (1 << PREFIX(POWER_USB_BIT)),
  2593. + PREFIX(POWER_I2C0) = (1 << PREFIX(POWER_I2C0_BIT)),
  2594. + PREFIX(POWER_I2C1_MASK) = (1 << PREFIX(POWER_I2C1_BIT)),
  2595. + PREFIX(POWER_I2C2_MASK) = (1 << PREFIX(POWER_I2C2_BIT)),
  2596. + PREFIX(POWER_SPI_MASK) = (1 << PREFIX(POWER_SPI_BIT)),
  2597. + PREFIX(POWER_CCP2TX_MASK) = (1 << PREFIX(POWER_CCP2TX_BIT)),
  2598. + PREFIX(POWER_DSI) = (1 << PREFIX(POWER_DSI_BIT)),
  2599. +
  2600. + PREFIX(POWER_MASK) = (1 << PREFIX(POWER_MAX)) - 1,
  2601. + PREFIX(POWER_NONE) = 0
  2602. +};
  2603. +
  2604. +#endif
  2605. --- /dev/null
  2606. +++ b/arch/arm/mach-bcm2708/include/mach/clkdev.h
  2607. @@ -0,0 +1,7 @@
  2608. +#ifndef __ASM_MACH_CLKDEV_H
  2609. +#define __ASM_MACH_CLKDEV_H
  2610. +
  2611. +#define __clk_get(clk) ({ 1; })
  2612. +#define __clk_put(clk) do { } while (0)
  2613. +
  2614. +#endif
  2615. --- /dev/null
  2616. +++ b/arch/arm/mach-bcm2708/include/mach/debug-macro.S
  2617. @@ -0,0 +1,22 @@
  2618. +/* arch/arm/mach-bcm2708/include/mach/debug-macro.S
  2619. + *
  2620. + * Debugging macro include header
  2621. + *
  2622. + * Copyright (C) 2010 Broadcom
  2623. + * Copyright (C) 1994-1999 Russell King
  2624. + * Moved from linux/arch/arm/kernel/debug.S by Ben Dooks
  2625. + *
  2626. + * This program is free software; you can redistribute it and/or modify
  2627. + * it under the terms of the GNU General Public License version 2 as
  2628. + * published by the Free Software Foundation.
  2629. + *
  2630. +*/
  2631. +
  2632. +#include <mach/platform.h>
  2633. +
  2634. + .macro addruart, rp, rv, tmp
  2635. + ldr \rp, =UART0_BASE
  2636. + ldr \rv, =IO_ADDRESS(UART0_BASE)
  2637. + .endm
  2638. +
  2639. +#include <debug/pl01x.S>
  2640. --- /dev/null
  2641. +++ b/arch/arm/mach-bcm2708/include/mach/dma.h
  2642. @@ -0,0 +1,88 @@
  2643. +/*
  2644. + * linux/arch/arm/mach-bcm2708/include/mach/dma.h
  2645. + *
  2646. + * Copyright (C) 2010 Broadcom
  2647. + *
  2648. + * This program is free software; you can redistribute it and/or modify
  2649. + * it under the terms of the GNU General Public License version 2 as
  2650. + * published by the Free Software Foundation.
  2651. + */
  2652. +
  2653. +
  2654. +#ifndef _MACH_BCM2708_DMA_H
  2655. +#define _MACH_BCM2708_DMA_H
  2656. +
  2657. +#define BCM_DMAMAN_DRIVER_NAME "bcm2708_dma"
  2658. +
  2659. +/* DMA CS Control and Status bits */
  2660. +#define BCM2708_DMA_ACTIVE (1 << 0)
  2661. +#define BCM2708_DMA_INT (1 << 2)
  2662. +#define BCM2708_DMA_ISPAUSED (1 << 4) /* Pause requested or not active */
  2663. +#define BCM2708_DMA_ISHELD (1 << 5) /* Is held by DREQ flow control */
  2664. +#define BCM2708_DMA_ERR (1 << 8)
  2665. +#define BCM2708_DMA_ABORT (1 << 30) /* stop current CB, go to next, WO */
  2666. +#define BCM2708_DMA_RESET (1 << 31) /* WO, self clearing */
  2667. +
  2668. +/* DMA control block "info" field bits */
  2669. +#define BCM2708_DMA_INT_EN (1 << 0)
  2670. +#define BCM2708_DMA_TDMODE (1 << 1)
  2671. +#define BCM2708_DMA_WAIT_RESP (1 << 3)
  2672. +#define BCM2708_DMA_D_INC (1 << 4)
  2673. +#define BCM2708_DMA_D_WIDTH (1 << 5)
  2674. +#define BCM2708_DMA_D_DREQ (1 << 6)
  2675. +#define BCM2708_DMA_S_INC (1 << 8)
  2676. +#define BCM2708_DMA_S_WIDTH (1 << 9)
  2677. +#define BCM2708_DMA_S_DREQ (1 << 10)
  2678. +
  2679. +#define BCM2708_DMA_BURST(x) (((x)&0xf) << 12)
  2680. +#define BCM2708_DMA_PER_MAP(x) ((x) << 16)
  2681. +#define BCM2708_DMA_WAITS(x) (((x)&0x1f) << 21)
  2682. +
  2683. +#define BCM2708_DMA_DREQ_EMMC 11
  2684. +#define BCM2708_DMA_DREQ_SDHOST 13
  2685. +
  2686. +#define BCM2708_DMA_CS 0x00 /* Control and Status */
  2687. +#define BCM2708_DMA_ADDR 0x04
  2688. +/* the current control block appears in the following registers - read only */
  2689. +#define BCM2708_DMA_INFO 0x08
  2690. +#define BCM2708_DMA_SOURCE_AD 0x0c
  2691. +#define BCM2708_DMA_DEST_AD 0x10
  2692. +#define BCM2708_DMA_NEXTCB 0x1C
  2693. +#define BCM2708_DMA_DEBUG 0x20
  2694. +
  2695. +#define BCM2708_DMA4_CS (BCM2708_DMA_CHAN(4)+BCM2708_DMA_CS)
  2696. +#define BCM2708_DMA4_ADDR (BCM2708_DMA_CHAN(4)+BCM2708_DMA_ADDR)
  2697. +
  2698. +#define BCM2708_DMA_TDMODE_LEN(w, h) ((h) << 16 | (w))
  2699. +
  2700. +struct bcm2708_dma_cb {
  2701. + unsigned long info;
  2702. + unsigned long src;
  2703. + unsigned long dst;
  2704. + unsigned long length;
  2705. + unsigned long stride;
  2706. + unsigned long next;
  2707. + unsigned long pad[2];
  2708. +};
  2709. +
  2710. +extern int bcm_sg_suitable_for_dma(struct scatterlist *sg_ptr, int sg_len);
  2711. +extern void bcm_dma_start(void __iomem *dma_chan_base,
  2712. + dma_addr_t control_block);
  2713. +extern void bcm_dma_wait_idle(void __iomem *dma_chan_base);
  2714. +extern int /*rc*/ bcm_dma_abort(void __iomem *dma_chan_base);
  2715. +
  2716. +/* When listing features we can ask for when allocating DMA channels give
  2717. + those with higher priority smaller ordinal numbers */
  2718. +#define BCM_DMA_FEATURE_FAST_ORD 0
  2719. +#define BCM_DMA_FEATURE_BULK_ORD 1
  2720. +#define BCM_DMA_FEATURE_FAST (1<<BCM_DMA_FEATURE_FAST_ORD)
  2721. +#define BCM_DMA_FEATURE_BULK (1<<BCM_DMA_FEATURE_BULK_ORD)
  2722. +#define BCM_DMA_FEATURE_COUNT 2
  2723. +
  2724. +/* return channel no or -ve error */
  2725. +extern int bcm_dma_chan_alloc(unsigned preferred_feature_set,
  2726. + void __iomem **out_dma_base, int *out_dma_irq);
  2727. +extern int bcm_dma_chan_free(int channel);
  2728. +
  2729. +
  2730. +#endif /* _MACH_BCM2708_DMA_H */
  2731. --- /dev/null
  2732. +++ b/arch/arm/mach-bcm2708/include/mach/entry-macro.S
  2733. @@ -0,0 +1,69 @@
  2734. +/*
  2735. + * arch/arm/mach-bcm2708/include/mach/entry-macro.S
  2736. + *
  2737. + * Low-level IRQ helper macros for BCM2708 platforms
  2738. + *
  2739. + * Copyright (C) 2010 Broadcom
  2740. + *
  2741. + * This program is free software; you can redistribute it and/or modify
  2742. + * it under the terms of the GNU General Public License as published by
  2743. + * the Free Software Foundation; either version 2 of the License, or
  2744. + * (at your option) any later version.
  2745. + *
  2746. + * This program is distributed in the hope that it will be useful,
  2747. + * but WITHOUT ANY WARRANTY; without even the implied warranty of
  2748. + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  2749. + * GNU General Public License for more details.
  2750. + *
  2751. + * You should have received a copy of the GNU General Public License
  2752. + * along with this program; if not, write to the Free Software
  2753. + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
  2754. + */
  2755. +#include <mach/hardware.h>
  2756. +
  2757. + .macro disable_fiq
  2758. + .endm
  2759. +
  2760. + .macro get_irqnr_preamble, base, tmp
  2761. + ldr \base, =IO_ADDRESS(ARMCTRL_IC_BASE)
  2762. + .endm
  2763. +
  2764. + .macro arch_ret_to_user, tmp1, tmp2
  2765. + .endm
  2766. +
  2767. + .macro get_irqnr_and_base, irqnr, irqstat, base, tmp
  2768. + /* get masked status */
  2769. + ldr \irqstat, [\base, #(ARM_IRQ_PEND0 - ARMCTRL_IC_BASE)]
  2770. + mov \irqnr, #(ARM_IRQ0_BASE + 31)
  2771. + and \tmp, \irqstat, #0x300 @ save bits 8 and 9
  2772. + /* clear bits 8 and 9, and test */
  2773. + bics \irqstat, \irqstat, #0x300
  2774. + bne 1010f
  2775. +
  2776. + tst \tmp, #0x100
  2777. + ldrne \irqstat, [\base, #(ARM_IRQ_PEND1 - ARMCTRL_IC_BASE)]
  2778. + movne \irqnr, #(ARM_IRQ1_BASE + 31)
  2779. + @ Mask out the interrupts also present in PEND0 - see SW-5809
  2780. + bicne \irqstat, #((1<<7) | (1<<9) | (1<<10))
  2781. + bicne \irqstat, #((1<<18) | (1<<19))
  2782. + bne 1010f
  2783. +
  2784. + tst \tmp, #0x200
  2785. + ldrne \irqstat, [\base, #(ARM_IRQ_PEND2 - ARMCTRL_IC_BASE)]
  2786. + movne \irqnr, #(ARM_IRQ2_BASE + 31)
  2787. + @ Mask out the interrupts also present in PEND0 - see SW-5809
  2788. + bicne \irqstat, #((1<<21) | (1<<22) | (1<<23) | (1<<24) | (1<<25))
  2789. + bicne \irqstat, #((1<<30))
  2790. + beq 1020f
  2791. +
  2792. +1010:
  2793. + @ For non-zero x, LSB(x) = 31 - CLZ(x^(x-1))
  2794. + @ N.B. CLZ is an ARM5 instruction.
  2795. + sub \tmp, \irqstat, #1
  2796. + eor \irqstat, \irqstat, \tmp
  2797. + clz \tmp, \irqstat
  2798. + sub \irqnr, \tmp
  2799. +
  2800. +1020: @ EQ will be set if no irqs pending
  2801. +
  2802. + .endm
  2803. --- /dev/null
  2804. +++ b/arch/arm/mach-bcm2708/include/mach/frc.h
  2805. @@ -0,0 +1,38 @@
  2806. +/*
  2807. + * arch/arm/mach-bcm2708/include/mach/timex.h
  2808. + *
  2809. + * BCM2708 free running counter (timer)
  2810. + *
  2811. + * Copyright (C) 2010 Broadcom
  2812. + *
  2813. + * This program is free software; you can redistribute it and/or modify
  2814. + * it under the terms of the GNU General Public License as published by
  2815. + * the Free Software Foundation; either version 2 of the License, or
  2816. + * (at your option) any later version.
  2817. + *
  2818. + * This program is distributed in the hope that it will be useful,
  2819. + * but WITHOUT ANY WARRANTY; without even the implied warranty of
  2820. + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  2821. + * GNU General Public License for more details.
  2822. + *
  2823. + * You should have received a copy of the GNU General Public License
  2824. + * along with this program; if not, write to the Free Software
  2825. + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
  2826. + */
  2827. +
  2828. +#ifndef _MACH_FRC_H
  2829. +#define _MACH_FRC_H
  2830. +
  2831. +#define FRC_TICK_RATE (1000000)
  2832. +
  2833. +/*! Free running counter incrementing at the CLOCK_TICK_RATE
  2834. + (slightly faster than frc_clock_ticks63()
  2835. + */
  2836. +extern unsigned long frc_clock_ticks32(void);
  2837. +
  2838. +/*! Free running counter incrementing at the CLOCK_TICK_RATE
  2839. + * Note - top bit should be ignored (see cnt32_to_63)
  2840. + */
  2841. +extern unsigned long long frc_clock_ticks63(void);
  2842. +
  2843. +#endif
  2844. --- /dev/null
  2845. +++ b/arch/arm/mach-bcm2708/include/mach/hardware.h
  2846. @@ -0,0 +1,28 @@
  2847. +/*
  2848. + * arch/arm/mach-bcm2708/include/mach/hardware.h
  2849. + *
  2850. + * This file contains the hardware definitions of the BCM2708 devices.
  2851. + *
  2852. + * Copyright (C) 2010 Broadcom
  2853. + *
  2854. + * This program is free software; you can redistribute it and/or modify
  2855. + * it under the terms of the GNU General Public License as published by
  2856. + * the Free Software Foundation; either version 2 of the License, or
  2857. + * (at your option) any later version.
  2858. + *
  2859. + * This program is distributed in the hope that it will be useful,
  2860. + * but WITHOUT ANY WARRANTY; without even the implied warranty of
  2861. + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  2862. + * GNU General Public License for more details.
  2863. + *
  2864. + * You should have received a copy of the GNU General Public License
  2865. + * along with this program; if not, write to the Free Software
  2866. + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
  2867. + */
  2868. +#ifndef __ASM_ARCH_HARDWARE_H
  2869. +#define __ASM_ARCH_HARDWARE_H
  2870. +
  2871. +#include <asm/sizes.h>
  2872. +#include <mach/platform.h>
  2873. +
  2874. +#endif
  2875. --- /dev/null
  2876. +++ b/arch/arm/mach-bcm2708/include/mach/io.h
  2877. @@ -0,0 +1,27 @@
  2878. +/*
  2879. + * arch/arm/mach-bcm2708/include/mach/io.h
  2880. + *
  2881. + * Copyright (C) 2003 ARM Limited
  2882. + *
  2883. + * This program is free software; you can redistribute it and/or modify
  2884. + * it under the terms of the GNU General Public License as published by
  2885. + * the Free Software Foundation; either version 2 of the License, or
  2886. + * (at your option) any later version.
  2887. + *
  2888. + * This program is distributed in the hope that it will be useful,
  2889. + * but WITHOUT ANY WARRANTY; without even the implied warranty of
  2890. + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  2891. + * GNU General Public License for more details.
  2892. + *
  2893. + * You should have received a copy of the GNU General Public License
  2894. + * along with this program; if not, write to the Free Software
  2895. + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
  2896. + */
  2897. +#ifndef __ASM_ARM_ARCH_IO_H
  2898. +#define __ASM_ARM_ARCH_IO_H
  2899. +
  2900. +#define IO_SPACE_LIMIT 0xffffffff
  2901. +
  2902. +#define __io(a) __typesafe_io(a)
  2903. +
  2904. +#endif
  2905. --- /dev/null
  2906. +++ b/arch/arm/mach-bcm2708/include/mach/irqs.h
  2907. @@ -0,0 +1,196 @@
  2908. +/*
  2909. + * arch/arm/mach-bcm2708/include/mach/irqs.h
  2910. + *
  2911. + * Copyright (C) 2010 Broadcom
  2912. + * Copyright (C) 2003 ARM Limited
  2913. + * Copyright (C) 2000 Deep Blue Solutions Ltd.
  2914. + *
  2915. + * This program is free software; you can redistribute it and/or modify
  2916. + * it under the terms of the GNU General Public License as published by
  2917. + * the Free Software Foundation; either version 2 of the License, or
  2918. + * (at your option) any later version.
  2919. + *
  2920. + * This program is distributed in the hope that it will be useful,
  2921. + * but WITHOUT ANY WARRANTY; without even the implied warranty of
  2922. + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  2923. + * GNU General Public License for more details.
  2924. + *
  2925. + * You should have received a copy of the GNU General Public License
  2926. + * along with this program; if not, write to the Free Software
  2927. + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
  2928. + */
  2929. +
  2930. +#ifndef _BCM2708_IRQS_H_
  2931. +#define _BCM2708_IRQS_H_
  2932. +
  2933. +#include <mach/platform.h>
  2934. +
  2935. +/*
  2936. + * IRQ interrupts definitions are the same as the INT definitions
  2937. + * held within platform.h
  2938. + */
  2939. +#define IRQ_ARMCTRL_START 0
  2940. +#define IRQ_TIMER0 (IRQ_ARMCTRL_START + INTERRUPT_TIMER0)
  2941. +#define IRQ_TIMER1 (IRQ_ARMCTRL_START + INTERRUPT_TIMER1)
  2942. +#define IRQ_TIMER2 (IRQ_ARMCTRL_START + INTERRUPT_TIMER2)
  2943. +#define IRQ_TIMER3 (IRQ_ARMCTRL_START + INTERRUPT_TIMER3)
  2944. +#define IRQ_CODEC0 (IRQ_ARMCTRL_START + INTERRUPT_CODEC0)
  2945. +#define IRQ_CODEC1 (IRQ_ARMCTRL_START + INTERRUPT_CODEC1)
  2946. +#define IRQ_CODEC2 (IRQ_ARMCTRL_START + INTERRUPT_CODEC2)
  2947. +#define IRQ_JPEG (IRQ_ARMCTRL_START + INTERRUPT_JPEG)
  2948. +#define IRQ_ISP (IRQ_ARMCTRL_START + INTERRUPT_ISP)
  2949. +#define IRQ_USB (IRQ_ARMCTRL_START + INTERRUPT_USB)
  2950. +#define IRQ_3D (IRQ_ARMCTRL_START + INTERRUPT_3D)
  2951. +#define IRQ_TRANSPOSER (IRQ_ARMCTRL_START + INTERRUPT_TRANSPOSER)
  2952. +#define IRQ_MULTICORESYNC0 (IRQ_ARMCTRL_START + INTERRUPT_MULTICORESYNC0)
  2953. +#define IRQ_MULTICORESYNC1 (IRQ_ARMCTRL_START + INTERRUPT_MULTICORESYNC1)
  2954. +#define IRQ_MULTICORESYNC2 (IRQ_ARMCTRL_START + INTERRUPT_MULTICORESYNC2)
  2955. +#define IRQ_MULTICORESYNC3 (IRQ_ARMCTRL_START + INTERRUPT_MULTICORESYNC3)
  2956. +#define IRQ_DMA0 (IRQ_ARMCTRL_START + INTERRUPT_DMA0)
  2957. +#define IRQ_DMA1 (IRQ_ARMCTRL_START + INTERRUPT_DMA1)
  2958. +#define IRQ_DMA2 (IRQ_ARMCTRL_START + INTERRUPT_DMA2)
  2959. +#define IRQ_DMA3 (IRQ_ARMCTRL_START + INTERRUPT_DMA3)
  2960. +#define IRQ_DMA4 (IRQ_ARMCTRL_START + INTERRUPT_DMA4)
  2961. +#define IRQ_DMA5 (IRQ_ARMCTRL_START + INTERRUPT_DMA5)
  2962. +#define IRQ_DMA6 (IRQ_ARMCTRL_START + INTERRUPT_DMA6)
  2963. +#define IRQ_DMA7 (IRQ_ARMCTRL_START + INTERRUPT_DMA7)
  2964. +#define IRQ_DMA8 (IRQ_ARMCTRL_START + INTERRUPT_DMA8)
  2965. +#define IRQ_DMA9 (IRQ_ARMCTRL_START + INTERRUPT_DMA9)
  2966. +#define IRQ_DMA10 (IRQ_ARMCTRL_START + INTERRUPT_DMA10)
  2967. +#define IRQ_DMA11 (IRQ_ARMCTRL_START + INTERRUPT_DMA11)
  2968. +#define IRQ_DMA12 (IRQ_ARMCTRL_START + INTERRUPT_DMA12)
  2969. +#define IRQ_AUX (IRQ_ARMCTRL_START + INTERRUPT_AUX)
  2970. +#define IRQ_ARM (IRQ_ARMCTRL_START + INTERRUPT_ARM)
  2971. +#define IRQ_VPUDMA (IRQ_ARMCTRL_START + INTERRUPT_VPUDMA)
  2972. +#define IRQ_HOSTPORT (IRQ_ARMCTRL_START + INTERRUPT_HOSTPORT)
  2973. +#define IRQ_VIDEOSCALER (IRQ_ARMCTRL_START + INTERRUPT_VIDEOSCALER)
  2974. +#define IRQ_CCP2TX (IRQ_ARMCTRL_START + INTERRUPT_CCP2TX)
  2975. +#define IRQ_SDC (IRQ_ARMCTRL_START + INTERRUPT_SDC)
  2976. +#define IRQ_DSI0 (IRQ_ARMCTRL_START + INTERRUPT_DSI0)
  2977. +#define IRQ_AVE (IRQ_ARMCTRL_START + INTERRUPT_AVE)
  2978. +#define IRQ_CAM0 (IRQ_ARMCTRL_START + INTERRUPT_CAM0)
  2979. +#define IRQ_CAM1 (IRQ_ARMCTRL_START + INTERRUPT_CAM1)
  2980. +#define IRQ_HDMI0 (IRQ_ARMCTRL_START + INTERRUPT_HDMI0)
  2981. +#define IRQ_HDMI1 (IRQ_ARMCTRL_START + INTERRUPT_HDMI1)
  2982. +#define IRQ_PIXELVALVE1 (IRQ_ARMCTRL_START + INTERRUPT_PIXELVALVE1)
  2983. +#define IRQ_I2CSPISLV (IRQ_ARMCTRL_START + INTERRUPT_I2CSPISLV)
  2984. +#define IRQ_DSI1 (IRQ_ARMCTRL_START + INTERRUPT_DSI1)
  2985. +#define IRQ_PWA0 (IRQ_ARMCTRL_START + INTERRUPT_PWA0)
  2986. +#define IRQ_PWA1 (IRQ_ARMCTRL_START + INTERRUPT_PWA1)
  2987. +#define IRQ_CPR (IRQ_ARMCTRL_START + INTERRUPT_CPR)
  2988. +#define IRQ_SMI (IRQ_ARMCTRL_START + INTERRUPT_SMI)
  2989. +#define IRQ_GPIO0 (IRQ_ARMCTRL_START + INTERRUPT_GPIO0)
  2990. +#define IRQ_GPIO1 (IRQ_ARMCTRL_START + INTERRUPT_GPIO1)
  2991. +#define IRQ_GPIO2 (IRQ_ARMCTRL_START + INTERRUPT_GPIO2)
  2992. +#define IRQ_GPIO3 (IRQ_ARMCTRL_START + INTERRUPT_GPIO3)
  2993. +#define IRQ_I2C (IRQ_ARMCTRL_START + INTERRUPT_I2C)
  2994. +#define IRQ_SPI (IRQ_ARMCTRL_START + INTERRUPT_SPI)
  2995. +#define IRQ_I2SPCM (IRQ_ARMCTRL_START + INTERRUPT_I2SPCM)
  2996. +#define IRQ_SDIO (IRQ_ARMCTRL_START + INTERRUPT_SDIO)
  2997. +#define IRQ_UART (IRQ_ARMCTRL_START + INTERRUPT_UART)
  2998. +#define IRQ_SLIMBUS (IRQ_ARMCTRL_START + INTERRUPT_SLIMBUS)
  2999. +#define IRQ_VEC (IRQ_ARMCTRL_START + INTERRUPT_VEC)
  3000. +#define IRQ_CPG (IRQ_ARMCTRL_START + INTERRUPT_CPG)
  3001. +#define IRQ_RNG (IRQ_ARMCTRL_START + INTERRUPT_RNG)
  3002. +#define IRQ_ARASANSDIO (IRQ_ARMCTRL_START + INTERRUPT_ARASANSDIO)
  3003. +#define IRQ_AVSPMON (IRQ_ARMCTRL_START + INTERRUPT_AVSPMON)
  3004. +
  3005. +#define IRQ_ARM_TIMER (IRQ_ARMCTRL_START + INTERRUPT_ARM_TIMER)
  3006. +#define IRQ_ARM_MAILBOX (IRQ_ARMCTRL_START + INTERRUPT_ARM_MAILBOX)
  3007. +#define IRQ_ARM_DOORBELL_0 (IRQ_ARMCTRL_START + INTERRUPT_ARM_DOORBELL_0)
  3008. +#define IRQ_ARM_DOORBELL_1 (IRQ_ARMCTRL_START + INTERRUPT_ARM_DOORBELL_1)
  3009. +#define IRQ_VPU0_HALTED (IRQ_ARMCTRL_START + INTERRUPT_VPU0_HALTED)
  3010. +#define IRQ_VPU1_HALTED (IRQ_ARMCTRL_START + INTERRUPT_VPU1_HALTED)
  3011. +#define IRQ_ILLEGAL_TYPE0 (IRQ_ARMCTRL_START + INTERRUPT_ILLEGAL_TYPE0)
  3012. +#define IRQ_ILLEGAL_TYPE1 (IRQ_ARMCTRL_START + INTERRUPT_ILLEGAL_TYPE1)
  3013. +#define IRQ_PENDING1 (IRQ_ARMCTRL_START + INTERRUPT_PENDING1)
  3014. +#define IRQ_PENDING2 (IRQ_ARMCTRL_START + INTERRUPT_PENDING2)
  3015. +
  3016. +/*
  3017. + * FIQ interrupts definitions are the same as the INT definitions.
  3018. + */
  3019. +#define FIQ_TIMER0 INT_TIMER0
  3020. +#define FIQ_TIMER1 INT_TIMER1
  3021. +#define FIQ_TIMER2 INT_TIMER2
  3022. +#define FIQ_TIMER3 INT_TIMER3
  3023. +#define FIQ_CODEC0 INT_CODEC0
  3024. +#define FIQ_CODEC1 INT_CODEC1
  3025. +#define FIQ_CODEC2 INT_CODEC2
  3026. +#define FIQ_JPEG INT_JPEG
  3027. +#define FIQ_ISP INT_ISP
  3028. +#define FIQ_USB INT_USB
  3029. +#define FIQ_3D INT_3D
  3030. +#define FIQ_TRANSPOSER INT_TRANSPOSER
  3031. +#define FIQ_MULTICORESYNC0 INT_MULTICORESYNC0
  3032. +#define FIQ_MULTICORESYNC1 INT_MULTICORESYNC1
  3033. +#define FIQ_MULTICORESYNC2 INT_MULTICORESYNC2
  3034. +#define FIQ_MULTICORESYNC3 INT_MULTICORESYNC3
  3035. +#define FIQ_DMA0 INT_DMA0
  3036. +#define FIQ_DMA1 INT_DMA1
  3037. +#define FIQ_DMA2 INT_DMA2
  3038. +#define FIQ_DMA3 INT_DMA3
  3039. +#define FIQ_DMA4 INT_DMA4
  3040. +#define FIQ_DMA5 INT_DMA5
  3041. +#define FIQ_DMA6 INT_DMA6
  3042. +#define FIQ_DMA7 INT_DMA7
  3043. +#define FIQ_DMA8 INT_DMA8
  3044. +#define FIQ_DMA9 INT_DMA9
  3045. +#define FIQ_DMA10 INT_DMA10
  3046. +#define FIQ_DMA11 INT_DMA11
  3047. +#define FIQ_DMA12 INT_DMA12
  3048. +#define FIQ_AUX INT_AUX
  3049. +#define FIQ_ARM INT_ARM
  3050. +#define FIQ_VPUDMA INT_VPUDMA
  3051. +#define FIQ_HOSTPORT INT_HOSTPORT
  3052. +#define FIQ_VIDEOSCALER INT_VIDEOSCALER
  3053. +#define FIQ_CCP2TX INT_CCP2TX
  3054. +#define FIQ_SDC INT_SDC
  3055. +#define FIQ_DSI0 INT_DSI0
  3056. +#define FIQ_AVE INT_AVE
  3057. +#define FIQ_CAM0 INT_CAM0
  3058. +#define FIQ_CAM1 INT_CAM1
  3059. +#define FIQ_HDMI0 INT_HDMI0
  3060. +#define FIQ_HDMI1 INT_HDMI1
  3061. +#define FIQ_PIXELVALVE1 INT_PIXELVALVE1
  3062. +#define FIQ_I2CSPISLV INT_I2CSPISLV
  3063. +#define FIQ_DSI1 INT_DSI1
  3064. +#define FIQ_PWA0 INT_PWA0
  3065. +#define FIQ_PWA1 INT_PWA1
  3066. +#define FIQ_CPR INT_CPR
  3067. +#define FIQ_SMI INT_SMI
  3068. +#define FIQ_GPIO0 INT_GPIO0
  3069. +#define FIQ_GPIO1 INT_GPIO1
  3070. +#define FIQ_GPIO2 INT_GPIO2
  3071. +#define FIQ_GPIO3 INT_GPIO3
  3072. +#define FIQ_I2C INT_I2C
  3073. +#define FIQ_SPI INT_SPI
  3074. +#define FIQ_I2SPCM INT_I2SPCM
  3075. +#define FIQ_SDIO INT_SDIO
  3076. +#define FIQ_UART INT_UART
  3077. +#define FIQ_SLIMBUS INT_SLIMBUS
  3078. +#define FIQ_VEC INT_VEC
  3079. +#define FIQ_CPG INT_CPG
  3080. +#define FIQ_RNG INT_RNG
  3081. +#define FIQ_ARASANSDIO INT_ARASANSDIO
  3082. +#define FIQ_AVSPMON INT_AVSPMON
  3083. +
  3084. +#define FIQ_ARM_TIMER INT_ARM_TIMER
  3085. +#define FIQ_ARM_MAILBOX INT_ARM_MAILBOX
  3086. +#define FIQ_ARM_DOORBELL_0 INT_ARM_DOORBELL_0
  3087. +#define FIQ_ARM_DOORBELL_1 INT_ARM_DOORBELL_1
  3088. +#define FIQ_VPU0_HALTED INT_VPU0_HALTED
  3089. +#define FIQ_VPU1_HALTED INT_VPU1_HALTED
  3090. +#define FIQ_ILLEGAL_TYPE0 INT_ILLEGAL_TYPE0
  3091. +#define FIQ_ILLEGAL_TYPE1 INT_ILLEGAL_TYPE1
  3092. +#define FIQ_PENDING1 INT_PENDING1
  3093. +#define FIQ_PENDING2 INT_PENDING2
  3094. +
  3095. +#define HARD_IRQS (64 + 21)
  3096. +#define GPIO_IRQ_START (HARD_IRQS)
  3097. +#define GPIO_IRQS (32*5)
  3098. +#define SPARE_ALLOC_IRQS 64
  3099. +#define BCM2708_ALLOC_IRQS (HARD_IRQS+FIQ_IRQS+GPIO_IRQS+SPARE_ALLOC_IRQS)
  3100. +#define FREE_IRQS 128
  3101. +#define NR_IRQS (BCM2708_ALLOC_IRQS+FREE_IRQS)
  3102. +
  3103. +#endif /* _BCM2708_IRQS_H_ */
  3104. --- /dev/null
  3105. +++ b/arch/arm/mach-bcm2708/include/mach/memory.h
  3106. @@ -0,0 +1,57 @@
  3107. +/*
  3108. + * arch/arm/mach-bcm2708/include/mach/memory.h
  3109. + *
  3110. + * Copyright (C) 2010 Broadcom
  3111. + *
  3112. + * This program is free software; you can redistribute it and/or modify
  3113. + * it under the terms of the GNU General Public License as published by
  3114. + * the Free Software Foundation; either version 2 of the License, or
  3115. + * (at your option) any later version.
  3116. + *
  3117. + * This program is distributed in the hope that it will be useful,
  3118. + * but WITHOUT ANY WARRANTY; without even the implied warranty of
  3119. + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  3120. + * GNU General Public License for more details.
  3121. + *
  3122. + * You should have received a copy of the GNU General Public License
  3123. + * along with this program; if not, write to the Free Software
  3124. + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
  3125. + */
  3126. +#ifndef __ASM_ARCH_MEMORY_H
  3127. +#define __ASM_ARCH_MEMORY_H
  3128. +
  3129. +/* Memory overview:
  3130. +
  3131. + [ARMcore] <--virtual addr-->
  3132. + [ARMmmu] <--physical addr-->
  3133. + [GERTmap] <--bus add-->
  3134. + [VCperiph]
  3135. +
  3136. +*/
  3137. +
  3138. +/*
  3139. + * Physical DRAM offset.
  3140. + */
  3141. +#define BCM_PLAT_PHYS_OFFSET UL(0x00000000)
  3142. +#define VC_ARMMEM_OFFSET UL(0x00000000) /* offset in VC of ARM memory */
  3143. +
  3144. +#ifdef CONFIG_BCM2708_NOL2CACHE
  3145. + #define _REAL_BUS_OFFSET UL(0xC0000000) /* don't use L1 or L2 caches */
  3146. +#else
  3147. + #define _REAL_BUS_OFFSET UL(0x40000000) /* use L2 cache */
  3148. +#endif
  3149. +
  3150. +/* We're using the memory at 64M in the VideoCore for Linux - this adjustment
  3151. + * will provide the offset into this area as well as setting the bits that
  3152. + * stop the L1 and L2 cache from being used
  3153. + *
  3154. + * WARNING: this only works because the ARM is given memory at a fixed location
  3155. + * (ARMMEM_OFFSET)
  3156. + */
  3157. +#define BUS_OFFSET (VC_ARMMEM_OFFSET + _REAL_BUS_OFFSET)
  3158. +#define __virt_to_bus(x) ((x) + (BUS_OFFSET - PAGE_OFFSET))
  3159. +#define __bus_to_virt(x) ((x) - (BUS_OFFSET - PAGE_OFFSET))
  3160. +#define __pfn_to_bus(x) (__pfn_to_phys(x) + (BUS_OFFSET - BCM_PLAT_PHYS_OFFSET))
  3161. +#define __bus_to_pfn(x) __phys_to_pfn((x) - (BUS_OFFSET - BCM_PLAT_PHYS_OFFSET))
  3162. +
  3163. +#endif
  3164. --- /dev/null
  3165. +++ b/arch/arm/mach-bcm2708/include/mach/platform.h
  3166. @@ -0,0 +1,228 @@
  3167. +/*
  3168. + * arch/arm/mach-bcm2708/include/mach/platform.h
  3169. + *
  3170. + * Copyright (C) 2010 Broadcom
  3171. + *
  3172. + * This program is free software; you can redistribute it and/or modify
  3173. + * it under the terms of the GNU General Public License as published by
  3174. + * the Free Software Foundation; either version 2 of the License, or
  3175. + * (at your option) any later version.
  3176. + *
  3177. + * This program is distributed in the hope that it will be useful,
  3178. + * but WITHOUT ANY WARRANTY; without even the implied warranty of
  3179. + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  3180. + * GNU General Public License for more details.
  3181. + *
  3182. + * You should have received a copy of the GNU General Public License
  3183. + * along with this program; if not, write to the Free Software
  3184. + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
  3185. + */
  3186. +
  3187. +#ifndef _BCM2708_PLATFORM_H
  3188. +#define _BCM2708_PLATFORM_H
  3189. +
  3190. +
  3191. +/* macros to get at IO space when running virtually */
  3192. +#define IO_ADDRESS(x) (((x) & 0x0fffffff) + (((x) >> 4) & 0x0f000000) + 0xf0000000)
  3193. +
  3194. +#define __io_address(n) IOMEM(IO_ADDRESS(n))
  3195. +
  3196. +
  3197. +/*
  3198. + * SDRAM
  3199. + */
  3200. +#define BCM2708_SDRAM_BASE 0x00000000
  3201. +
  3202. +/*
  3203. + * Logic expansion modules
  3204. + *
  3205. + */
  3206. +
  3207. +
  3208. +/* ------------------------------------------------------------------------
  3209. + * BCM2708 ARMCTRL Registers
  3210. + * ------------------------------------------------------------------------
  3211. + */
  3212. +
  3213. +#define HW_REGISTER_RW(addr) (addr)
  3214. +#define HW_REGISTER_RO(addr) (addr)
  3215. +
  3216. +#include "arm_control.h"
  3217. +#undef ARM_BASE
  3218. +
  3219. +/*
  3220. + * Definitions and addresses for the ARM CONTROL logic
  3221. + * This file is manually generated.
  3222. + */
  3223. +
  3224. +#define BCM2708_PERI_BASE 0x20000000
  3225. +#define IC0_BASE (BCM2708_PERI_BASE + 0x2000)
  3226. +#define ST_BASE (BCM2708_PERI_BASE + 0x3000) /* System Timer */
  3227. +#define MPHI_BASE (BCM2708_PERI_BASE + 0x6000) /* Message -based Parallel Host Interface */
  3228. +#define DMA_BASE (BCM2708_PERI_BASE + 0x7000) /* DMA controller */
  3229. +#define ARM_BASE (BCM2708_PERI_BASE + 0xB000) /* BCM2708 ARM control block */
  3230. +#define PM_BASE (BCM2708_PERI_BASE + 0x100000) /* Power Management, Reset controller and Watchdog registers */
  3231. +#define PCM_CLOCK_BASE (BCM2708_PERI_BASE + 0x101098) /* PCM Clock */
  3232. +#define RNG_BASE (BCM2708_PERI_BASE + 0x104000) /* Hardware RNG */
  3233. +#define GPIO_BASE (BCM2708_PERI_BASE + 0x200000) /* GPIO */
  3234. +#define UART0_BASE (BCM2708_PERI_BASE + 0x201000) /* Uart 0 */
  3235. +#define MMCI0_BASE (BCM2708_PERI_BASE + 0x202000) /* MMC interface */
  3236. +#define I2S_BASE (BCM2708_PERI_BASE + 0x203000) /* I2S */
  3237. +#define SPI0_BASE (BCM2708_PERI_BASE + 0x204000) /* SPI0 */
  3238. +#define BSC0_BASE (BCM2708_PERI_BASE + 0x205000) /* BSC0 I2C/TWI */
  3239. +#define UART1_BASE (BCM2708_PERI_BASE + 0x215000) /* Uart 1 */
  3240. +#define EMMC_BASE (BCM2708_PERI_BASE + 0x300000) /* eMMC interface */
  3241. +#define SMI_BASE (BCM2708_PERI_BASE + 0x600000) /* SMI */
  3242. +#define BSC1_BASE (BCM2708_PERI_BASE + 0x804000) /* BSC1 I2C/TWI */
  3243. +#define USB_BASE (BCM2708_PERI_BASE + 0x980000) /* DTC_OTG USB controller */
  3244. +#define MCORE_BASE (BCM2708_PERI_BASE + 0x0000) /* Fake frame buffer device (actually the multicore sync block*/
  3245. +
  3246. +#define ARMCTRL_BASE (ARM_BASE + 0x000)
  3247. +#define ARMCTRL_IC_BASE (ARM_BASE + 0x200) /* ARM interrupt controller */
  3248. +#define ARMCTRL_TIMER0_1_BASE (ARM_BASE + 0x400) /* Timer 0 and 1 */
  3249. +#define ARMCTRL_0_SBM_BASE (ARM_BASE + 0x800) /* User 0 (ARM)'s Semaphores Doorbells and Mailboxes */
  3250. +
  3251. +
  3252. +/*
  3253. + * Interrupt assignments
  3254. + */
  3255. +
  3256. +#define ARM_IRQ1_BASE 0
  3257. +#define INTERRUPT_TIMER0 (ARM_IRQ1_BASE + 0)
  3258. +#define INTERRUPT_TIMER1 (ARM_IRQ1_BASE + 1)
  3259. +#define INTERRUPT_TIMER2 (ARM_IRQ1_BASE + 2)
  3260. +#define INTERRUPT_TIMER3 (ARM_IRQ1_BASE + 3)
  3261. +#define INTERRUPT_CODEC0 (ARM_IRQ1_BASE + 4)
  3262. +#define INTERRUPT_CODEC1 (ARM_IRQ1_BASE + 5)
  3263. +#define INTERRUPT_CODEC2 (ARM_IRQ1_BASE + 6)
  3264. +#define INTERRUPT_VC_JPEG (ARM_IRQ1_BASE + 7)
  3265. +#define INTERRUPT_ISP (ARM_IRQ1_BASE + 8)
  3266. +#define INTERRUPT_VC_USB (ARM_IRQ1_BASE + 9)
  3267. +#define INTERRUPT_VC_3D (ARM_IRQ1_BASE + 10)
  3268. +#define INTERRUPT_TRANSPOSER (ARM_IRQ1_BASE + 11)
  3269. +#define INTERRUPT_MULTICORESYNC0 (ARM_IRQ1_BASE + 12)
  3270. +#define INTERRUPT_MULTICORESYNC1 (ARM_IRQ1_BASE + 13)
  3271. +#define INTERRUPT_MULTICORESYNC2 (ARM_IRQ1_BASE + 14)
  3272. +#define INTERRUPT_MULTICORESYNC3 (ARM_IRQ1_BASE + 15)
  3273. +#define INTERRUPT_DMA0 (ARM_IRQ1_BASE + 16)
  3274. +#define INTERRUPT_DMA1 (ARM_IRQ1_BASE + 17)
  3275. +#define INTERRUPT_VC_DMA2 (ARM_IRQ1_BASE + 18)
  3276. +#define INTERRUPT_VC_DMA3 (ARM_IRQ1_BASE + 19)
  3277. +#define INTERRUPT_DMA4 (ARM_IRQ1_BASE + 20)
  3278. +#define INTERRUPT_DMA5 (ARM_IRQ1_BASE + 21)
  3279. +#define INTERRUPT_DMA6 (ARM_IRQ1_BASE + 22)
  3280. +#define INTERRUPT_DMA7 (ARM_IRQ1_BASE + 23)
  3281. +#define INTERRUPT_DMA8 (ARM_IRQ1_BASE + 24)
  3282. +#define INTERRUPT_DMA9 (ARM_IRQ1_BASE + 25)
  3283. +#define INTERRUPT_DMA10 (ARM_IRQ1_BASE + 26)
  3284. +#define INTERRUPT_DMA11 (ARM_IRQ1_BASE + 27)
  3285. +#define INTERRUPT_DMA12 (ARM_IRQ1_BASE + 28)
  3286. +#define INTERRUPT_AUX (ARM_IRQ1_BASE + 29)
  3287. +#define INTERRUPT_ARM (ARM_IRQ1_BASE + 30)
  3288. +#define INTERRUPT_VPUDMA (ARM_IRQ1_BASE + 31)
  3289. +
  3290. +#define ARM_IRQ2_BASE 32
  3291. +#define INTERRUPT_HOSTPORT (ARM_IRQ2_BASE + 0)
  3292. +#define INTERRUPT_VIDEOSCALER (ARM_IRQ2_BASE + 1)
  3293. +#define INTERRUPT_CCP2TX (ARM_IRQ2_BASE + 2)
  3294. +#define INTERRUPT_SDC (ARM_IRQ2_BASE + 3)
  3295. +#define INTERRUPT_DSI0 (ARM_IRQ2_BASE + 4)
  3296. +#define INTERRUPT_AVE (ARM_IRQ2_BASE + 5)
  3297. +#define INTERRUPT_CAM0 (ARM_IRQ2_BASE + 6)
  3298. +#define INTERRUPT_CAM1 (ARM_IRQ2_BASE + 7)
  3299. +#define INTERRUPT_HDMI0 (ARM_IRQ2_BASE + 8)
  3300. +#define INTERRUPT_HDMI1 (ARM_IRQ2_BASE + 9)
  3301. +#define INTERRUPT_PIXELVALVE1 (ARM_IRQ2_BASE + 10)
  3302. +#define INTERRUPT_I2CSPISLV (ARM_IRQ2_BASE + 11)
  3303. +#define INTERRUPT_DSI1 (ARM_IRQ2_BASE + 12)
  3304. +#define INTERRUPT_PWA0 (ARM_IRQ2_BASE + 13)
  3305. +#define INTERRUPT_PWA1 (ARM_IRQ2_BASE + 14)
  3306. +#define INTERRUPT_CPR (ARM_IRQ2_BASE + 15)
  3307. +#define INTERRUPT_SMI (ARM_IRQ2_BASE + 16)
  3308. +#define INTERRUPT_GPIO0 (ARM_IRQ2_BASE + 17)
  3309. +#define INTERRUPT_GPIO1 (ARM_IRQ2_BASE + 18)
  3310. +#define INTERRUPT_GPIO2 (ARM_IRQ2_BASE + 19)
  3311. +#define INTERRUPT_GPIO3 (ARM_IRQ2_BASE + 20)
  3312. +#define INTERRUPT_VC_I2C (ARM_IRQ2_BASE + 21)
  3313. +#define INTERRUPT_VC_SPI (ARM_IRQ2_BASE + 22)
  3314. +#define INTERRUPT_VC_I2SPCM (ARM_IRQ2_BASE + 23)
  3315. +#define INTERRUPT_VC_SDIO (ARM_IRQ2_BASE + 24)
  3316. +#define INTERRUPT_VC_UART (ARM_IRQ2_BASE + 25)
  3317. +#define INTERRUPT_SLIMBUS (ARM_IRQ2_BASE + 26)
  3318. +#define INTERRUPT_VEC (ARM_IRQ2_BASE + 27)
  3319. +#define INTERRUPT_CPG (ARM_IRQ2_BASE + 28)
  3320. +#define INTERRUPT_RNG (ARM_IRQ2_BASE + 29)
  3321. +#define INTERRUPT_VC_ARASANSDIO (ARM_IRQ2_BASE + 30)
  3322. +#define INTERRUPT_AVSPMON (ARM_IRQ2_BASE + 31)
  3323. +
  3324. +#define ARM_IRQ0_BASE 64
  3325. +#define INTERRUPT_ARM_TIMER (ARM_IRQ0_BASE + 0)
  3326. +#define INTERRUPT_ARM_MAILBOX (ARM_IRQ0_BASE + 1)
  3327. +#define INTERRUPT_ARM_DOORBELL_0 (ARM_IRQ0_BASE + 2)
  3328. +#define INTERRUPT_ARM_DOORBELL_1 (ARM_IRQ0_BASE + 3)
  3329. +#define INTERRUPT_VPU0_HALTED (ARM_IRQ0_BASE + 4)
  3330. +#define INTERRUPT_VPU1_HALTED (ARM_IRQ0_BASE + 5)
  3331. +#define INTERRUPT_ILLEGAL_TYPE0 (ARM_IRQ0_BASE + 6)
  3332. +#define INTERRUPT_ILLEGAL_TYPE1 (ARM_IRQ0_BASE + 7)
  3333. +#define INTERRUPT_PENDING1 (ARM_IRQ0_BASE + 8)
  3334. +#define INTERRUPT_PENDING2 (ARM_IRQ0_BASE + 9)
  3335. +#define INTERRUPT_JPEG (ARM_IRQ0_BASE + 10)
  3336. +#define INTERRUPT_USB (ARM_IRQ0_BASE + 11)
  3337. +#define INTERRUPT_3D (ARM_IRQ0_BASE + 12)
  3338. +#define INTERRUPT_DMA2 (ARM_IRQ0_BASE + 13)
  3339. +#define INTERRUPT_DMA3 (ARM_IRQ0_BASE + 14)
  3340. +#define INTERRUPT_I2C (ARM_IRQ0_BASE + 15)
  3341. +#define INTERRUPT_SPI (ARM_IRQ0_BASE + 16)
  3342. +#define INTERRUPT_I2SPCM (ARM_IRQ0_BASE + 17)
  3343. +#define INTERRUPT_SDIO (ARM_IRQ0_BASE + 18)
  3344. +#define INTERRUPT_UART (ARM_IRQ0_BASE + 19)
  3345. +#define INTERRUPT_ARASANSDIO (ARM_IRQ0_BASE + 20)
  3346. +
  3347. +#define MAXIRQNUM (32 + 32 + 20)
  3348. +#define MAXFIQNUM (32 + 32 + 20)
  3349. +
  3350. +#define MAX_TIMER 2
  3351. +#define MAX_PERIOD 699050
  3352. +#define TICKS_PER_uSEC 1
  3353. +
  3354. +/*
  3355. + * These are useconds NOT ticks.
  3356. + *
  3357. + */
  3358. +#define mSEC_1 1000
  3359. +#define mSEC_5 (mSEC_1 * 5)
  3360. +#define mSEC_10 (mSEC_1 * 10)
  3361. +#define mSEC_25 (mSEC_1 * 25)
  3362. +#define SEC_1 (mSEC_1 * 1000)
  3363. +
  3364. +/*
  3365. + * Watchdog
  3366. + */
  3367. +#define PM_RSTC (PM_BASE+0x1c)
  3368. +#define PM_RSTS (PM_BASE+0x20)
  3369. +#define PM_WDOG (PM_BASE+0x24)
  3370. +
  3371. +#define PM_WDOG_RESET 0000000000
  3372. +#define PM_PASSWORD 0x5a000000
  3373. +#define PM_WDOG_TIME_SET 0x000fffff
  3374. +#define PM_RSTC_WRCFG_CLR 0xffffffcf
  3375. +#define PM_RSTC_WRCFG_SET 0x00000030
  3376. +#define PM_RSTC_WRCFG_FULL_RESET 0x00000020
  3377. +#define PM_RSTC_RESET 0x00000102
  3378. +
  3379. +#define PM_RSTS_HADPOR_SET 0x00001000
  3380. +#define PM_RSTS_HADSRH_SET 0x00000400
  3381. +#define PM_RSTS_HADSRF_SET 0x00000200
  3382. +#define PM_RSTS_HADSRQ_SET 0x00000100
  3383. +#define PM_RSTS_HADWRH_SET 0x00000040
  3384. +#define PM_RSTS_HADWRF_SET 0x00000020
  3385. +#define PM_RSTS_HADWRQ_SET 0x00000010
  3386. +#define PM_RSTS_HADDRH_SET 0x00000004
  3387. +#define PM_RSTS_HADDRF_SET 0x00000002
  3388. +#define PM_RSTS_HADDRQ_SET 0x00000001
  3389. +
  3390. +#define UART0_CLOCK 3000000
  3391. +
  3392. +#endif
  3393. +
  3394. +/* END */
  3395. --- /dev/null
  3396. +++ b/arch/arm/mach-bcm2708/include/mach/power.h
  3397. @@ -0,0 +1,26 @@
  3398. +/*
  3399. + * linux/arch/arm/mach-bcm2708/power.h
  3400. + *
  3401. + * Copyright (C) 2010 Broadcom
  3402. + *
  3403. + * This program is free software; you can redistribute it and/or modify
  3404. + * it under the terms of the GNU General Public License version 2 as
  3405. + * published by the Free Software Foundation.
  3406. + *
  3407. + * This device provides a shared mechanism for controlling the power to
  3408. + * VideoCore subsystems.
  3409. + */
  3410. +
  3411. +#ifndef _MACH_BCM2708_POWER_H
  3412. +#define _MACH_BCM2708_POWER_H
  3413. +
  3414. +#include <linux/types.h>
  3415. +#include <mach/arm_power.h>
  3416. +
  3417. +typedef unsigned int BCM_POWER_HANDLE_T;
  3418. +
  3419. +extern int bcm_power_open(BCM_POWER_HANDLE_T *handle);
  3420. +extern int bcm_power_request(BCM_POWER_HANDLE_T handle, uint32_t request);
  3421. +extern int bcm_power_close(BCM_POWER_HANDLE_T handle);
  3422. +
  3423. +#endif
  3424. --- /dev/null
  3425. +++ b/arch/arm/mach-bcm2708/include/mach/system.h
  3426. @@ -0,0 +1,38 @@
  3427. +/*
  3428. + * arch/arm/mach-bcm2708/include/mach/system.h
  3429. + *
  3430. + * Copyright (C) 2010 Broadcom
  3431. + * Copyright (C) 2003 ARM Limited
  3432. + * Copyright (C) 2000 Deep Blue Solutions Ltd
  3433. + *
  3434. + * This program is free software; you can redistribute it and/or modify
  3435. + * it under the terms of the GNU General Public License as published by
  3436. + * the Free Software Foundation; either version 2 of the License, or
  3437. + * (at your option) any later version.
  3438. + *
  3439. + * This program is distributed in the hope that it will be useful,
  3440. + * but WITHOUT ANY WARRANTY; without even the implied warranty of
  3441. + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  3442. + * GNU General Public License for more details.
  3443. + *
  3444. + * You should have received a copy of the GNU General Public License
  3445. + * along with this program; if not, write to the Free Software
  3446. + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
  3447. + */
  3448. +#ifndef __ASM_ARCH_SYSTEM_H
  3449. +#define __ASM_ARCH_SYSTEM_H
  3450. +
  3451. +#include <linux/io.h>
  3452. +#include <mach/hardware.h>
  3453. +#include <mach/platform.h>
  3454. +
  3455. +static inline void arch_idle(void)
  3456. +{
  3457. + /*
  3458. + * This should do all the clock switching
  3459. + * and wait for interrupt tricks
  3460. + */
  3461. + cpu_do_idle();
  3462. +}
  3463. +
  3464. +#endif
  3465. --- /dev/null
  3466. +++ b/arch/arm/mach-bcm2708/include/mach/timex.h
  3467. @@ -0,0 +1,23 @@
  3468. +/*
  3469. + * arch/arm/mach-bcm2708/include/mach/timex.h
  3470. + *
  3471. + * BCM2708 sysem clock frequency
  3472. + *
  3473. + * Copyright (C) 2010 Broadcom
  3474. + *
  3475. + * This program is free software; you can redistribute it and/or modify
  3476. + * it under the terms of the GNU General Public License as published by
  3477. + * the Free Software Foundation; either version 2 of the License, or
  3478. + * (at your option) any later version.
  3479. + *
  3480. + * This program is distributed in the hope that it will be useful,
  3481. + * but WITHOUT ANY WARRANTY; without even the implied warranty of
  3482. + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  3483. + * GNU General Public License for more details.
  3484. + *
  3485. + * You should have received a copy of the GNU General Public License
  3486. + * along with this program; if not, write to the Free Software
  3487. + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
  3488. + */
  3489. +
  3490. +#define CLOCK_TICK_RATE (1000000)
  3491. --- /dev/null
  3492. +++ b/arch/arm/mach-bcm2708/include/mach/uncompress.h
  3493. @@ -0,0 +1,84 @@
  3494. +/*
  3495. + * arch/arm/mach-bcn2708/include/mach/uncompress.h
  3496. + *
  3497. + * Copyright (C) 2010 Broadcom
  3498. + * Copyright (C) 2003 ARM Limited
  3499. + *
  3500. + * This program is free software; you can redistribute it and/or modify
  3501. + * it under the terms of the GNU General Public License as published by
  3502. + * the Free Software Foundation; either version 2 of the License, or
  3503. + * (at your option) any later version.
  3504. + *
  3505. + * This program is distributed in the hope that it will be useful,
  3506. + * but WITHOUT ANY WARRANTY; without even the implied warranty of
  3507. + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  3508. + * GNU General Public License for more details.
  3509. + *
  3510. + * You should have received a copy of the GNU General Public License
  3511. + * along with this program; if not, write to the Free Software
  3512. + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
  3513. + */
  3514. +
  3515. +#include <linux/io.h>
  3516. +#include <linux/amba/serial.h>
  3517. +#include <mach/hardware.h>
  3518. +
  3519. +#define UART_BAUD 115200
  3520. +
  3521. +#define BCM2708_UART_DR __io(UART0_BASE + UART01x_DR)
  3522. +#define BCM2708_UART_FR __io(UART0_BASE + UART01x_FR)
  3523. +#define BCM2708_UART_IBRD __io(UART0_BASE + UART011_IBRD)
  3524. +#define BCM2708_UART_FBRD __io(UART0_BASE + UART011_FBRD)
  3525. +#define BCM2708_UART_LCRH __io(UART0_BASE + UART011_LCRH)
  3526. +#define BCM2708_UART_CR __io(UART0_BASE + UART011_CR)
  3527. +
  3528. +/*
  3529. + * This does not append a newline
  3530. + */
  3531. +static inline void putc(int c)
  3532. +{
  3533. + while (__raw_readl(BCM2708_UART_FR) & UART01x_FR_TXFF)
  3534. + barrier();
  3535. +
  3536. + __raw_writel(c, BCM2708_UART_DR);
  3537. +}
  3538. +
  3539. +static inline void flush(void)
  3540. +{
  3541. + int fr;
  3542. +
  3543. + do {
  3544. + fr = __raw_readl(BCM2708_UART_FR);
  3545. + barrier();
  3546. + } while ((fr & (UART011_FR_TXFE | UART01x_FR_BUSY)) != UART011_FR_TXFE);
  3547. +}
  3548. +
  3549. +static inline void arch_decomp_setup(void)
  3550. +{
  3551. + int temp, div, rem, frac;
  3552. +
  3553. + temp = 16 * UART_BAUD;
  3554. + div = UART0_CLOCK / temp;
  3555. + rem = UART0_CLOCK % temp;
  3556. + temp = (8 * rem) / UART_BAUD;
  3557. + frac = (temp >> 1) + (temp & 1);
  3558. +
  3559. + /* Make sure the UART is disabled before we start */
  3560. + __raw_writel(0, BCM2708_UART_CR);
  3561. +
  3562. + /* Set the baud rate */
  3563. + __raw_writel(div, BCM2708_UART_IBRD);
  3564. + __raw_writel(frac, BCM2708_UART_FBRD);
  3565. +
  3566. + /* Set the UART to 8n1, FIFO enabled */
  3567. + __raw_writel(UART01x_LCRH_WLEN_8 | UART01x_LCRH_FEN, BCM2708_UART_LCRH);
  3568. +
  3569. + /* Enable the UART */
  3570. + __raw_writel(UART01x_CR_UARTEN | UART011_CR_TXE | UART011_CR_RXE,
  3571. + BCM2708_UART_CR);
  3572. +}
  3573. +
  3574. +/*
  3575. + * nothing to do
  3576. + */
  3577. +#define arch_decomp_wdog()
  3578. --- /dev/null
  3579. +++ b/arch/arm/mach-bcm2708/include/mach/vc_mem.h
  3580. @@ -0,0 +1,35 @@
  3581. +/*****************************************************************************
  3582. +* Copyright 2010 - 2011 Broadcom Corporation. All rights reserved.
  3583. +*
  3584. +* Unless you and Broadcom execute a separate written software license
  3585. +* agreement governing use of this software, this software is licensed to you
  3586. +* under the terms of the GNU General Public License version 2, available at
  3587. +* http://www.broadcom.com/licenses/GPLv2.php (the "GPL").
  3588. +*
  3589. +* Notwithstanding the above, under no circumstances may you combine this
  3590. +* software in any way with any other Broadcom software provided under a
  3591. +* license other than the GPL, without Broadcom's express prior written
  3592. +* consent.
  3593. +*****************************************************************************/
  3594. +
  3595. +#if !defined( VC_MEM_H )
  3596. +#define VC_MEM_H
  3597. +
  3598. +#include <linux/ioctl.h>
  3599. +
  3600. +#define VC_MEM_IOC_MAGIC 'v'
  3601. +
  3602. +#define VC_MEM_IOC_MEM_PHYS_ADDR _IOR( VC_MEM_IOC_MAGIC, 0, unsigned long )
  3603. +#define VC_MEM_IOC_MEM_SIZE _IOR( VC_MEM_IOC_MAGIC, 1, unsigned int )
  3604. +#define VC_MEM_IOC_MEM_BASE _IOR( VC_MEM_IOC_MAGIC, 2, unsigned int )
  3605. +#define VC_MEM_IOC_MEM_LOAD _IOR( VC_MEM_IOC_MAGIC, 3, unsigned int )
  3606. +
  3607. +#if defined( __KERNEL__ )
  3608. +#define VC_MEM_TO_ARM_ADDR_MASK 0x3FFFFFFF
  3609. +
  3610. +extern unsigned long mm_vc_mem_phys_addr;
  3611. +extern unsigned int mm_vc_mem_size;
  3612. +extern int vc_mem_get_current_size( void );
  3613. +#endif
  3614. +
  3615. +#endif /* VC_MEM_H */
  3616. --- /dev/null
  3617. +++ b/arch/arm/mach-bcm2708/include/mach/vcio.h
  3618. @@ -0,0 +1,165 @@
  3619. +/*
  3620. + * arch/arm/mach-bcm2708/include/mach/vcio.h
  3621. + *
  3622. + * Copyright (C) 2010 Broadcom
  3623. + *
  3624. + * This program is free software; you can redistribute it and/or modify
  3625. + * it under the terms of the GNU General Public License as published by
  3626. + * the Free Software Foundation; either version 2 of the License, or
  3627. + * (at your option) any later version.
  3628. + *
  3629. + * This program is distributed in the hope that it will be useful,
  3630. + * but WITHOUT ANY WARRANTY; without even the implied warranty of
  3631. + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  3632. + * GNU General Public License for more details.
  3633. + *
  3634. + * You should have received a copy of the GNU General Public License
  3635. + * along with this program; if not, write to the Free Software
  3636. + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
  3637. + */
  3638. +#ifndef _MACH_BCM2708_VCIO_H
  3639. +#define _MACH_BCM2708_VCIO_H
  3640. +
  3641. +/* Routines to handle I/O via the VideoCore "ARM control" registers
  3642. + * (semaphores, doorbells, mailboxes)
  3643. + */
  3644. +
  3645. +#define BCM_VCIO_DRIVER_NAME "bcm2708_vcio"
  3646. +
  3647. +/* Constants shared with the ARM identifying separate mailbox channels */
  3648. +#define MBOX_CHAN_POWER 0 /* for use by the power management interface */
  3649. +#define MBOX_CHAN_FB 1 /* for use by the frame buffer */
  3650. +#define MBOX_CHAN_VCHIQ 3 /* for use by the VCHIQ interface */
  3651. +#define MBOX_CHAN_PROPERTY 8 /* for use by the property channel */
  3652. +#define MBOX_CHAN_COUNT 9
  3653. +
  3654. +enum {
  3655. + VCMSG_PROCESS_REQUEST = 0x00000000
  3656. +};
  3657. +enum {
  3658. + VCMSG_REQUEST_SUCCESSFUL = 0x80000000,
  3659. + VCMSG_REQUEST_FAILED = 0x80000001
  3660. +};
  3661. +/* Mailbox property tags */
  3662. +enum {
  3663. + VCMSG_PROPERTY_END = 0x00000000,
  3664. + VCMSG_GET_FIRMWARE_REVISION = 0x00000001,
  3665. + VCMSG_GET_BOARD_MODEL = 0x00010001,
  3666. + VCMSG_GET_BOARD_REVISION = 0x00010002,
  3667. + VCMSG_GET_BOARD_MAC_ADDRESS = 0x00010003,
  3668. + VCMSG_GET_BOARD_SERIAL = 0x00010004,
  3669. + VCMSG_GET_ARM_MEMORY = 0x00010005,
  3670. + VCMSG_GET_VC_MEMORY = 0x00010006,
  3671. + VCMSG_GET_CLOCKS = 0x00010007,
  3672. + VCMSG_GET_COMMAND_LINE = 0x00050001,
  3673. + VCMSG_GET_DMA_CHANNELS = 0x00060001,
  3674. + VCMSG_GET_POWER_STATE = 0x00020001,
  3675. + VCMSG_GET_TIMING = 0x00020002,
  3676. + VCMSG_SET_POWER_STATE = 0x00028001,
  3677. + VCMSG_GET_CLOCK_STATE = 0x00030001,
  3678. + VCMSG_SET_CLOCK_STATE = 0x00038001,
  3679. + VCMSG_GET_CLOCK_RATE = 0x00030002,
  3680. + VCMSG_SET_CLOCK_RATE = 0x00038002,
  3681. + VCMSG_GET_VOLTAGE = 0x00030003,
  3682. + VCMSG_SET_VOLTAGE = 0x00038003,
  3683. + VCMSG_GET_MAX_CLOCK = 0x00030004,
  3684. + VCMSG_GET_MAX_VOLTAGE = 0x00030005,
  3685. + VCMSG_GET_TEMPERATURE = 0x00030006,
  3686. + VCMSG_GET_MIN_CLOCK = 0x00030007,
  3687. + VCMSG_GET_MIN_VOLTAGE = 0x00030008,
  3688. + VCMSG_GET_TURBO = 0x00030009,
  3689. + VCMSG_GET_MAX_TEMPERATURE = 0x0003000a,
  3690. + VCMSG_GET_STC = 0x0003000b,
  3691. + VCMSG_SET_TURBO = 0x00038009,
  3692. + VCMSG_SET_ALLOCATE_MEM = 0x0003000c,
  3693. + VCMSG_SET_LOCK_MEM = 0x0003000d,
  3694. + VCMSG_SET_UNLOCK_MEM = 0x0003000e,
  3695. + VCMSG_SET_RELEASE_MEM = 0x0003000f,
  3696. + VCMSG_SET_EXECUTE_CODE = 0x00030010,
  3697. + VCMSG_SET_EXECUTE_QPU = 0x00030011,
  3698. + VCMSG_SET_ENABLE_QPU = 0x00030012,
  3699. + VCMSG_GET_RESOURCE_HANDLE = 0x00030014,
  3700. + VCMSG_GET_EDID_BLOCK = 0x00030020,
  3701. + VCMSG_GET_CUSTOMER_OTP = 0x00030021,
  3702. + VCMSG_SET_CUSTOMER_OTP = 0x00038021,
  3703. + VCMSG_SET_ALLOCATE_BUFFER = 0x00040001,
  3704. + VCMSG_SET_RELEASE_BUFFER = 0x00048001,
  3705. + VCMSG_SET_BLANK_SCREEN = 0x00040002,
  3706. + VCMSG_TST_BLANK_SCREEN = 0x00044002,
  3707. + VCMSG_GET_PHYSICAL_WIDTH_HEIGHT = 0x00040003,
  3708. + VCMSG_TST_PHYSICAL_WIDTH_HEIGHT = 0x00044003,
  3709. + VCMSG_SET_PHYSICAL_WIDTH_HEIGHT = 0x00048003,
  3710. + VCMSG_GET_VIRTUAL_WIDTH_HEIGHT = 0x00040004,
  3711. + VCMSG_TST_VIRTUAL_WIDTH_HEIGHT = 0x00044004,
  3712. + VCMSG_SET_VIRTUAL_WIDTH_HEIGHT = 0x00048004,
  3713. + VCMSG_GET_DEPTH = 0x00040005,
  3714. + VCMSG_TST_DEPTH = 0x00044005,
  3715. + VCMSG_SET_DEPTH = 0x00048005,
  3716. + VCMSG_GET_PIXEL_ORDER = 0x00040006,
  3717. + VCMSG_TST_PIXEL_ORDER = 0x00044006,
  3718. + VCMSG_SET_PIXEL_ORDER = 0x00048006,
  3719. + VCMSG_GET_ALPHA_MODE = 0x00040007,
  3720. + VCMSG_TST_ALPHA_MODE = 0x00044007,
  3721. + VCMSG_SET_ALPHA_MODE = 0x00048007,
  3722. + VCMSG_GET_PITCH = 0x00040008,
  3723. + VCMSG_TST_PITCH = 0x00044008,
  3724. + VCMSG_SET_PITCH = 0x00048008,
  3725. + VCMSG_GET_VIRTUAL_OFFSET = 0x00040009,
  3726. + VCMSG_TST_VIRTUAL_OFFSET = 0x00044009,
  3727. + VCMSG_SET_VIRTUAL_OFFSET = 0x00048009,
  3728. + VCMSG_GET_OVERSCAN = 0x0004000a,
  3729. + VCMSG_TST_OVERSCAN = 0x0004400a,
  3730. + VCMSG_SET_OVERSCAN = 0x0004800a,
  3731. + VCMSG_GET_PALETTE = 0x0004000b,
  3732. + VCMSG_TST_PALETTE = 0x0004400b,
  3733. + VCMSG_SET_PALETTE = 0x0004800b,
  3734. + VCMSG_GET_LAYER = 0x0004000c,
  3735. + VCMSG_TST_LAYER = 0x0004400c,
  3736. + VCMSG_SET_LAYER = 0x0004800c,
  3737. + VCMSG_GET_TRANSFORM = 0x0004000d,
  3738. + VCMSG_TST_TRANSFORM = 0x0004400d,
  3739. + VCMSG_SET_TRANSFORM = 0x0004800d,
  3740. + VCMSG_TST_VSYNC = 0x0004400e,
  3741. + VCMSG_SET_VSYNC = 0x0004800e,
  3742. + VCMSG_SET_CURSOR_INFO = 0x00008010,
  3743. + VCMSG_SET_CURSOR_STATE = 0x00008011,
  3744. +};
  3745. +
  3746. +extern int /*rc*/ bcm_mailbox_read(unsigned chan, uint32_t *data28);
  3747. +extern int /*rc*/ bcm_mailbox_write(unsigned chan, uint32_t data28);
  3748. +extern int /*rc*/ bcm_mailbox_property(void *data, int size);
  3749. +
  3750. +#include <linux/ioctl.h>
  3751. +
  3752. +/*
  3753. + * The major device number. We can't rely on dynamic
  3754. + * registration any more, because ioctls need to know
  3755. + * it.
  3756. + */
  3757. +#define MAJOR_NUM 100
  3758. +
  3759. +/*
  3760. + * Set the message of the device driver
  3761. + */
  3762. +#define IOCTL_MBOX_PROPERTY _IOWR(MAJOR_NUM, 0, char *)
  3763. +/*
  3764. + * _IOWR means that we're creating an ioctl command
  3765. + * number for passing information from a user process
  3766. + * to the kernel module and from the kernel module to user process
  3767. + *
  3768. + * The first arguments, MAJOR_NUM, is the major device
  3769. + * number we're using.
  3770. + *
  3771. + * The second argument is the number of the command
  3772. + * (there could be several with different meanings).
  3773. + *
  3774. + * The third argument is the type we want to get from
  3775. + * the process to the kernel.
  3776. + */
  3777. +
  3778. +/*
  3779. + * The name of the device file
  3780. + */
  3781. +#define DEVICE_FILE_NAME "vcio"
  3782. +
  3783. +#endif
  3784. --- /dev/null
  3785. +++ b/arch/arm/mach-bcm2708/include/mach/vmalloc.h
  3786. @@ -0,0 +1,20 @@
  3787. +/*
  3788. + * arch/arm/mach-bcm2708/include/mach/vmalloc.h
  3789. + *
  3790. + * Copyright (C) 2010 Broadcom
  3791. + *
  3792. + * This program is free software; you can redistribute it and/or modify
  3793. + * it under the terms of the GNU General Public License as published by
  3794. + * the Free Software Foundation; either version 2 of the License, or
  3795. + * (at your option) any later version.
  3796. + *
  3797. + * This program is distributed in the hope that it will be useful,
  3798. + * but WITHOUT ANY WARRANTY; without even the implied warranty of
  3799. + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  3800. + * GNU General Public License for more details.
  3801. + *
  3802. + * You should have received a copy of the GNU General Public License
  3803. + * along with this program; if not, write to the Free Software
  3804. + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
  3805. + */
  3806. +#define VMALLOC_END (0xe8000000)
  3807. --- /dev/null
  3808. +++ b/arch/arm/mach-bcm2708/power.c
  3809. @@ -0,0 +1,197 @@
  3810. +/*
  3811. + * linux/arch/arm/mach-bcm2708/power.c
  3812. + *
  3813. + * Copyright (C) 2010 Broadcom
  3814. + *
  3815. + * This program is free software; you can redistribute it and/or modify
  3816. + * it under the terms of the GNU General Public License version 2 as
  3817. + * published by the Free Software Foundation.
  3818. + *
  3819. + * This device provides a shared mechanism for controlling the power to
  3820. + * VideoCore subsystems.
  3821. + */
  3822. +
  3823. +#include <linux/module.h>
  3824. +#include <linux/semaphore.h>
  3825. +#include <linux/bug.h>
  3826. +#include <mach/power.h>
  3827. +#include <mach/vcio.h>
  3828. +#include <mach/arm_power.h>
  3829. +
  3830. +#define DRIVER_NAME "bcm2708_power"
  3831. +
  3832. +#define BCM_POWER_MAXCLIENTS 4
  3833. +#define BCM_POWER_NOCLIENT (1<<31)
  3834. +
  3835. +/* Some drivers expect there devices to be permanently powered */
  3836. +
  3837. +#ifdef CONFIG_USB
  3838. +#define BCM_POWER_ALWAYS_ON (BCM_POWER_USB)
  3839. +#endif
  3840. +
  3841. +#if 1
  3842. +#define DPRINTK printk
  3843. +#else
  3844. +#define DPRINTK if (0) printk
  3845. +#endif
  3846. +
  3847. +struct state_struct {
  3848. + uint32_t global_request;
  3849. + uint32_t client_request[BCM_POWER_MAXCLIENTS];
  3850. + struct semaphore client_mutex;
  3851. + struct semaphore mutex;
  3852. +} g_state;
  3853. +
  3854. +int bcm_power_open(BCM_POWER_HANDLE_T *handle)
  3855. +{
  3856. + BCM_POWER_HANDLE_T i;
  3857. + int ret = -EBUSY;
  3858. +
  3859. + down(&g_state.client_mutex);
  3860. +
  3861. + for (i = 0; i < BCM_POWER_MAXCLIENTS; i++) {
  3862. + if (g_state.client_request[i] == BCM_POWER_NOCLIENT) {
  3863. + g_state.client_request[i] = BCM_POWER_NONE;
  3864. + *handle = i;
  3865. + ret = 0;
  3866. + break;
  3867. + }
  3868. + }
  3869. +
  3870. + up(&g_state.client_mutex);
  3871. +
  3872. + DPRINTK("bcm_power_open() -> %d\n", *handle);
  3873. +
  3874. + return ret;
  3875. +}
  3876. +EXPORT_SYMBOL_GPL(bcm_power_open);
  3877. +
  3878. +int bcm_power_request(BCM_POWER_HANDLE_T handle, uint32_t request)
  3879. +{
  3880. + int rc = 0;
  3881. +
  3882. + DPRINTK("bcm_power_request(%d, %x)\n", handle, request);
  3883. +
  3884. + if ((handle < BCM_POWER_MAXCLIENTS) &&
  3885. + (g_state.client_request[handle] != BCM_POWER_NOCLIENT)) {
  3886. + if (down_interruptible(&g_state.mutex) != 0) {
  3887. + DPRINTK("bcm_power_request -> interrupted\n");
  3888. + return -EINTR;
  3889. + }
  3890. +
  3891. + if (request != g_state.client_request[handle]) {
  3892. + uint32_t others_request = 0;
  3893. + uint32_t global_request;
  3894. + BCM_POWER_HANDLE_T i;
  3895. +
  3896. + for (i = 0; i < BCM_POWER_MAXCLIENTS; i++) {
  3897. + if (i != handle)
  3898. + others_request |=
  3899. + g_state.client_request[i];
  3900. + }
  3901. + others_request &= ~BCM_POWER_NOCLIENT;
  3902. +
  3903. + global_request = request | others_request;
  3904. + if (global_request != g_state.global_request) {
  3905. + uint32_t actual;
  3906. +
  3907. + /* Send a request to VideoCore */
  3908. + bcm_mailbox_write(MBOX_CHAN_POWER,
  3909. + global_request << 4);
  3910. +
  3911. + /* Wait for a response during power-up */
  3912. + if (global_request & ~g_state.global_request) {
  3913. + rc = bcm_mailbox_read(MBOX_CHAN_POWER,
  3914. + &actual);
  3915. + DPRINTK
  3916. + ("bcm_mailbox_read -> %08x, %d\n",
  3917. + actual, rc);
  3918. + actual >>= 4;
  3919. + } else {
  3920. + rc = 0;
  3921. + actual = global_request;
  3922. + }
  3923. +
  3924. + if (rc == 0) {
  3925. + if (actual != global_request) {
  3926. + printk(KERN_ERR
  3927. + "%s: prev global %x, new global %x, actual %x, request %x, others_request %x\n",
  3928. + __func__,
  3929. + g_state.global_request,
  3930. + global_request, actual, request, others_request);
  3931. + /* A failure */
  3932. + BUG_ON((others_request & actual)
  3933. + != others_request);
  3934. + request &= actual;
  3935. + rc = -EIO;
  3936. + }
  3937. +
  3938. + g_state.global_request = actual;
  3939. + g_state.client_request[handle] =
  3940. + request;
  3941. + }
  3942. + }
  3943. + }
  3944. + up(&g_state.mutex);
  3945. + } else {
  3946. + rc = -EINVAL;
  3947. + }
  3948. + DPRINTK("bcm_power_request -> %d\n", rc);
  3949. + return rc;
  3950. +}
  3951. +EXPORT_SYMBOL_GPL(bcm_power_request);
  3952. +
  3953. +int bcm_power_close(BCM_POWER_HANDLE_T handle)
  3954. +{
  3955. + int rc;
  3956. +
  3957. + DPRINTK("bcm_power_close(%d)\n", handle);
  3958. +
  3959. + rc = bcm_power_request(handle, BCM_POWER_NONE);
  3960. + if (rc == 0)
  3961. + g_state.client_request[handle] = BCM_POWER_NOCLIENT;
  3962. +
  3963. + return rc;
  3964. +}
  3965. +EXPORT_SYMBOL_GPL(bcm_power_close);
  3966. +
  3967. +static int __init bcm_power_init(void)
  3968. +{
  3969. +#if defined(BCM_POWER_ALWAYS_ON)
  3970. + BCM_POWER_HANDLE_T always_on_handle;
  3971. +#endif
  3972. + int rc = 0;
  3973. + int i;
  3974. +
  3975. + printk(KERN_INFO "bcm_power: Broadcom power driver\n");
  3976. + bcm_mailbox_write(MBOX_CHAN_POWER, 0);
  3977. +
  3978. + for (i = 0; i < BCM_POWER_MAXCLIENTS; i++)
  3979. + g_state.client_request[i] = BCM_POWER_NOCLIENT;
  3980. +
  3981. + sema_init(&g_state.client_mutex, 1);
  3982. + sema_init(&g_state.mutex, 1);
  3983. +
  3984. + g_state.global_request = 0;
  3985. +
  3986. +#if defined(BCM_POWER_ALWAYS_ON)
  3987. + if (BCM_POWER_ALWAYS_ON) {
  3988. + bcm_power_open(&always_on_handle);
  3989. + bcm_power_request(always_on_handle, BCM_POWER_ALWAYS_ON);
  3990. + }
  3991. +#endif
  3992. +
  3993. + return rc;
  3994. +}
  3995. +
  3996. +static void __exit bcm_power_exit(void)
  3997. +{
  3998. + bcm_mailbox_write(MBOX_CHAN_POWER, 0);
  3999. +}
  4000. +
  4001. +arch_initcall(bcm_power_init); /* Initialize early */
  4002. +module_exit(bcm_power_exit);
  4003. +
  4004. +MODULE_AUTHOR("Phil Elwell");
  4005. +MODULE_DESCRIPTION("Interface to BCM2708 power management");
  4006. +MODULE_LICENSE("GPL");
  4007. --- /dev/null
  4008. +++ b/arch/arm/mach-bcm2708/vc_mem.c
  4009. @@ -0,0 +1,431 @@
  4010. +/*****************************************************************************
  4011. +* Copyright 2010 - 2011 Broadcom Corporation. All rights reserved.
  4012. +*
  4013. +* Unless you and Broadcom execute a separate written software license
  4014. +* agreement governing use of this software, this software is licensed to you
  4015. +* under the terms of the GNU General Public License version 2, available at
  4016. +* http://www.broadcom.com/licenses/GPLv2.php (the "GPL").
  4017. +*
  4018. +* Notwithstanding the above, under no circumstances may you combine this
  4019. +* software in any way with any other Broadcom software provided under a
  4020. +* license other than the GPL, without Broadcom's express prior written
  4021. +* consent.
  4022. +*****************************************************************************/
  4023. +
  4024. +#include <linux/kernel.h>
  4025. +#include <linux/module.h>
  4026. +#include <linux/fs.h>
  4027. +#include <linux/device.h>
  4028. +#include <linux/cdev.h>
  4029. +#include <linux/mm.h>
  4030. +#include <linux/slab.h>
  4031. +#include <linux/debugfs.h>
  4032. +#include <asm/uaccess.h>
  4033. +#include <linux/dma-mapping.h>
  4034. +
  4035. +#ifdef CONFIG_ARCH_KONA
  4036. +#include <chal/chal_ipc.h>
  4037. +#elif CONFIG_ARCH_BCM2708
  4038. +#else
  4039. +#include <csp/chal_ipc.h>
  4040. +#endif
  4041. +
  4042. +#include "mach/vc_mem.h"
  4043. +#include <mach/vcio.h>
  4044. +
  4045. +#define DRIVER_NAME "vc-mem"
  4046. +
  4047. +// Device (/dev) related variables
  4048. +static dev_t vc_mem_devnum = 0;
  4049. +static struct class *vc_mem_class = NULL;
  4050. +static struct cdev vc_mem_cdev;
  4051. +static int vc_mem_inited = 0;
  4052. +
  4053. +#ifdef CONFIG_DEBUG_FS
  4054. +static struct dentry *vc_mem_debugfs_entry;
  4055. +#endif
  4056. +
  4057. +/*
  4058. + * Videocore memory addresses and size
  4059. + *
  4060. + * Drivers that wish to know the videocore memory addresses and sizes should
  4061. + * use these variables instead of the MM_IO_BASE and MM_ADDR_IO defines in
  4062. + * headers. This allows the other drivers to not be tied down to a a certain
  4063. + * address/size at compile time.
  4064. + *
  4065. + * In the future, the goal is to have the videocore memory virtual address and
  4066. + * size be calculated at boot time rather than at compile time. The decision of
  4067. + * where the videocore memory resides and its size would be in the hands of the
  4068. + * bootloader (and/or kernel). When that happens, the values of these variables
  4069. + * would be calculated and assigned in the init function.
  4070. + */
  4071. +// in the 2835 VC in mapped above ARM, but ARM has full access to VC space
  4072. +unsigned long mm_vc_mem_phys_addr = 0x00000000;
  4073. +unsigned int mm_vc_mem_size = 0;
  4074. +unsigned int mm_vc_mem_base = 0;
  4075. +
  4076. +EXPORT_SYMBOL(mm_vc_mem_phys_addr);
  4077. +EXPORT_SYMBOL(mm_vc_mem_size);
  4078. +EXPORT_SYMBOL(mm_vc_mem_base);
  4079. +
  4080. +static uint phys_addr = 0;
  4081. +static uint mem_size = 0;
  4082. +static uint mem_base = 0;
  4083. +
  4084. +
  4085. +/****************************************************************************
  4086. +*
  4087. +* vc_mem_open
  4088. +*
  4089. +***************************************************************************/
  4090. +
  4091. +static int
  4092. +vc_mem_open(struct inode *inode, struct file *file)
  4093. +{
  4094. + (void) inode;
  4095. + (void) file;
  4096. +
  4097. + pr_debug("%s: called file = 0x%p\n", __func__, file);
  4098. +
  4099. + return 0;
  4100. +}
  4101. +
  4102. +/****************************************************************************
  4103. +*
  4104. +* vc_mem_release
  4105. +*
  4106. +***************************************************************************/
  4107. +
  4108. +static int
  4109. +vc_mem_release(struct inode *inode, struct file *file)
  4110. +{
  4111. + (void) inode;
  4112. + (void) file;
  4113. +
  4114. + pr_debug("%s: called file = 0x%p\n", __func__, file);
  4115. +
  4116. + return 0;
  4117. +}
  4118. +
  4119. +/****************************************************************************
  4120. +*
  4121. +* vc_mem_get_size
  4122. +*
  4123. +***************************************************************************/
  4124. +
  4125. +static void
  4126. +vc_mem_get_size(void)
  4127. +{
  4128. +}
  4129. +
  4130. +/****************************************************************************
  4131. +*
  4132. +* vc_mem_get_base
  4133. +*
  4134. +***************************************************************************/
  4135. +
  4136. +static void
  4137. +vc_mem_get_base(void)
  4138. +{
  4139. +}
  4140. +
  4141. +/****************************************************************************
  4142. +*
  4143. +* vc_mem_get_current_size
  4144. +*
  4145. +***************************************************************************/
  4146. +
  4147. +int
  4148. +vc_mem_get_current_size(void)
  4149. +{
  4150. + return mm_vc_mem_size;
  4151. +}
  4152. +
  4153. +EXPORT_SYMBOL_GPL(vc_mem_get_current_size);
  4154. +
  4155. +/****************************************************************************
  4156. +*
  4157. +* vc_mem_ioctl
  4158. +*
  4159. +***************************************************************************/
  4160. +
  4161. +static long
  4162. +vc_mem_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
  4163. +{
  4164. + int rc = 0;
  4165. +
  4166. + (void) cmd;
  4167. + (void) arg;
  4168. +
  4169. + pr_debug("%s: called file = 0x%p\n", __func__, file);
  4170. +
  4171. + switch (cmd) {
  4172. + case VC_MEM_IOC_MEM_PHYS_ADDR:
  4173. + {
  4174. + pr_debug("%s: VC_MEM_IOC_MEM_PHYS_ADDR=0x%p\n",
  4175. + __func__, (void *) mm_vc_mem_phys_addr);
  4176. +
  4177. + if (copy_to_user((void *) arg, &mm_vc_mem_phys_addr,
  4178. + sizeof (mm_vc_mem_phys_addr)) != 0) {
  4179. + rc = -EFAULT;
  4180. + }
  4181. + break;
  4182. + }
  4183. + case VC_MEM_IOC_MEM_SIZE:
  4184. + {
  4185. + // Get the videocore memory size first
  4186. + vc_mem_get_size();
  4187. +
  4188. + pr_debug("%s: VC_MEM_IOC_MEM_SIZE=%u\n", __func__,
  4189. + mm_vc_mem_size);
  4190. +
  4191. + if (copy_to_user((void *) arg, &mm_vc_mem_size,
  4192. + sizeof (mm_vc_mem_size)) != 0) {
  4193. + rc = -EFAULT;
  4194. + }
  4195. + break;
  4196. + }
  4197. + case VC_MEM_IOC_MEM_BASE:
  4198. + {
  4199. + // Get the videocore memory base
  4200. + vc_mem_get_base();
  4201. +
  4202. + pr_debug("%s: VC_MEM_IOC_MEM_BASE=%u\n", __func__,
  4203. + mm_vc_mem_base);
  4204. +
  4205. + if (copy_to_user((void *) arg, &mm_vc_mem_base,
  4206. + sizeof (mm_vc_mem_base)) != 0) {
  4207. + rc = -EFAULT;
  4208. + }
  4209. + break;
  4210. + }
  4211. + case VC_MEM_IOC_MEM_LOAD:
  4212. + {
  4213. + // Get the videocore memory base
  4214. + vc_mem_get_base();
  4215. +
  4216. + pr_debug("%s: VC_MEM_IOC_MEM_LOAD=%u\n", __func__,
  4217. + mm_vc_mem_base);
  4218. +
  4219. + if (copy_to_user((void *) arg, &mm_vc_mem_base,
  4220. + sizeof (mm_vc_mem_base)) != 0) {
  4221. + rc = -EFAULT;
  4222. + }
  4223. + break;
  4224. + }
  4225. + default:
  4226. + {
  4227. + return -ENOTTY;
  4228. + }
  4229. + }
  4230. + pr_debug("%s: file = 0x%p returning %d\n", __func__, file, rc);
  4231. +
  4232. + return rc;
  4233. +}
  4234. +
  4235. +/****************************************************************************
  4236. +*
  4237. +* vc_mem_mmap
  4238. +*
  4239. +***************************************************************************/
  4240. +
  4241. +static int
  4242. +vc_mem_mmap(struct file *filp, struct vm_area_struct *vma)
  4243. +{
  4244. + int rc = 0;
  4245. + unsigned long length = vma->vm_end - vma->vm_start;
  4246. + unsigned long offset = vma->vm_pgoff << PAGE_SHIFT;
  4247. +
  4248. + pr_debug("%s: vm_start = 0x%08lx vm_end = 0x%08lx vm_pgoff = 0x%08lx\n",
  4249. + __func__, (long) vma->vm_start, (long) vma->vm_end,
  4250. + (long) vma->vm_pgoff);
  4251. +
  4252. + if (offset + length > mm_vc_mem_size) {
  4253. + pr_err("%s: length %ld is too big\n", __func__, length);
  4254. + return -EINVAL;
  4255. + }
  4256. + // Do not cache the memory map
  4257. + vma->vm_page_prot = pgprot_noncached(vma->vm_page_prot);
  4258. +
  4259. + rc = remap_pfn_range(vma, vma->vm_start,
  4260. + (mm_vc_mem_phys_addr >> PAGE_SHIFT) +
  4261. + vma->vm_pgoff, length, vma->vm_page_prot);
  4262. + if (rc != 0) {
  4263. + pr_err("%s: remap_pfn_range failed (rc=%d)\n", __func__, rc);
  4264. + }
  4265. +
  4266. + return rc;
  4267. +}
  4268. +
  4269. +/****************************************************************************
  4270. +*
  4271. +* File Operations for the driver.
  4272. +*
  4273. +***************************************************************************/
  4274. +
  4275. +static const struct file_operations vc_mem_fops = {
  4276. + .owner = THIS_MODULE,
  4277. + .open = vc_mem_open,
  4278. + .release = vc_mem_release,
  4279. + .unlocked_ioctl = vc_mem_ioctl,
  4280. + .mmap = vc_mem_mmap,
  4281. +};
  4282. +
  4283. +#ifdef CONFIG_DEBUG_FS
  4284. +static void vc_mem_debugfs_deinit(void)
  4285. +{
  4286. + debugfs_remove_recursive(vc_mem_debugfs_entry);
  4287. + vc_mem_debugfs_entry = NULL;
  4288. +}
  4289. +
  4290. +
  4291. +static int vc_mem_debugfs_init(
  4292. + struct device *dev)
  4293. +{
  4294. + vc_mem_debugfs_entry = debugfs_create_dir(DRIVER_NAME, NULL);
  4295. + if (!vc_mem_debugfs_entry) {
  4296. + dev_warn(dev, "could not create debugfs entry\n");
  4297. + return -EFAULT;
  4298. + }
  4299. +
  4300. + if (!debugfs_create_x32("vc_mem_phys_addr",
  4301. + 0444,
  4302. + vc_mem_debugfs_entry,
  4303. + (u32 *)&mm_vc_mem_phys_addr)) {
  4304. + dev_warn(dev, "%s:could not create vc_mem_phys entry\n",
  4305. + __func__);
  4306. + goto fail;
  4307. + }
  4308. +
  4309. + if (!debugfs_create_x32("vc_mem_size",
  4310. + 0444,
  4311. + vc_mem_debugfs_entry,
  4312. + (u32 *)&mm_vc_mem_size)) {
  4313. + dev_warn(dev, "%s:could not create vc_mem_size entry\n",
  4314. + __func__);
  4315. + goto fail;
  4316. + }
  4317. +
  4318. + if (!debugfs_create_x32("vc_mem_base",
  4319. + 0444,
  4320. + vc_mem_debugfs_entry,
  4321. + (u32 *)&mm_vc_mem_base)) {
  4322. + dev_warn(dev, "%s:could not create vc_mem_base entry\n",
  4323. + __func__);
  4324. + goto fail;
  4325. + }
  4326. +
  4327. + return 0;
  4328. +
  4329. +fail:
  4330. + vc_mem_debugfs_deinit();
  4331. + return -EFAULT;
  4332. +}
  4333. +
  4334. +#endif /* CONFIG_DEBUG_FS */
  4335. +
  4336. +
  4337. +/****************************************************************************
  4338. +*
  4339. +* vc_mem_init
  4340. +*
  4341. +***************************************************************************/
  4342. +
  4343. +static int __init
  4344. +vc_mem_init(void)
  4345. +{
  4346. + int rc = -EFAULT;
  4347. + struct device *dev;
  4348. +
  4349. + pr_debug("%s: called\n", __func__);
  4350. +
  4351. + mm_vc_mem_phys_addr = phys_addr;
  4352. + mm_vc_mem_size = mem_size;
  4353. + mm_vc_mem_base = mem_base;
  4354. +
  4355. + vc_mem_get_size();
  4356. +
  4357. + pr_info("vc-mem: phys_addr:0x%08lx mem_base=0x%08x mem_size:0x%08x(%u MiB)\n",
  4358. + mm_vc_mem_phys_addr, mm_vc_mem_base, mm_vc_mem_size, mm_vc_mem_size / (1024 * 1024));
  4359. +
  4360. + if ((rc = alloc_chrdev_region(&vc_mem_devnum, 0, 1, DRIVER_NAME)) < 0) {
  4361. + pr_err("%s: alloc_chrdev_region failed (rc=%d)\n",
  4362. + __func__, rc);
  4363. + goto out_err;
  4364. + }
  4365. +
  4366. + cdev_init(&vc_mem_cdev, &vc_mem_fops);
  4367. + if ((rc = cdev_add(&vc_mem_cdev, vc_mem_devnum, 1)) != 0) {
  4368. + pr_err("%s: cdev_add failed (rc=%d)\n", __func__, rc);
  4369. + goto out_unregister;
  4370. + }
  4371. +
  4372. + vc_mem_class = class_create(THIS_MODULE, DRIVER_NAME);
  4373. + if (IS_ERR(vc_mem_class)) {
  4374. + rc = PTR_ERR(vc_mem_class);
  4375. + pr_err("%s: class_create failed (rc=%d)\n", __func__, rc);
  4376. + goto out_cdev_del;
  4377. + }
  4378. +
  4379. + dev = device_create(vc_mem_class, NULL, vc_mem_devnum, NULL,
  4380. + DRIVER_NAME);
  4381. + if (IS_ERR(dev)) {
  4382. + rc = PTR_ERR(dev);
  4383. + pr_err("%s: device_create failed (rc=%d)\n", __func__, rc);
  4384. + goto out_class_destroy;
  4385. + }
  4386. +
  4387. +#ifdef CONFIG_DEBUG_FS
  4388. + /* don't fail if the debug entries cannot be created */
  4389. + vc_mem_debugfs_init(dev);
  4390. +#endif
  4391. +
  4392. + vc_mem_inited = 1;
  4393. + return 0;
  4394. +
  4395. + device_destroy(vc_mem_class, vc_mem_devnum);
  4396. +
  4397. + out_class_destroy:
  4398. + class_destroy(vc_mem_class);
  4399. + vc_mem_class = NULL;
  4400. +
  4401. + out_cdev_del:
  4402. + cdev_del(&vc_mem_cdev);
  4403. +
  4404. + out_unregister:
  4405. + unregister_chrdev_region(vc_mem_devnum, 1);
  4406. +
  4407. + out_err:
  4408. + return -1;
  4409. +}
  4410. +
  4411. +/****************************************************************************
  4412. +*
  4413. +* vc_mem_exit
  4414. +*
  4415. +***************************************************************************/
  4416. +
  4417. +static void __exit
  4418. +vc_mem_exit(void)
  4419. +{
  4420. + pr_debug("%s: called\n", __func__);
  4421. +
  4422. + if (vc_mem_inited) {
  4423. +#if CONFIG_DEBUG_FS
  4424. + vc_mem_debugfs_deinit();
  4425. +#endif
  4426. + device_destroy(vc_mem_class, vc_mem_devnum);
  4427. + class_destroy(vc_mem_class);
  4428. + cdev_del(&vc_mem_cdev);
  4429. + unregister_chrdev_region(vc_mem_devnum, 1);
  4430. + }
  4431. +}
  4432. +
  4433. +module_init(vc_mem_init);
  4434. +module_exit(vc_mem_exit);
  4435. +MODULE_LICENSE("GPL");
  4436. +MODULE_AUTHOR("Broadcom Corporation");
  4437. +
  4438. +module_param(phys_addr, uint, 0644);
  4439. +module_param(mem_size, uint, 0644);
  4440. +module_param(mem_base, uint, 0644);
  4441. --- /dev/null
  4442. +++ b/arch/arm/mach-bcm2708/vcio.c
  4443. @@ -0,0 +1,474 @@
  4444. +/*
  4445. + * linux/arch/arm/mach-bcm2708/vcio.c
  4446. + *
  4447. + * Copyright (C) 2010 Broadcom
  4448. + *
  4449. + * This program is free software; you can redistribute it and/or modify
  4450. + * it under the terms of the GNU General Public License version 2 as
  4451. + * published by the Free Software Foundation.
  4452. + *
  4453. + * This device provides a shared mechanism for writing to the mailboxes,
  4454. + * semaphores, doorbells etc. that are shared between the ARM and the
  4455. + * VideoCore processor
  4456. + */
  4457. +
  4458. +#if defined(CONFIG_SERIAL_BCM_MBOX_CONSOLE) && defined(CONFIG_MAGIC_SYSRQ)
  4459. +#define SUPPORT_SYSRQ
  4460. +#endif
  4461. +
  4462. +#include <linux/module.h>
  4463. +#include <linux/console.h>
  4464. +#include <linux/serial_core.h>
  4465. +#include <linux/serial.h>
  4466. +#include <linux/errno.h>
  4467. +#include <linux/device.h>
  4468. +#include <linux/init.h>
  4469. +#include <linux/mm.h>
  4470. +#include <linux/dma-mapping.h>
  4471. +#include <linux/platform_device.h>
  4472. +#include <linux/sysrq.h>
  4473. +#include <linux/delay.h>
  4474. +#include <linux/slab.h>
  4475. +#include <linux/interrupt.h>
  4476. +#include <linux/irq.h>
  4477. +
  4478. +#include <linux/io.h>
  4479. +
  4480. +#include <mach/vcio.h>
  4481. +#include <mach/platform.h>
  4482. +
  4483. +#include <asm/uaccess.h>
  4484. +
  4485. +
  4486. +#define DRIVER_NAME BCM_VCIO_DRIVER_NAME
  4487. +
  4488. +/* ----------------------------------------------------------------------
  4489. + * Mailbox
  4490. + * -------------------------------------------------------------------- */
  4491. +
  4492. +/* offsets from a mail box base address */
  4493. +#define MAIL_WRT 0x00 /* write - and next 4 words */
  4494. +#define MAIL_RD 0x00 /* read - and next 4 words */
  4495. +#define MAIL_POL 0x10 /* read without popping the fifo */
  4496. +#define MAIL_SND 0x14 /* sender ID (bottom two bits) */
  4497. +#define MAIL_STA 0x18 /* status */
  4498. +#define MAIL_CNF 0x1C /* configuration */
  4499. +
  4500. +#define MBOX_MSG(chan, data28) (((data28) & ~0xf) | ((chan) & 0xf))
  4501. +#define MBOX_MSG_LSB(chan, data28) (((data28) << 4) | ((chan) & 0xf))
  4502. +#define MBOX_CHAN(msg) ((msg) & 0xf)
  4503. +#define MBOX_DATA28(msg) ((msg) & ~0xf)
  4504. +#define MBOX_DATA28_LSB(msg) (((uint32_t)msg) >> 4)
  4505. +
  4506. +#define MBOX_MAGIC 0xd0d0c0de
  4507. +
  4508. +struct vc_mailbox {
  4509. + struct device *dev; /* parent device */
  4510. + void __iomem *status;
  4511. + void __iomem *config;
  4512. + void __iomem *read;
  4513. + void __iomem *write;
  4514. + uint32_t msg[MBOX_CHAN_COUNT];
  4515. + struct semaphore sema[MBOX_CHAN_COUNT];
  4516. + uint32_t magic;
  4517. +};
  4518. +
  4519. +static void mbox_init(struct vc_mailbox *mbox_out, struct device *dev,
  4520. + uint32_t addr_mbox)
  4521. +{
  4522. + int i;
  4523. +
  4524. + mbox_out->dev = dev;
  4525. + mbox_out->status = __io_address(addr_mbox + MAIL_STA);
  4526. + mbox_out->config = __io_address(addr_mbox + MAIL_CNF);
  4527. + mbox_out->read = __io_address(addr_mbox + MAIL_RD);
  4528. + /* Write to the other mailbox */
  4529. + mbox_out->write =
  4530. + __io_address((addr_mbox ^ ARM_0_MAIL0_WRT ^ ARM_0_MAIL1_WRT) +
  4531. + MAIL_WRT);
  4532. +
  4533. + for (i = 0; i < MBOX_CHAN_COUNT; i++) {
  4534. + mbox_out->msg[i] = 0;
  4535. + sema_init(&mbox_out->sema[i], 0);
  4536. + }
  4537. +
  4538. + /* Enable the interrupt on data reception */
  4539. + writel(ARM_MC_IHAVEDATAIRQEN, mbox_out->config);
  4540. +
  4541. + mbox_out->magic = MBOX_MAGIC;
  4542. +}
  4543. +
  4544. +static int mbox_write(struct vc_mailbox *mbox, unsigned chan, uint32_t data28)
  4545. +{
  4546. + int rc;
  4547. +
  4548. + if (mbox->magic != MBOX_MAGIC)
  4549. + rc = -EINVAL;
  4550. + else {
  4551. + /* wait for the mailbox FIFO to have some space in it */
  4552. + while (0 != (readl(mbox->status) & ARM_MS_FULL))
  4553. + cpu_relax();
  4554. +
  4555. + writel(MBOX_MSG(chan, data28), mbox->write);
  4556. + rc = 0;
  4557. + }
  4558. + return rc;
  4559. +}
  4560. +
  4561. +static int mbox_read(struct vc_mailbox *mbox, unsigned chan, uint32_t *data28)
  4562. +{
  4563. + int rc;
  4564. +
  4565. + if (mbox->magic != MBOX_MAGIC)
  4566. + rc = -EINVAL;
  4567. + else {
  4568. + down(&mbox->sema[chan]);
  4569. + *data28 = MBOX_DATA28(mbox->msg[chan]);
  4570. + mbox->msg[chan] = 0;
  4571. + rc = 0;
  4572. + }
  4573. + return rc;
  4574. +}
  4575. +
  4576. +static irqreturn_t mbox_irq(int irq, void *dev_id)
  4577. +{
  4578. + /* wait for the mailbox FIFO to have some data in it */
  4579. + struct vc_mailbox *mbox = (struct vc_mailbox *) dev_id;
  4580. + int status = readl(mbox->status);
  4581. + int ret = IRQ_NONE;
  4582. +
  4583. + while (!(status & ARM_MS_EMPTY)) {
  4584. + uint32_t msg = readl(mbox->read);
  4585. + int chan = MBOX_CHAN(msg);
  4586. + if (chan < MBOX_CHAN_COUNT) {
  4587. + if (mbox->msg[chan]) {
  4588. + /* Overflow */
  4589. + printk(KERN_ERR DRIVER_NAME
  4590. + ": mbox chan %d overflow - drop %08x\n",
  4591. + chan, msg);
  4592. + } else {
  4593. + mbox->msg[chan] = (msg | 0xf);
  4594. + up(&mbox->sema[chan]);
  4595. + }
  4596. + } else {
  4597. + printk(KERN_ERR DRIVER_NAME
  4598. + ": invalid channel selector (msg %08x)\n", msg);
  4599. + }
  4600. + ret = IRQ_HANDLED;
  4601. + status = readl(mbox->status);
  4602. + }
  4603. + return ret;
  4604. +}
  4605. +
  4606. +static struct irqaction mbox_irqaction = {
  4607. + .name = "ARM Mailbox IRQ",
  4608. + .flags = IRQF_DISABLED | IRQF_IRQPOLL,
  4609. + .handler = mbox_irq,
  4610. +};
  4611. +
  4612. +/* ----------------------------------------------------------------------
  4613. + * Mailbox Methods
  4614. + * -------------------------------------------------------------------- */
  4615. +
  4616. +static struct device *mbox_dev; /* we assume there's only one! */
  4617. +
  4618. +static int dev_mbox_write(struct device *dev, unsigned chan, uint32_t data28)
  4619. +{
  4620. + int rc;
  4621. +
  4622. + struct vc_mailbox *mailbox = dev_get_drvdata(dev);
  4623. + device_lock(dev);
  4624. + rc = mbox_write(mailbox, chan, data28);
  4625. + device_unlock(dev);
  4626. +
  4627. + return rc;
  4628. +}
  4629. +
  4630. +static int dev_mbox_read(struct device *dev, unsigned chan, uint32_t *data28)
  4631. +{
  4632. + int rc;
  4633. +
  4634. + struct vc_mailbox *mailbox = dev_get_drvdata(dev);
  4635. + device_lock(dev);
  4636. + rc = mbox_read(mailbox, chan, data28);
  4637. + device_unlock(dev);
  4638. +
  4639. + return rc;
  4640. +}
  4641. +
  4642. +extern int bcm_mailbox_write(unsigned chan, uint32_t data28)
  4643. +{
  4644. + if (mbox_dev)
  4645. + return dev_mbox_write(mbox_dev, chan, data28);
  4646. + else
  4647. + return -ENODEV;
  4648. +}
  4649. +EXPORT_SYMBOL_GPL(bcm_mailbox_write);
  4650. +
  4651. +extern int bcm_mailbox_read(unsigned chan, uint32_t *data28)
  4652. +{
  4653. + if (mbox_dev)
  4654. + return dev_mbox_read(mbox_dev, chan, data28);
  4655. + else
  4656. + return -ENODEV;
  4657. +}
  4658. +EXPORT_SYMBOL_GPL(bcm_mailbox_read);
  4659. +
  4660. +static void dev_mbox_register(const char *dev_name, struct device *dev)
  4661. +{
  4662. + mbox_dev = dev;
  4663. +}
  4664. +
  4665. +static int mbox_copy_from_user(void *dst, const void *src, int size)
  4666. +{
  4667. + if ( (uint32_t)src < TASK_SIZE)
  4668. + {
  4669. + return copy_from_user(dst, src, size);
  4670. + }
  4671. + else
  4672. + {
  4673. + memcpy( dst, src, size );
  4674. + return 0;
  4675. + }
  4676. +}
  4677. +
  4678. +static int mbox_copy_to_user(void *dst, const void *src, int size)
  4679. +{
  4680. + if ( (uint32_t)dst < TASK_SIZE)
  4681. + {
  4682. + return copy_to_user(dst, src, size);
  4683. + }
  4684. + else
  4685. + {
  4686. + memcpy( dst, src, size );
  4687. + return 0;
  4688. + }
  4689. +}
  4690. +
  4691. +static DEFINE_MUTEX(mailbox_lock);
  4692. +extern int bcm_mailbox_property(void *data, int size)
  4693. +{
  4694. + uint32_t success;
  4695. + dma_addr_t mem_bus; /* the memory address accessed from videocore */
  4696. + void *mem_kern; /* the memory address accessed from driver */
  4697. + int s = 0;
  4698. +
  4699. + mutex_lock(&mailbox_lock);
  4700. + /* allocate some memory for the messages communicating with GPU */
  4701. + mem_kern = dma_alloc_coherent(NULL, PAGE_ALIGN(size), &mem_bus, GFP_ATOMIC);
  4702. + if (mem_kern) {
  4703. + /* create the message */
  4704. + mbox_copy_from_user(mem_kern, data, size);
  4705. +
  4706. + /* send the message */
  4707. + wmb();
  4708. + s = bcm_mailbox_write(MBOX_CHAN_PROPERTY, (uint32_t)mem_bus);
  4709. + if (s == 0) {
  4710. + s = bcm_mailbox_read(MBOX_CHAN_PROPERTY, &success);
  4711. + }
  4712. + if (s == 0) {
  4713. + /* copy the response */
  4714. + rmb();
  4715. + mbox_copy_to_user(data, mem_kern, size);
  4716. + }
  4717. + dma_free_coherent(NULL, PAGE_ALIGN(size), mem_kern, mem_bus);
  4718. + } else {
  4719. + s = -ENOMEM;
  4720. + }
  4721. + if (s != 0)
  4722. + printk(KERN_ERR DRIVER_NAME ": %s failed (%d)\n", __func__, s);
  4723. +
  4724. + mutex_unlock(&mailbox_lock);
  4725. + return s;
  4726. +}
  4727. +EXPORT_SYMBOL_GPL(bcm_mailbox_property);
  4728. +
  4729. +/* ----------------------------------------------------------------------
  4730. + * Platform Device for Mailbox
  4731. + * -------------------------------------------------------------------- */
  4732. +
  4733. +/*
  4734. + * Is the device open right now? Used to prevent
  4735. + * concurent access into the same device
  4736. + */
  4737. +static int Device_Open = 0;
  4738. +
  4739. +/*
  4740. + * This is called whenever a process attempts to open the device file
  4741. + */
  4742. +static int device_open(struct inode *inode, struct file *file)
  4743. +{
  4744. + /*
  4745. + * We don't want to talk to two processes at the same time
  4746. + */
  4747. + if (Device_Open)
  4748. + return -EBUSY;
  4749. +
  4750. + Device_Open++;
  4751. + /*
  4752. + * Initialize the message
  4753. + */
  4754. + try_module_get(THIS_MODULE);
  4755. + return 0;
  4756. +}
  4757. +
  4758. +static int device_release(struct inode *inode, struct file *file)
  4759. +{
  4760. + /*
  4761. + * We're now ready for our next caller
  4762. + */
  4763. + Device_Open--;
  4764. +
  4765. + module_put(THIS_MODULE);
  4766. + return 0;
  4767. +}
  4768. +
  4769. +/*
  4770. + * This function is called whenever a process tries to do an ioctl on our
  4771. + * device file. We get two extra parameters (additional to the inode and file
  4772. + * structures, which all device functions get): the number of the ioctl called
  4773. + * and the parameter given to the ioctl function.
  4774. + *
  4775. + * If the ioctl is write or read/write (meaning output is returned to the
  4776. + * calling process), the ioctl call returns the output of this function.
  4777. + *
  4778. + */
  4779. +static long device_ioctl(struct file *file, /* see include/linux/fs.h */
  4780. + unsigned int ioctl_num, /* number and param for ioctl */
  4781. + unsigned long ioctl_param)
  4782. +{
  4783. + unsigned size;
  4784. + /*
  4785. + * Switch according to the ioctl called
  4786. + */
  4787. + switch (ioctl_num) {
  4788. + case IOCTL_MBOX_PROPERTY:
  4789. + /*
  4790. + * Receive a pointer to a message (in user space) and set that
  4791. + * to be the device's message. Get the parameter given to
  4792. + * ioctl by the process.
  4793. + */
  4794. + mbox_copy_from_user(&size, (void *)ioctl_param, sizeof size);
  4795. + return bcm_mailbox_property((void *)ioctl_param, size);
  4796. + break;
  4797. + default:
  4798. + printk(KERN_ERR DRIVER_NAME "unknown ioctl: %d\n", ioctl_num);
  4799. + return -EINVAL;
  4800. + }
  4801. +
  4802. + return 0;
  4803. +}
  4804. +
  4805. +/* Module Declarations */
  4806. +
  4807. +/*
  4808. + * This structure will hold the functions to be called
  4809. + * when a process does something to the device we
  4810. + * created. Since a pointer to this structure is kept in
  4811. + * the devices table, it can't be local to
  4812. + * init_module. NULL is for unimplemented functios.
  4813. + */
  4814. +struct file_operations fops = {
  4815. + .unlocked_ioctl = device_ioctl,
  4816. + .open = device_open,
  4817. + .release = device_release, /* a.k.a. close */
  4818. +};
  4819. +
  4820. +static int bcm_vcio_probe(struct platform_device *pdev)
  4821. +{
  4822. + int ret = 0;
  4823. + struct vc_mailbox *mailbox;
  4824. +
  4825. + mailbox = kzalloc(sizeof(*mailbox), GFP_KERNEL);
  4826. + if (NULL == mailbox) {
  4827. + printk(KERN_ERR DRIVER_NAME ": failed to allocate "
  4828. + "mailbox memory\n");
  4829. + ret = -ENOMEM;
  4830. + } else {
  4831. + struct resource *res;
  4832. +
  4833. + res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
  4834. + if (res == NULL) {
  4835. + printk(KERN_ERR DRIVER_NAME ": failed to obtain memory "
  4836. + "resource\n");
  4837. + ret = -ENODEV;
  4838. + kfree(mailbox);
  4839. + } else {
  4840. + /* should be based on the registers from res really */
  4841. + mbox_init(mailbox, &pdev->dev, ARM_0_MAIL0_RD);
  4842. +
  4843. + platform_set_drvdata(pdev, mailbox);
  4844. + dev_mbox_register(DRIVER_NAME, &pdev->dev);
  4845. +
  4846. + mbox_irqaction.dev_id = mailbox;
  4847. + setup_irq(IRQ_ARM_MAILBOX, &mbox_irqaction);
  4848. + printk(KERN_INFO DRIVER_NAME ": mailbox at %p\n",
  4849. + __io_address(ARM_0_MAIL0_RD));
  4850. + }
  4851. + }
  4852. +
  4853. + if (ret == 0) {
  4854. + /*
  4855. + * Register the character device
  4856. + */
  4857. + ret = register_chrdev(MAJOR_NUM, DEVICE_FILE_NAME, &fops);
  4858. +
  4859. + /*
  4860. + * Negative values signify an error
  4861. + */
  4862. + if (ret < 0) {
  4863. + printk(KERN_ERR DRIVER_NAME
  4864. + "Failed registering the character device %d\n", ret);
  4865. + return ret;
  4866. + }
  4867. + }
  4868. + return ret;
  4869. +}
  4870. +
  4871. +static int bcm_vcio_remove(struct platform_device *pdev)
  4872. +{
  4873. + struct vc_mailbox *mailbox = platform_get_drvdata(pdev);
  4874. +
  4875. + platform_set_drvdata(pdev, NULL);
  4876. + kfree(mailbox);
  4877. +
  4878. + return 0;
  4879. +}
  4880. +
  4881. +static struct platform_driver bcm_mbox_driver = {
  4882. + .probe = bcm_vcio_probe,
  4883. + .remove = bcm_vcio_remove,
  4884. +
  4885. + .driver = {
  4886. + .name = DRIVER_NAME,
  4887. + .owner = THIS_MODULE,
  4888. + },
  4889. +};
  4890. +
  4891. +static int __init bcm_mbox_init(void)
  4892. +{
  4893. + int ret;
  4894. +
  4895. + printk(KERN_INFO "mailbox: Broadcom VideoCore Mailbox driver\n");
  4896. +
  4897. + ret = platform_driver_register(&bcm_mbox_driver);
  4898. + if (ret != 0) {
  4899. + printk(KERN_ERR DRIVER_NAME ": failed to register "
  4900. + "on platform\n");
  4901. + }
  4902. +
  4903. + return ret;
  4904. +}
  4905. +
  4906. +static void __exit bcm_mbox_exit(void)
  4907. +{
  4908. + platform_driver_unregister(&bcm_mbox_driver);
  4909. +}
  4910. +
  4911. +arch_initcall(bcm_mbox_init); /* Initialize early */
  4912. +module_exit(bcm_mbox_exit);
  4913. +
  4914. +MODULE_AUTHOR("Gray Girling");
  4915. +MODULE_DESCRIPTION("ARM I/O to VideoCore processor");
  4916. +MODULE_LICENSE("GPL");
  4917. +MODULE_ALIAS("platform:bcm-mbox");
  4918. --- a/arch/arm/mm/Kconfig
  4919. +++ b/arch/arm/mm/Kconfig
  4920. @@ -358,7 +358,7 @@ config CPU_PJ4B
  4921. # ARMv6
  4922. config CPU_V6
  4923. - bool "Support ARM V6 processor" if ARCH_INTEGRATOR || MACH_REALVIEW_EB || MACH_REALVIEW_PBX
  4924. + bool "Support ARM V6 processor" if ARCH_INTEGRATOR || MACH_REALVIEW_EB || MACH_REALVIEW_PBX || MACH_BCM2708
  4925. select CPU_32v6
  4926. select CPU_ABRT_EV6
  4927. select CPU_CACHE_V6
  4928. --- a/arch/arm/mm/proc-v6.S
  4929. +++ b/arch/arm/mm/proc-v6.S
  4930. @@ -73,10 +73,19 @@ ENDPROC(cpu_v6_reset)
  4931. *
  4932. * IRQs are already disabled.
  4933. */
  4934. +
  4935. +/* See jira SW-5991 for details of this workaround */
  4936. ENTRY(cpu_v6_do_idle)
  4937. - mov r1, #0
  4938. - mcr p15, 0, r1, c7, c10, 4 @ DWB - WFI may enter a low-power mode
  4939. - mcr p15, 0, r1, c7, c0, 4 @ wait for interrupt
  4940. + .align 5
  4941. + mov r1, #2
  4942. +1: subs r1, #1
  4943. + nop
  4944. + mcreq p15, 0, r1, c7, c10, 4 @ DWB - WFI may enter a low-power mode
  4945. + mcreq p15, 0, r1, c7, c0, 4 @ wait for interrupt
  4946. + nop
  4947. + nop
  4948. + nop
  4949. + bne 1b
  4950. ret lr
  4951. ENTRY(cpu_v6_dcache_clean_area)
  4952. --- a/arch/arm/tools/mach-types
  4953. +++ b/arch/arm/tools/mach-types
  4954. @@ -522,6 +522,7 @@ torbreck MACH_TORBRECK TORBRECK 3090
  4955. prima2_evb MACH_PRIMA2_EVB PRIMA2_EVB 3103
  4956. paz00 MACH_PAZ00 PAZ00 3128
  4957. acmenetusfoxg20 MACH_ACMENETUSFOXG20 ACMENETUSFOXG20 3129
  4958. +bcm2708 MACH_BCM2708 BCM2708 3138
  4959. ag5evm MACH_AG5EVM AG5EVM 3189
  4960. ics_if_voip MACH_ICS_IF_VOIP ICS_IF_VOIP 3206
  4961. wlf_cragg_6410 MACH_WLF_CRAGG_6410 WLF_CRAGG_6410 3207
  4962. --- a/drivers/tty/serial/amba-pl011.c
  4963. +++ b/drivers/tty/serial/amba-pl011.c
  4964. @@ -84,7 +84,7 @@ struct vendor_data {
  4965. static unsigned int get_fifosize_arm(struct amba_device *dev)
  4966. {
  4967. - return amba_rev(dev) < 3 ? 16 : 32;
  4968. + return 16; //TODO: fix: amba_rev(dev) < 3 ? 16 : 32;
  4969. }
  4970. static struct vendor_data vendor_arm = {
  4971. --- a/include/linux/mmc/host.h
  4972. +++ b/include/linux/mmc/host.h
  4973. @@ -290,6 +290,7 @@ struct mmc_host {
  4974. #define MMC_CAP2_HS400 (MMC_CAP2_HS400_1_8V | \
  4975. MMC_CAP2_HS400_1_2V)
  4976. #define MMC_CAP2_SDIO_IRQ_NOTHREAD (1 << 17)
  4977. +#define MMC_CAP2_FORCE_MULTIBLOCK (1 << 31) /* Always use multiblock transfers */
  4978. mmc_pm_flag_t pm_caps; /* supported pm features */
  4979. --- a/include/linux/mmc/sdhci.h
  4980. +++ b/include/linux/mmc/sdhci.h
  4981. @@ -130,6 +130,7 @@ struct sdhci_host {
  4982. #define SDHCI_SDIO_IRQ_ENABLED (1<<9) /* SDIO irq enabled */
  4983. #define SDHCI_SDR104_NEEDS_TUNING (1<<10) /* SDR104/HS200 needs tuning */
  4984. #define SDHCI_USING_RETUNING_TIMER (1<<11) /* Host is using a retuning timer for the card */
  4985. +#define SDHCI_USE_PLATDMA (1<<12) /* Host uses 3rd party DMA */
  4986. unsigned int version; /* SDHCI spec. version */