patch-6.6-tegra.patch 124 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188318931903191319231933194319531963197319831993200320132023203320432053206320732083209321032113212321332143215321632173218321932203221322232233224322532263227322832293230323132323233323432353236323732383239324032413242324332443245324632473248324932503251325232533254325532563257325832593260326132623263326432653266326732683269327032713272327332743275327632773278327932803281328232833284328532863287328832893290329132923293329432953296329732983299330033013302330333043305330633073308330933103311331233133314331533163317331833193320332133223323332433253326332733283329333033313332333333343335333633373338333933403341334233433344334533463347334833493350335133523353335433553356335733583359336033613362336333643365336633673368336933703371337233733374337533763377337833793380338133823383338433853386338733883389339033913392339333943395339633973398339934003401340234033404340534063407340834093410341134123413341434153416341734183419342034213422342334243425342634273428342934303431343234333434343534363437343834393440344134423443344434453446344734483449345034513452345334543455345634573458345934603461346234633464346534663467346834693470347134723473347434753476347734783479348034813482348334843485348634873488348934903491349234933494349534963497349834993500350135023503350435053506350735083509351035113512351335143515351635173518351935203521352235233524352535263527352835293530353135323533353435353536353735383539354035413542354335443545354635473548354935503551355235533554355535563557355835593560356135623563356435653566356735683569357035713572357335743575357635773578357935803581358235833584358535863587358835893590359135923593359435953596359735983599360036013602360336043605360636073608360936103611361236133614361536163617361836193620362136223623362436253626362736283629363036313632363336343635363636373638363936403641364236433644364536463647364836493650365136523653365436553656365736583659366036613662366336643665366636673668366936703671367236733674367536763677367836793680368136823683368436853686368736883689369036913692369336943695369636973698369937003701370237033704370537063707370837093710371137123713371437153716371737183719372037213722372337243725372637273728372937303731
  1. From 5b78b500a9ef076594ed5d17fd1b4b21ad7c01c8 Mon Sep 17 00:00:00 2001
  2. From: Thierry Reding <[email protected]>
  3. Date: Wed, 12 Jun 2019 17:45:53 +0200
  4. Subject: [PATCH] rtc: tegra: Implement suspend clock source
  5. The suspend clock source for Tegra210 and earlier is currently
  6. implemented in the Tegra timer driver. However, the suspend clock source
  7. code accesses registers that are part of the RTC hardware block, so both
  8. can step on each others' toes. In practice this isn't an issue, but
  9. there is no reason why the RTC driver can't implement the clock source,
  10. so move the code over to the tegra-rtc driver.
  11. Signed-off-by: Thierry Reding <[email protected]>
  12. ---
  13. drivers/clocksource/timer-tegra.c | 44 -------------------------------
  14. drivers/rtc/rtc-tegra.c | 42 +++++++++++++++++++++++++++++
  15. 2 files changed, 42 insertions(+), 44 deletions(-)
  16. diff --git a/drivers/clocksource/timer-tegra.c b/drivers/clocksource/timer-tegra.c
  17. index e9635c25eef4..c15ba84f0bd1 100644
  18. --- a/drivers/clocksource/timer-tegra.c
  19. +++ b/drivers/clocksource/timer-tegra.c
  20. @@ -23,10 +23,6 @@
  21. #include "timer-of.h"
  22. -#define RTC_SECONDS 0x08
  23. -#define RTC_SHADOW_SECONDS 0x0c
  24. -#define RTC_MILLISECONDS 0x10
  25. -
  26. #define TIMERUS_CNTR_1US 0x10
  27. #define TIMERUS_USEC_CFG 0x14
  28. #define TIMERUS_CNTR_FREEZE 0x4c
  29. @@ -181,34 +177,6 @@ static struct delay_timer tegra_delay_timer = {
  30. };
  31. #endif
  32. -static struct timer_of suspend_rtc_to = {
  33. - .flags = TIMER_OF_BASE | TIMER_OF_CLOCK,
  34. -};
  35. -
  36. -/*
  37. - * tegra_rtc_read - Reads the Tegra RTC registers
  38. - * Care must be taken that this function is not called while the
  39. - * tegra_rtc driver could be executing to avoid race conditions
  40. - * on the RTC shadow register
  41. - */
  42. -static u64 tegra_rtc_read_ms(struct clocksource *cs)
  43. -{
  44. - void __iomem *reg_base = timer_of_base(&suspend_rtc_to);
  45. -
  46. - u32 ms = readl_relaxed(reg_base + RTC_MILLISECONDS);
  47. - u32 s = readl_relaxed(reg_base + RTC_SHADOW_SECONDS);
  48. -
  49. - return (u64)s * MSEC_PER_SEC + ms;
  50. -}
  51. -
  52. -static struct clocksource suspend_rtc_clocksource = {
  53. - .name = "tegra_suspend_timer",
  54. - .rating = 200,
  55. - .read = tegra_rtc_read_ms,
  56. - .mask = CLOCKSOURCE_MASK(32),
  57. - .flags = CLOCK_SOURCE_IS_CONTINUOUS | CLOCK_SOURCE_SUSPEND_NONSTOP,
  58. -};
  59. -
  60. static inline unsigned int tegra_base_for_cpu(int cpu, bool tegra20)
  61. {
  62. if (tegra20) {
  63. @@ -402,15 +370,3 @@ static int __init tegra20_init_timer(struct device_node *np)
  64. return tegra_init_timer(np, true, rating);
  65. }
  66. TIMER_OF_DECLARE(tegra20_timer, "nvidia,tegra20-timer", tegra20_init_timer);
  67. -
  68. -static int __init tegra20_init_rtc(struct device_node *np)
  69. -{
  70. - int ret;
  71. -
  72. - ret = timer_of_init(np, &suspend_rtc_to);
  73. - if (ret)
  74. - return ret;
  75. -
  76. - return clocksource_register_hz(&suspend_rtc_clocksource, 1000);
  77. -}
  78. -TIMER_OF_DECLARE(tegra20_rtc, "nvidia,tegra20-rtc", tegra20_init_rtc);
  79. diff --git a/drivers/rtc/rtc-tegra.c b/drivers/rtc/rtc-tegra.c
  80. index 441e0a66b215..000ca81ea0c6 100644
  81. --- a/drivers/rtc/rtc-tegra.c
  82. +++ b/drivers/rtc/rtc-tegra.c
  83. @@ -6,6 +6,7 @@
  84. */
  85. #include <linux/clk.h>
  86. +#include <linux/clocksource.h>
  87. #include <linux/delay.h>
  88. #include <linux/init.h>
  89. #include <linux/io.h>
  90. @@ -52,8 +53,15 @@ struct tegra_rtc_info {
  91. struct clk *clk;
  92. int irq; /* alarm and periodic IRQ */
  93. spinlock_t lock;
  94. +
  95. + struct clocksource clksrc;
  96. };
  97. +static inline struct tegra_rtc_info *to_tegra_rtc(struct clocksource *clksrc)
  98. +{
  99. + return container_of(clksrc, struct tegra_rtc_info, clksrc);
  100. +}
  101. +
  102. /*
  103. * RTC hardware is busy when it is updating its values over AHB once every
  104. * eight 32 kHz clocks (~250 us). Outside of these updates the CPU is free to
  105. @@ -268,6 +276,17 @@ static const struct rtc_class_ops tegra_rtc_ops = {
  106. .alarm_irq_enable = tegra_rtc_alarm_irq_enable,
  107. };
  108. +static u64 tegra_rtc_read_ms(struct clocksource *clksrc)
  109. +{
  110. + struct tegra_rtc_info *info = to_tegra_rtc(clksrc);
  111. + u32 ms, s;
  112. +
  113. + ms = readl_relaxed(info->base + TEGRA_RTC_REG_MILLI_SECONDS);
  114. + s = readl_relaxed(info->base + TEGRA_RTC_REG_SHADOW_SECONDS);
  115. +
  116. + return (u64)s * MSEC_PER_SEC + ms;
  117. +}
  118. +
  119. static const struct of_device_id tegra_rtc_dt_match[] = {
  120. { .compatible = "nvidia,tegra20-rtc", },
  121. {}
  122. @@ -333,6 +352,28 @@ static int tegra_rtc_probe(struct platform_device *pdev)
  123. if (ret)
  124. goto disable_clk;
  125. + /*
  126. + * The Tegra RTC is the only reliable clock source that persists
  127. + * across an SC7 transition (VDD_CPU and VDD_CORE off) on Tegra210
  128. + * and earlier. Starting with Tegra186, the ARM v8 architected timer
  129. + * is in an always on power partition and its reference clock keeps
  130. + * running during SC7. Therefore, we technically don't need to have
  131. + * the RTC register as a clock source on Tegra186 and later, but it
  132. + * doesn't hurt either, so we just register it unconditionally here.
  133. + */
  134. + info->clksrc.name = "tegra_rtc";
  135. + info->clksrc.rating = 200;
  136. + info->clksrc.read = tegra_rtc_read_ms;
  137. + info->clksrc.mask = CLOCKSOURCE_MASK(42);
  138. + info->clksrc.flags = CLOCK_SOURCE_SUSPEND_NONSTOP |
  139. + CLOCK_SOURCE_IS_CONTINUOUS;
  140. +
  141. + ret = clocksource_register_hz(&info->clksrc, 1000);
  142. + if (ret) {
  143. + dev_err(&pdev->dev, "failed to register clock source: %d\n", ret);
  144. + goto disable_clk;
  145. + }
  146. +
  147. dev_notice(&pdev->dev, "Tegra internal Real Time Clock\n");
  148. return 0;
  149. @@ -346,6 +387,7 @@ static void tegra_rtc_remove(struct platform_device *pdev)
  150. {
  151. struct tegra_rtc_info *info = platform_get_drvdata(pdev);
  152. + clocksource_unregister(&info->clksrc);
  153. clk_disable_unprepare(info->clk);
  154. }
  155. --
  156. 2.44.0
  157. From 358f95ff76d353fb3b0e15ce352777b0729f4211 Mon Sep 17 00:00:00 2001
  158. From: Jon Hunter <[email protected]>
  159. Date: Thu, 12 Oct 2023 11:49:09 +0100
  160. Subject: [PATCH] memory: tegra: Add Tegra234 clients for RCE and VI
  161. Add the Tegra234 memory client entries for the Real-time Camera Engine
  162. (RCE) and Video Input (VI) devices.
  163. Signed-off-by: Jon Hunter <[email protected]>
  164. Acked-by: Thierry Reding <[email protected]>
  165. Link: https://lore.kernel.org/r/[email protected]
  166. Signed-off-by: Krzysztof Kozlowski <[email protected]>
  167. ---
  168. drivers/memory/tegra/tegra234.c | 60 +++++++++++++++++++++++++++++++++
  169. 1 file changed, 60 insertions(+)
  170. diff --git a/drivers/memory/tegra/tegra234.c b/drivers/memory/tegra/tegra234.c
  171. index fa40c49b070d..b8a7af2d36c1 100644
  172. --- a/drivers/memory/tegra/tegra234.c
  173. +++ b/drivers/memory/tegra/tegra234.c
  174. @@ -449,6 +449,18 @@ static const struct tegra_mc_client tegra234_mc_clients[] = {
  175. .security = 0x38c,
  176. },
  177. },
  178. + }, {
  179. + .id = TEGRA234_MEMORY_CLIENT_VIW,
  180. + .name = "viw",
  181. + .bpmp_id = TEGRA_ICC_BPMP_VI,
  182. + .type = TEGRA_ICC_ISO_VI,
  183. + .sid = TEGRA234_SID_ISO_VI,
  184. + .regs = {
  185. + .sid = {
  186. + .override = 0x390,
  187. + .security = 0x394,
  188. + },
  189. + },
  190. }, {
  191. .id = TEGRA234_MEMORY_CLIENT_NVDECSRD,
  192. .name = "nvdecsrd",
  193. @@ -621,6 +633,30 @@ static const struct tegra_mc_client tegra234_mc_clients[] = {
  194. .security = 0x50c,
  195. },
  196. },
  197. + }, {
  198. + .id = TEGRA234_MEMORY_CLIENT_VIFALR,
  199. + .name = "vifalr",
  200. + .bpmp_id = TEGRA_ICC_BPMP_VIFAL,
  201. + .type = TEGRA_ICC_ISO_VIFAL,
  202. + .sid = TEGRA234_SID_ISO_VIFALC,
  203. + .regs = {
  204. + .sid = {
  205. + .override = 0x5e0,
  206. + .security = 0x5e4,
  207. + },
  208. + },
  209. + }, {
  210. + .id = TEGRA234_MEMORY_CLIENT_VIFALW,
  211. + .name = "vifalw",
  212. + .bpmp_id = TEGRA_ICC_BPMP_VIFAL,
  213. + .type = TEGRA_ICC_ISO_VIFAL,
  214. + .sid = TEGRA234_SID_ISO_VIFALC,
  215. + .regs = {
  216. + .sid = {
  217. + .override = 0x5e8,
  218. + .security = 0x5ec,
  219. + },
  220. + },
  221. }, {
  222. .id = TEGRA234_MEMORY_CLIENT_DLA0RDA,
  223. .name = "dla0rda",
  224. @@ -701,6 +737,30 @@ static const struct tegra_mc_client tegra234_mc_clients[] = {
  225. .security = 0x62c,
  226. },
  227. },
  228. + }, {
  229. + .id = TEGRA234_MEMORY_CLIENT_RCER,
  230. + .name = "rcer",
  231. + .bpmp_id = TEGRA_ICC_BPMP_RCE,
  232. + .type = TEGRA_ICC_NISO,
  233. + .sid = TEGRA234_SID_RCE,
  234. + .regs = {
  235. + .sid = {
  236. + .override = 0x690,
  237. + .security = 0x694,
  238. + },
  239. + },
  240. + }, {
  241. + .id = TEGRA234_MEMORY_CLIENT_RCEW,
  242. + .name = "rcew",
  243. + .bpmp_id = TEGRA_ICC_BPMP_RCE,
  244. + .type = TEGRA_ICC_NISO,
  245. + .sid = TEGRA234_SID_RCE,
  246. + .regs = {
  247. + .sid = {
  248. + .override = 0x698,
  249. + .security = 0x69c,
  250. + },
  251. + },
  252. }, {
  253. .id = TEGRA234_MEMORY_CLIENT_PCIE0R,
  254. .name = "pcie0r",
  255. --
  256. 2.44.0
  257. From 25c7cb88f78928b48fae9e200a55ec0d4db41925 Mon Sep 17 00:00:00 2001
  258. From: Ninad Malwade <[email protected]>
  259. Date: Fri, 29 Sep 2023 11:36:49 +0100
  260. Subject: [PATCH] hwmon: (ina3221) Add support for channel summation disable
  261. The INA3221 allows the Critical alert pin to be controlled by the
  262. summation control function. This function adds the single
  263. shunt-voltage conversions for the desired channels in order to compare
  264. the combined sum to the programmed limit. The Shunt-Voltage Sum Limit
  265. register contains the programmed value that is compared to the value in
  266. the Shunt-Voltage Sum register in order to determine if the total summed
  267. limit is exceeded. If the shunt-voltage sum limit value is exceeded, the
  268. Critical alert pin pulls low.
  269. For the summation limit to have a meaningful value, we have to use the
  270. same shunt-resistor value on all included channels. Unless equal
  271. shunt-resistor values are used for each channel, the summation control
  272. function cannot be used and it is not enabled by the driver.
  273. To address this, add support to disable the summation of specific
  274. channels via device tree property "ti,summation-disable". The channel
  275. which has this property would be excluded from the calculation of
  276. summation control function.
  277. For example, summation control function calculates Shunt-Voltage Sum as:
  278. - input_shunt_voltage_summation = input_shunt_voltage_channel1
  279. + input_shunt_voltage_channel2
  280. + input_shunt_voltage_channel3
  281. If we want the summation to only use channel1 and channel3, we can add
  282. 'ti,summation-disable' property in device tree node for channel2. Then
  283. the calculation will skip channel2.
  284. - input_shunt_voltage_summation = input_shunt_voltage_channel1
  285. + input_shunt_voltage_channel3
  286. Note that we only want the channel to be skipped for summation control
  287. function rather than completely disabled. Therefore, even if we add the
  288. property 'ti,summation-disable', the channel is still enabled and
  289. functional.
  290. Finally, create debugfs entries that display if summation is disabled
  291. for each of the channels.
  292. Signed-off-by: Rajkumar Kasirajan <[email protected]>
  293. Signed-off-by: Ninad Malwade <[email protected]>
  294. Co-developed-by: Jon Hunter <[email protected]>
  295. Signed-off-by: Jon Hunter <[email protected]>
  296. Link: https://lore.kernel.org/r/[email protected]
  297. Signed-off-by: Guenter Roeck <[email protected]>
  298. ---
  299. drivers/hwmon/ina3221.c | 33 ++++++++++++++++++++++++++++++---
  300. 1 file changed, 30 insertions(+), 3 deletions(-)
  301. diff --git a/drivers/hwmon/ina3221.c b/drivers/hwmon/ina3221.c
  302. index 5ab944056ec0..5ffdc94db436 100644
  303. --- a/drivers/hwmon/ina3221.c
  304. +++ b/drivers/hwmon/ina3221.c
  305. @@ -6,6 +6,7 @@
  306. * Andrew F. Davis <[email protected]>
  307. */
  308. +#include <linux/debugfs.h>
  309. #include <linux/hwmon.h>
  310. #include <linux/hwmon-sysfs.h>
  311. #include <linux/i2c.h>
  312. @@ -99,11 +100,13 @@ enum ina3221_channels {
  313. * @label: label of channel input source
  314. * @shunt_resistor: shunt resistor value of channel input source
  315. * @disconnected: connection status of channel input source
  316. + * @summation_disable: channel summation status of input source
  317. */
  318. struct ina3221_input {
  319. const char *label;
  320. int shunt_resistor;
  321. bool disconnected;
  322. + bool summation_disable;
  323. };
  324. /**
  325. @@ -113,8 +116,10 @@ struct ina3221_input {
  326. * @fields: Register fields of the device
  327. * @inputs: Array of channel input source specific structures
  328. * @lock: mutex lock to serialize sysfs attribute accesses
  329. + * @debugfs: Pointer to debugfs entry for device
  330. * @reg_config: Register value of INA3221_CONFIG
  331. * @summation_shunt_resistor: equivalent shunt resistor value for summation
  332. + * @summation_channel_control: Value written to SCC field in INA3221_MASK_ENABLE
  333. * @single_shot: running in single-shot operating mode
  334. */
  335. struct ina3221_data {
  336. @@ -123,8 +128,10 @@ struct ina3221_data {
  337. struct regmap_field *fields[F_MAX_FIELDS];
  338. struct ina3221_input inputs[INA3221_NUM_CHANNELS];
  339. struct mutex lock;
  340. + struct dentry *debugfs;
  341. u32 reg_config;
  342. int summation_shunt_resistor;
  343. + u32 summation_channel_control;
  344. bool single_shot;
  345. };
  346. @@ -154,7 +161,8 @@ static inline int ina3221_summation_shunt_resistor(struct ina3221_data *ina)
  347. int i, shunt_resistor = 0;
  348. for (i = 0; i < INA3221_NUM_CHANNELS; i++) {
  349. - if (input[i].disconnected || !input[i].shunt_resistor)
  350. + if (input[i].disconnected || !input[i].shunt_resistor ||
  351. + input[i].summation_disable)
  352. continue;
  353. if (!shunt_resistor) {
  354. /* Found the reference shunt resistor value */
  355. @@ -786,6 +794,9 @@ static int ina3221_probe_child_from_dt(struct device *dev,
  356. /* Save the connected input label if available */
  357. of_property_read_string(child, "label", &input->label);
  358. + /* summation channel control */
  359. + input->summation_disable = of_property_read_bool(child, "ti,summation-disable");
  360. +
  361. /* Overwrite default shunt resistor value optionally */
  362. if (!of_property_read_u32(child, "shunt-resistor-micro-ohms", &val)) {
  363. if (val < 1 || val > INT_MAX) {
  364. @@ -827,6 +838,7 @@ static int ina3221_probe(struct i2c_client *client)
  365. struct device *dev = &client->dev;
  366. struct ina3221_data *ina;
  367. struct device *hwmon_dev;
  368. + char name[32];
  369. int i, ret;
  370. ina = devm_kzalloc(dev, sizeof(*ina), GFP_KERNEL);
  371. @@ -873,6 +885,10 @@ static int ina3221_probe(struct i2c_client *client)
  372. /* Initialize summation_shunt_resistor for summation channel control */
  373. ina->summation_shunt_resistor = ina3221_summation_shunt_resistor(ina);
  374. + for (i = 0; i < INA3221_NUM_CHANNELS; i++) {
  375. + if (!ina->inputs[i].summation_disable)
  376. + ina->summation_channel_control |= BIT(14 - i);
  377. + }
  378. ina->pm_dev = dev;
  379. mutex_init(&ina->lock);
  380. @@ -900,6 +916,15 @@ static int ina3221_probe(struct i2c_client *client)
  381. goto fail;
  382. }
  383. + scnprintf(name, sizeof(name), "%s-%s", INA3221_DRIVER_NAME, dev_name(dev));
  384. + ina->debugfs = debugfs_create_dir(name, NULL);
  385. +
  386. + for (i = 0; i < INA3221_NUM_CHANNELS; i++) {
  387. + scnprintf(name, sizeof(name), "in%d_summation_disable", i);
  388. + debugfs_create_bool(name, 0400, ina->debugfs,
  389. + &ina->inputs[i].summation_disable);
  390. + }
  391. +
  392. return 0;
  393. fail:
  394. @@ -918,6 +943,8 @@ static void ina3221_remove(struct i2c_client *client)
  395. struct ina3221_data *ina = dev_get_drvdata(&client->dev);
  396. int i;
  397. + debugfs_remove_recursive(ina->debugfs);
  398. +
  399. pm_runtime_disable(ina->pm_dev);
  400. pm_runtime_set_suspended(ina->pm_dev);
  401. @@ -978,13 +1005,13 @@ static int ina3221_resume(struct device *dev)
  402. /* Initialize summation channel control */
  403. if (ina->summation_shunt_resistor) {
  404. /*
  405. - * Take all three channels into summation by default
  406. + * Sum only channels that are not disabled for summation.
  407. * Shunt measurements of disconnected channels should
  408. * be 0, so it does not matter for summation.
  409. */
  410. ret = regmap_update_bits(ina->regmap, INA3221_MASK_ENABLE,
  411. INA3221_MASK_ENABLE_SCC_MASK,
  412. - INA3221_MASK_ENABLE_SCC_MASK);
  413. + ina->summation_channel_control);
  414. if (ret) {
  415. dev_err(dev, "Unable to control summation channel\n");
  416. return ret;
  417. --
  418. 2.44.0
  419. From 25a9a0d4819018096742defddaf6fd6ea237e76f Mon Sep 17 00:00:00 2001
  420. From: Sumit Gupta <[email protected]>
  421. Date: Wed, 4 Oct 2023 19:35:36 +0530
  422. Subject: [PATCH] cpufreq: tegra194: save CPU data to avoid repeated SMP calls
  423. Currently, we make SMP call on every frequency set request to get the
  424. physical 'CPU ID' and 'CLUSTER ID' for the target CPU. This change
  425. optimizes the repeated calls by storing the physical IDs and the per
  426. core frequency register offset for all CPUs during boot. Later this
  427. info is used directly when required to set the frequency or read it
  428. from ACTMON counters.
  429. Signed-off-by: Sumit Gupta <[email protected]>
  430. Signed-off-by: Viresh Kumar <[email protected]>
  431. ---
  432. drivers/cpufreq/tegra194-cpufreq.c | 79 +++++++++++++++++++-----------
  433. 1 file changed, 51 insertions(+), 28 deletions(-)
  434. diff --git a/drivers/cpufreq/tegra194-cpufreq.c b/drivers/cpufreq/tegra194-cpufreq.c
  435. index 386aed3637b4..f6a8e6cf6d94 100644
  436. --- a/drivers/cpufreq/tegra194-cpufreq.c
  437. +++ b/drivers/cpufreq/tegra194-cpufreq.c
  438. @@ -39,6 +39,12 @@
  439. /* cpufreq transisition latency */
  440. #define TEGRA_CPUFREQ_TRANSITION_LATENCY (300 * 1000) /* unit in nanoseconds */
  441. +struct tegra_cpu_data {
  442. + u32 cpuid;
  443. + u32 clusterid;
  444. + void __iomem *freq_core_reg;
  445. +};
  446. +
  447. struct tegra_cpu_ctr {
  448. u32 cpu;
  449. u32 coreclk_cnt, last_coreclk_cnt;
  450. @@ -69,6 +75,7 @@ struct tegra194_cpufreq_data {
  451. struct cpufreq_frequency_table **bpmp_luts;
  452. const struct tegra_cpufreq_soc *soc;
  453. bool icc_dram_bw_scaling;
  454. + struct tegra_cpu_data *cpu_data;
  455. };
  456. static struct workqueue_struct *read_counters_wq;
  457. @@ -116,14 +123,8 @@ static void tegra234_get_cpu_cluster_id(u32 cpu, u32 *cpuid, u32 *clusterid)
  458. static int tegra234_get_cpu_ndiv(u32 cpu, u32 cpuid, u32 clusterid, u64 *ndiv)
  459. {
  460. struct tegra194_cpufreq_data *data = cpufreq_get_driver_data();
  461. - void __iomem *freq_core_reg;
  462. - u64 mpidr_id;
  463. -
  464. - /* use physical id to get address of per core frequency register */
  465. - mpidr_id = (clusterid * data->soc->maxcpus_per_cluster) + cpuid;
  466. - freq_core_reg = SCRATCH_FREQ_CORE_REG(data, mpidr_id);
  467. - *ndiv = readl(freq_core_reg) & NDIV_MASK;
  468. + *ndiv = readl(data->cpu_data[cpu].freq_core_reg) & NDIV_MASK;
  469. return 0;
  470. }
  471. @@ -131,19 +132,10 @@ static int tegra234_get_cpu_ndiv(u32 cpu, u32 cpuid, u32 clusterid, u64 *ndiv)
  472. static void tegra234_set_cpu_ndiv(struct cpufreq_policy *policy, u64 ndiv)
  473. {
  474. struct tegra194_cpufreq_data *data = cpufreq_get_driver_data();
  475. - void __iomem *freq_core_reg;
  476. - u32 cpu, cpuid, clusterid;
  477. - u64 mpidr_id;
  478. -
  479. - for_each_cpu_and(cpu, policy->cpus, cpu_online_mask) {
  480. - data->soc->ops->get_cpu_cluster_id(cpu, &cpuid, &clusterid);
  481. -
  482. - /* use physical id to get address of per core frequency register */
  483. - mpidr_id = (clusterid * data->soc->maxcpus_per_cluster) + cpuid;
  484. - freq_core_reg = SCRATCH_FREQ_CORE_REG(data, mpidr_id);
  485. + u32 cpu;
  486. - writel(ndiv, freq_core_reg);
  487. - }
  488. + for_each_cpu_and(cpu, policy->cpus, cpu_online_mask)
  489. + writel(ndiv, data->cpu_data[cpu].freq_core_reg);
  490. }
  491. /*
  492. @@ -157,11 +149,10 @@ static void tegra234_read_counters(struct tegra_cpu_ctr *c)
  493. {
  494. struct tegra194_cpufreq_data *data = cpufreq_get_driver_data();
  495. void __iomem *actmon_reg;
  496. - u32 cpuid, clusterid;
  497. u64 val;
  498. - data->soc->ops->get_cpu_cluster_id(c->cpu, &cpuid, &clusterid);
  499. - actmon_reg = CORE_ACTMON_CNTR_REG(data, clusterid, cpuid);
  500. + actmon_reg = CORE_ACTMON_CNTR_REG(data, data->cpu_data[c->cpu].clusterid,
  501. + data->cpu_data[c->cpu].cpuid);
  502. val = readq(actmon_reg);
  503. c->last_refclk_cnt = upper_32_bits(val);
  504. @@ -357,19 +348,17 @@ static void tegra194_set_cpu_ndiv(struct cpufreq_policy *policy, u64 ndiv)
  505. static unsigned int tegra194_get_speed(u32 cpu)
  506. {
  507. struct tegra194_cpufreq_data *data = cpufreq_get_driver_data();
  508. + u32 clusterid = data->cpu_data[cpu].clusterid;
  509. struct cpufreq_frequency_table *pos;
  510. - u32 cpuid, clusterid;
  511. unsigned int rate;
  512. u64 ndiv;
  513. int ret;
  514. - data->soc->ops->get_cpu_cluster_id(cpu, &cpuid, &clusterid);
  515. -
  516. /* reconstruct actual cpu freq using counters */
  517. rate = tegra194_calculate_speed(cpu);
  518. /* get last written ndiv value */
  519. - ret = data->soc->ops->get_cpu_ndiv(cpu, cpuid, clusterid, &ndiv);
  520. + ret = data->soc->ops->get_cpu_ndiv(cpu, data->cpu_data[cpu].cpuid, clusterid, &ndiv);
  521. if (WARN_ON_ONCE(ret))
  522. return rate;
  523. @@ -475,13 +464,12 @@ static int tegra194_cpufreq_init(struct cpufreq_policy *policy)
  524. {
  525. struct tegra194_cpufreq_data *data = cpufreq_get_driver_data();
  526. int maxcpus_per_cluster = data->soc->maxcpus_per_cluster;
  527. + u32 clusterid = data->cpu_data[policy->cpu].clusterid;
  528. struct cpufreq_frequency_table *freq_table;
  529. struct cpufreq_frequency_table *bpmp_lut;
  530. u32 start_cpu, cpu;
  531. - u32 clusterid;
  532. int ret;
  533. - data->soc->ops->get_cpu_cluster_id(policy->cpu, NULL, &clusterid);
  534. if (clusterid >= data->soc->num_clusters || !data->bpmp_luts[clusterid])
  535. return -EINVAL;
  536. @@ -659,6 +647,28 @@ tegra_cpufreq_bpmp_read_lut(struct platform_device *pdev, struct tegra_bpmp *bpm
  537. return freq_table;
  538. }
  539. +static int tegra194_cpufreq_store_physids(unsigned int cpu, struct tegra194_cpufreq_data *data)
  540. +{
  541. + int num_cpus = data->soc->maxcpus_per_cluster * data->soc->num_clusters;
  542. + u32 cpuid, clusterid;
  543. + u64 mpidr_id;
  544. +
  545. + if (cpu > (num_cpus - 1)) {
  546. + pr_err("cpufreq: wrong num of cpus or clusters in soc data\n");
  547. + return -EINVAL;
  548. + }
  549. +
  550. + data->soc->ops->get_cpu_cluster_id(cpu, &cpuid, &clusterid);
  551. +
  552. + mpidr_id = (clusterid * data->soc->maxcpus_per_cluster) + cpuid;
  553. +
  554. + data->cpu_data[cpu].cpuid = cpuid;
  555. + data->cpu_data[cpu].clusterid = clusterid;
  556. + data->cpu_data[cpu].freq_core_reg = SCRATCH_FREQ_CORE_REG(data, mpidr_id);
  557. +
  558. + return 0;
  559. +}
  560. +
  561. static int tegra194_cpufreq_probe(struct platform_device *pdev)
  562. {
  563. const struct tegra_cpufreq_soc *soc;
  564. @@ -666,6 +676,7 @@ static int tegra194_cpufreq_probe(struct platform_device *pdev)
  565. struct tegra_bpmp *bpmp;
  566. struct device *cpu_dev;
  567. int err, i;
  568. + u32 cpu;
  569. data = devm_kzalloc(&pdev->dev, sizeof(*data), GFP_KERNEL);
  570. if (!data)
  571. @@ -692,6 +703,12 @@ static int tegra194_cpufreq_probe(struct platform_device *pdev)
  572. return PTR_ERR(data->regs);
  573. }
  574. + data->cpu_data = devm_kcalloc(&pdev->dev, data->soc->num_clusters *
  575. + data->soc->maxcpus_per_cluster,
  576. + sizeof(*data->cpu_data), GFP_KERNEL);
  577. + if (!data->cpu_data)
  578. + return -ENOMEM;
  579. +
  580. platform_set_drvdata(pdev, data);
  581. bpmp = tegra_bpmp_get(&pdev->dev);
  582. @@ -713,6 +730,12 @@ static int tegra194_cpufreq_probe(struct platform_device *pdev)
  583. }
  584. }
  585. + for_each_possible_cpu(cpu) {
  586. + err = tegra194_cpufreq_store_physids(cpu, data);
  587. + if (err)
  588. + goto err_free_res;
  589. + }
  590. +
  591. tegra194_cpufreq_driver.driver_data = data;
  592. /* Check for optional OPPv2 and interconnect paths on CPU0 to enable ICC scaling */
  593. --
  594. 2.44.0
  595. From 4bbfa5e4d6e16ed13acff33abc92913428530593 Mon Sep 17 00:00:00 2001
  596. From: Sumit Gupta <[email protected]>
  597. Date: Wed, 4 Oct 2023 19:35:37 +0530
  598. Subject: [PATCH] cpufreq: tegra194: use refclk delta based loop instead of
  599. udelay
  600. Use reference clock count based loop instead of "udelay()" for
  601. sampling of counters to improve the accuracy of re-generated CPU
  602. frequency. "udelay()" internally calls "WFE" which stops the
  603. counters and results in bigger delta between the last set freq
  604. and the re-generated value from counters. The counter sampling
  605. window used in loop is the minimum number of reference clock
  606. cycles which is known to give a stable value of CPU frequency.
  607. The change also helps to reduce the sampling window from "500us"
  608. to "<50us".
  609. Suggested-by: Antti Miettinen <[email protected]>
  610. Signed-off-by: Sumit Gupta <[email protected]>
  611. Signed-off-by: Viresh Kumar <[email protected]>
  612. ---
  613. drivers/cpufreq/tegra194-cpufreq.c | 72 +++++++++++++++++++++++-------
  614. 1 file changed, 55 insertions(+), 17 deletions(-)
  615. diff --git a/drivers/cpufreq/tegra194-cpufreq.c b/drivers/cpufreq/tegra194-cpufreq.c
  616. index f6a8e6cf6d94..9dae6195e0e7 100644
  617. --- a/drivers/cpufreq/tegra194-cpufreq.c
  618. +++ b/drivers/cpufreq/tegra194-cpufreq.c
  619. @@ -5,7 +5,6 @@
  620. #include <linux/cpu.h>
  621. #include <linux/cpufreq.h>
  622. -#include <linux/delay.h>
  623. #include <linux/dma-mapping.h>
  624. #include <linux/module.h>
  625. #include <linux/of.h>
  626. @@ -21,10 +20,11 @@
  627. #define KHZ 1000
  628. #define REF_CLK_MHZ 408 /* 408 MHz */
  629. -#define US_DELAY 500
  630. #define CPUFREQ_TBL_STEP_HZ (50 * KHZ * KHZ)
  631. #define MAX_CNT ~0U
  632. +#define MAX_DELTA_KHZ 115200
  633. +
  634. #define NDIV_MASK 0x1FF
  635. #define CORE_OFFSET(cpu) (cpu * 8)
  636. @@ -68,6 +68,7 @@ struct tegra_cpufreq_soc {
  637. int maxcpus_per_cluster;
  638. unsigned int num_clusters;
  639. phys_addr_t actmon_cntr_base;
  640. + u32 refclk_delta_min;
  641. };
  642. struct tegra194_cpufreq_data {
  643. @@ -149,6 +150,8 @@ static void tegra234_read_counters(struct tegra_cpu_ctr *c)
  644. {
  645. struct tegra194_cpufreq_data *data = cpufreq_get_driver_data();
  646. void __iomem *actmon_reg;
  647. + u32 delta_refcnt;
  648. + int cnt = 0;
  649. u64 val;
  650. actmon_reg = CORE_ACTMON_CNTR_REG(data, data->cpu_data[c->cpu].clusterid,
  651. @@ -157,10 +160,25 @@ static void tegra234_read_counters(struct tegra_cpu_ctr *c)
  652. val = readq(actmon_reg);
  653. c->last_refclk_cnt = upper_32_bits(val);
  654. c->last_coreclk_cnt = lower_32_bits(val);
  655. - udelay(US_DELAY);
  656. - val = readq(actmon_reg);
  657. - c->refclk_cnt = upper_32_bits(val);
  658. - c->coreclk_cnt = lower_32_bits(val);
  659. +
  660. + /*
  661. + * The sampling window is based on the minimum number of reference
  662. + * clock cycles which is known to give a stable value of CPU frequency.
  663. + */
  664. + do {
  665. + val = readq(actmon_reg);
  666. + c->refclk_cnt = upper_32_bits(val);
  667. + c->coreclk_cnt = lower_32_bits(val);
  668. + if (c->refclk_cnt < c->last_refclk_cnt)
  669. + delta_refcnt = c->refclk_cnt + (MAX_CNT - c->last_refclk_cnt);
  670. + else
  671. + delta_refcnt = c->refclk_cnt - c->last_refclk_cnt;
  672. + if (++cnt >= 0xFFFF) {
  673. + pr_warn("cpufreq: problem with refclk on cpu:%d, delta_refcnt:%u, cnt:%d\n",
  674. + c->cpu, delta_refcnt, cnt);
  675. + break;
  676. + }
  677. + } while (delta_refcnt < data->soc->refclk_delta_min);
  678. }
  679. static struct tegra_cpufreq_ops tegra234_cpufreq_ops = {
  680. @@ -175,6 +193,7 @@ static const struct tegra_cpufreq_soc tegra234_cpufreq_soc = {
  681. .actmon_cntr_base = 0x9000,
  682. .maxcpus_per_cluster = 4,
  683. .num_clusters = 3,
  684. + .refclk_delta_min = 16000,
  685. };
  686. static const struct tegra_cpufreq_soc tegra239_cpufreq_soc = {
  687. @@ -182,6 +201,7 @@ static const struct tegra_cpufreq_soc tegra239_cpufreq_soc = {
  688. .actmon_cntr_base = 0x4000,
  689. .maxcpus_per_cluster = 8,
  690. .num_clusters = 1,
  691. + .refclk_delta_min = 16000,
  692. };
  693. static void tegra194_get_cpu_cluster_id(u32 cpu, u32 *cpuid, u32 *clusterid)
  694. @@ -222,15 +242,33 @@ static inline u32 map_ndiv_to_freq(struct mrq_cpu_ndiv_limits_response
  695. static void tegra194_read_counters(struct tegra_cpu_ctr *c)
  696. {
  697. + struct tegra194_cpufreq_data *data = cpufreq_get_driver_data();
  698. + u32 delta_refcnt;
  699. + int cnt = 0;
  700. u64 val;
  701. val = read_freq_feedback();
  702. c->last_refclk_cnt = lower_32_bits(val);
  703. c->last_coreclk_cnt = upper_32_bits(val);
  704. - udelay(US_DELAY);
  705. - val = read_freq_feedback();
  706. - c->refclk_cnt = lower_32_bits(val);
  707. - c->coreclk_cnt = upper_32_bits(val);
  708. +
  709. + /*
  710. + * The sampling window is based on the minimum number of reference
  711. + * clock cycles which is known to give a stable value of CPU frequency.
  712. + */
  713. + do {
  714. + val = read_freq_feedback();
  715. + c->refclk_cnt = lower_32_bits(val);
  716. + c->coreclk_cnt = upper_32_bits(val);
  717. + if (c->refclk_cnt < c->last_refclk_cnt)
  718. + delta_refcnt = c->refclk_cnt + (MAX_CNT - c->last_refclk_cnt);
  719. + else
  720. + delta_refcnt = c->refclk_cnt - c->last_refclk_cnt;
  721. + if (++cnt >= 0xFFFF) {
  722. + pr_warn("cpufreq: problem with refclk on cpu:%d, delta_refcnt:%u, cnt:%d\n",
  723. + c->cpu, delta_refcnt, cnt);
  724. + break;
  725. + }
  726. + } while (delta_refcnt < data->soc->refclk_delta_min);
  727. }
  728. static void tegra_read_counters(struct work_struct *work)
  729. @@ -288,9 +326,8 @@ static unsigned int tegra194_calculate_speed(u32 cpu)
  730. u32 rate_mhz;
  731. /*
  732. - * udelay() is required to reconstruct cpu frequency over an
  733. - * observation window. Using workqueue to call udelay() with
  734. - * interrupts enabled.
  735. + * Reconstruct cpu frequency over an observation/sampling window.
  736. + * Using workqueue to keep interrupts enabled during the interval.
  737. */
  738. read_counters_work.c.cpu = cpu;
  739. INIT_WORK_ONSTACK(&read_counters_work.work, tegra_read_counters);
  740. @@ -372,9 +409,9 @@ static unsigned int tegra194_get_speed(u32 cpu)
  741. if (pos->driver_data != ndiv)
  742. continue;
  743. - if (abs(pos->frequency - rate) > 115200) {
  744. - pr_warn("cpufreq: cpu%d,cur:%u,set:%u,set ndiv:%llu\n",
  745. - cpu, rate, pos->frequency, ndiv);
  746. + if (abs(pos->frequency - rate) > MAX_DELTA_KHZ) {
  747. + pr_warn("cpufreq: cpu%d,cur:%u,set:%u,delta:%d,set ndiv:%llu\n",
  748. + cpu, rate, pos->frequency, abs(rate - pos->frequency), ndiv);
  749. } else {
  750. rate = pos->frequency;
  751. }
  752. @@ -568,6 +605,7 @@ static const struct tegra_cpufreq_soc tegra194_cpufreq_soc = {
  753. .ops = &tegra194_cpufreq_ops,
  754. .maxcpus_per_cluster = 2,
  755. .num_clusters = 4,
  756. + .refclk_delta_min = 16000,
  757. };
  758. static void tegra194_cpufreq_free_resources(void)
  759. @@ -684,7 +722,7 @@ static int tegra194_cpufreq_probe(struct platform_device *pdev)
  760. soc = of_device_get_match_data(&pdev->dev);
  761. - if (soc->ops && soc->maxcpus_per_cluster && soc->num_clusters) {
  762. + if (soc->ops && soc->maxcpus_per_cluster && soc->num_clusters && soc->refclk_delta_min) {
  763. data->soc = soc;
  764. } else {
  765. dev_err(&pdev->dev, "soc data missing\n");
  766. --
  767. 2.44.0
  768. From a9aa1762789716af85861e67349ccb7eedaca61a Mon Sep 17 00:00:00 2001
  769. From: Sumit Gupta <[email protected]>
  770. Date: Mon, 9 Oct 2023 13:54:23 +0530
  771. Subject: [PATCH] cpufreq: tegra194: remove redundant AND with cpu_online_mask
  772. Remove redundant 'AND' with cpu_online_mask as the policy->cpus always
  773. contains only the currently online CPUs.
  774. Suggested-by: Viresh Kumar <[email protected]>
  775. Link: https://lore.kernel.org/lkml/20231003050019.a6mcchw2o2z2wkrh@vireshk-i7/
  776. Signed-off-by: Sumit Gupta <[email protected]>
  777. [ Viresh: Fix rebase conflict ]
  778. Signed-off-by: Viresh Kumar <[email protected]>
  779. ---
  780. drivers/cpufreq/tegra194-cpufreq.c | 2 +-
  781. 1 file changed, 1 insertion(+), 1 deletion(-)
  782. diff --git a/drivers/cpufreq/tegra194-cpufreq.c b/drivers/cpufreq/tegra194-cpufreq.c
  783. index 9dae6195e0e7..59865ea455a8 100644
  784. --- a/drivers/cpufreq/tegra194-cpufreq.c
  785. +++ b/drivers/cpufreq/tegra194-cpufreq.c
  786. @@ -135,7 +135,7 @@ static void tegra234_set_cpu_ndiv(struct cpufreq_policy *policy, u64 ndiv)
  787. struct tegra194_cpufreq_data *data = cpufreq_get_driver_data();
  788. u32 cpu;
  789. - for_each_cpu_and(cpu, policy->cpus, cpu_online_mask)
  790. + for_each_cpu(cpu, policy->cpus)
  791. writel(ndiv, data->cpu_data[cpu].freq_core_reg);
  792. }
  793. --
  794. 2.44.0
  795. From 2d739084b8bf97d5aa230127cd9de200164641cb Mon Sep 17 00:00:00 2001
  796. From: Thierry Reding <[email protected]>
  797. Date: Wed, 1 Nov 2023 18:20:16 +0100
  798. Subject: [PATCH] fbdev/simplefb: Support memory-region property
  799. The simple-framebuffer bindings specify that the "memory-region"
  800. property can be used as an alternative to the "reg" property to define
  801. the framebuffer memory used by the display hardware. Implement support
  802. for this in the simplefb driver.
  803. Reviewed-by: Hans de Goede <[email protected]>
  804. Signed-off-by: Thierry Reding <[email protected]>
  805. Signed-off-by: Hans de Goede <[email protected]>
  806. Link: https://patchwork.freedesktop.org/patch/msgid/[email protected]
  807. ---
  808. drivers/video/fbdev/simplefb.c | 35 +++++++++++++++++++++++++++++-----
  809. 1 file changed, 30 insertions(+), 5 deletions(-)
  810. diff --git a/drivers/video/fbdev/simplefb.c b/drivers/video/fbdev/simplefb.c
  811. index 62f99f6fccd3..18025f34fde7 100644
  812. --- a/drivers/video/fbdev/simplefb.c
  813. +++ b/drivers/video/fbdev/simplefb.c
  814. @@ -21,6 +21,7 @@
  815. #include <linux/platform_device.h>
  816. #include <linux/clk.h>
  817. #include <linux/of.h>
  818. +#include <linux/of_address.h>
  819. #include <linux/of_clk.h>
  820. #include <linux/of_platform.h>
  821. #include <linux/parser.h>
  822. @@ -121,12 +122,13 @@ struct simplefb_params {
  823. u32 height;
  824. u32 stride;
  825. struct simplefb_format *format;
  826. + struct resource memory;
  827. };
  828. static int simplefb_parse_dt(struct platform_device *pdev,
  829. struct simplefb_params *params)
  830. {
  831. - struct device_node *np = pdev->dev.of_node;
  832. + struct device_node *np = pdev->dev.of_node, *mem;
  833. int ret;
  834. const char *format;
  835. int i;
  836. @@ -166,6 +168,23 @@ static int simplefb_parse_dt(struct platform_device *pdev,
  837. return -EINVAL;
  838. }
  839. + mem = of_parse_phandle(np, "memory-region", 0);
  840. + if (mem) {
  841. + ret = of_address_to_resource(mem, 0, &params->memory);
  842. + if (ret < 0) {
  843. + dev_err(&pdev->dev, "failed to parse memory-region\n");
  844. + of_node_put(mem);
  845. + return ret;
  846. + }
  847. +
  848. + if (of_property_present(np, "reg"))
  849. + dev_warn(&pdev->dev, "preferring \"memory-region\" over \"reg\" property\n");
  850. +
  851. + of_node_put(mem);
  852. + } else {
  853. + memset(&params->memory, 0, sizeof(params->memory));
  854. + }
  855. +
  856. return 0;
  857. }
  858. @@ -193,6 +212,8 @@ static int simplefb_parse_pd(struct platform_device *pdev,
  859. return -EINVAL;
  860. }
  861. + memset(&params->memory, 0, sizeof(params->memory));
  862. +
  863. return 0;
  864. }
  865. @@ -431,10 +452,14 @@ static int simplefb_probe(struct platform_device *pdev)
  866. if (ret)
  867. return ret;
  868. - res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
  869. - if (!res) {
  870. - dev_err(&pdev->dev, "No memory resource\n");
  871. - return -EINVAL;
  872. + if (params.memory.start == 0 && params.memory.end == 0) {
  873. + res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
  874. + if (!res) {
  875. + dev_err(&pdev->dev, "No memory resource\n");
  876. + return -EINVAL;
  877. + }
  878. + } else {
  879. + res = &params.memory;
  880. }
  881. mem = request_mem_region(res->start, resource_size(res), "simplefb");
  882. --
  883. 2.44.0
  884. From eda00f6c55deb6824ed12f8451e8079184447f18 Mon Sep 17 00:00:00 2001
  885. From: Thierry Reding <[email protected]>
  886. Date: Wed, 1 Nov 2023 18:20:17 +0100
  887. Subject: [PATCH] fbdev/simplefb: Add support for generic power-domains
  888. The simple-framebuffer device tree bindings document the power-domains
  889. property, so make sure that simplefb supports it. This ensures that the
  890. power domains remain enabled as long as simplefb is active.
  891. v2: - remove unnecessary call to simplefb_detach_genpds() since that's
  892. already done automatically by devres
  893. - fix crash if power-domains property is missing in DT
  894. Signed-off-by: Thierry Reding <[email protected]>
  895. Reviewed-by: Hans de Goede <[email protected]>
  896. Signed-off-by: Hans de Goede <[email protected]>
  897. Link: https://patchwork.freedesktop.org/patch/msgid/[email protected]
  898. ---
  899. drivers/video/fbdev/simplefb.c | 93 ++++++++++++++++++++++++++++++++++
  900. 1 file changed, 93 insertions(+)
  901. diff --git a/drivers/video/fbdev/simplefb.c b/drivers/video/fbdev/simplefb.c
  902. index 18025f34fde7..fe682af63827 100644
  903. --- a/drivers/video/fbdev/simplefb.c
  904. +++ b/drivers/video/fbdev/simplefb.c
  905. @@ -25,6 +25,7 @@
  906. #include <linux/of_clk.h>
  907. #include <linux/of_platform.h>
  908. #include <linux/parser.h>
  909. +#include <linux/pm_domain.h>
  910. #include <linux/regulator/consumer.h>
  911. static const struct fb_fix_screeninfo simplefb_fix = {
  912. @@ -78,6 +79,11 @@ struct simplefb_par {
  913. unsigned int clk_count;
  914. struct clk **clks;
  915. #endif
  916. +#if defined CONFIG_OF && defined CONFIG_PM_GENERIC_DOMAINS
  917. + unsigned int num_genpds;
  918. + struct device **genpds;
  919. + struct device_link **genpd_links;
  920. +#endif
  921. #if defined CONFIG_OF && defined CONFIG_REGULATOR
  922. bool regulators_enabled;
  923. u32 regulator_count;
  924. @@ -432,6 +438,89 @@ static void simplefb_regulators_enable(struct simplefb_par *par,
  925. static void simplefb_regulators_destroy(struct simplefb_par *par) { }
  926. #endif
  927. +#if defined CONFIG_OF && defined CONFIG_PM_GENERIC_DOMAINS
  928. +static void simplefb_detach_genpds(void *res)
  929. +{
  930. + struct simplefb_par *par = res;
  931. + unsigned int i = par->num_genpds;
  932. +
  933. + if (par->num_genpds <= 1)
  934. + return;
  935. +
  936. + while (i--) {
  937. + if (par->genpd_links[i])
  938. + device_link_del(par->genpd_links[i]);
  939. +
  940. + if (!IS_ERR_OR_NULL(par->genpds[i]))
  941. + dev_pm_domain_detach(par->genpds[i], true);
  942. + }
  943. +}
  944. +
  945. +static int simplefb_attach_genpds(struct simplefb_par *par,
  946. + struct platform_device *pdev)
  947. +{
  948. + struct device *dev = &pdev->dev;
  949. + unsigned int i;
  950. + int err;
  951. +
  952. + err = of_count_phandle_with_args(dev->of_node, "power-domains",
  953. + "#power-domain-cells");
  954. + if (err < 0) {
  955. + dev_info(dev, "failed to parse power-domains: %d\n", err);
  956. + return err;
  957. + }
  958. +
  959. + par->num_genpds = err;
  960. +
  961. + /*
  962. + * Single power-domain devices are handled by the driver core, so
  963. + * nothing to do here.
  964. + */
  965. + if (par->num_genpds <= 1)
  966. + return 0;
  967. +
  968. + par->genpds = devm_kcalloc(dev, par->num_genpds, sizeof(*par->genpds),
  969. + GFP_KERNEL);
  970. + if (!par->genpds)
  971. + return -ENOMEM;
  972. +
  973. + par->genpd_links = devm_kcalloc(dev, par->num_genpds,
  974. + sizeof(*par->genpd_links),
  975. + GFP_KERNEL);
  976. + if (!par->genpd_links)
  977. + return -ENOMEM;
  978. +
  979. + for (i = 0; i < par->num_genpds; i++) {
  980. + par->genpds[i] = dev_pm_domain_attach_by_id(dev, i);
  981. + if (IS_ERR(par->genpds[i])) {
  982. + err = PTR_ERR(par->genpds[i]);
  983. + if (err == -EPROBE_DEFER) {
  984. + simplefb_detach_genpds(par);
  985. + return err;
  986. + }
  987. +
  988. + dev_warn(dev, "failed to attach domain %u: %d\n", i, err);
  989. + continue;
  990. + }
  991. +
  992. + par->genpd_links[i] = device_link_add(dev, par->genpds[i],
  993. + DL_FLAG_STATELESS |
  994. + DL_FLAG_PM_RUNTIME |
  995. + DL_FLAG_RPM_ACTIVE);
  996. + if (!par->genpd_links[i])
  997. + dev_warn(dev, "failed to link power-domain %u\n", i);
  998. + }
  999. +
  1000. + return devm_add_action_or_reset(dev, simplefb_detach_genpds, par);
  1001. +}
  1002. +#else
  1003. +static int simplefb_attach_genpds(struct simplefb_par *par,
  1004. + struct platform_device *pdev)
  1005. +{
  1006. + return 0;
  1007. +}
  1008. +#endif
  1009. +
  1010. static int simplefb_probe(struct platform_device *pdev)
  1011. {
  1012. int ret;
  1013. @@ -518,6 +607,10 @@ static int simplefb_probe(struct platform_device *pdev)
  1014. if (ret < 0)
  1015. goto error_clocks;
  1016. + ret = simplefb_attach_genpds(par, pdev);
  1017. + if (ret < 0)
  1018. + goto error_regulators;
  1019. +
  1020. simplefb_clocks_enable(par, pdev);
  1021. simplefb_regulators_enable(par, pdev);
  1022. --
  1023. 2.44.0
  1024. From 7af6e409a0adf6df45a80d23654fd2ea9b23c619 Mon Sep 17 00:00:00 2001
  1025. From: Thierry Reding <[email protected]>
  1026. Date: Fri, 13 Oct 2023 17:51:04 +0200
  1027. Subject: [PATCH] thermal/drivers/max77620: Remove duplicate error message
  1028. The thermal_of_zone_register() function already prints an error message
  1029. when appropriate, so remove the extra one from the MAX77620 thermal
  1030. driver.
  1031. This fixes a spurious error message when no thermal zone was defined
  1032. for the MAX77620 in device tree.
  1033. Reported-by: Nicolas Chauvet <[email protected]>
  1034. Signed-off-by: Thierry Reding <[email protected]>
  1035. Signed-off-by: Daniel Lezcano <[email protected]>
  1036. Link: https://lore.kernel.org/r/[email protected]
  1037. ---
  1038. drivers/thermal/max77620_thermal.c | 8 ++------
  1039. 1 file changed, 2 insertions(+), 6 deletions(-)
  1040. diff --git a/drivers/thermal/max77620_thermal.c b/drivers/thermal/max77620_thermal.c
  1041. index 919b6ee208d8..85a12e98d6dc 100644
  1042. --- a/drivers/thermal/max77620_thermal.c
  1043. +++ b/drivers/thermal/max77620_thermal.c
  1044. @@ -114,12 +114,8 @@ static int max77620_thermal_probe(struct platform_device *pdev)
  1045. mtherm->tz_device = devm_thermal_of_zone_register(&pdev->dev, 0,
  1046. mtherm, &max77620_thermal_ops);
  1047. - if (IS_ERR(mtherm->tz_device)) {
  1048. - ret = PTR_ERR(mtherm->tz_device);
  1049. - dev_err(&pdev->dev, "Failed to register thermal zone: %d\n",
  1050. - ret);
  1051. - return ret;
  1052. - }
  1053. + if (IS_ERR(mtherm->tz_device))
  1054. + return PTR_ERR(mtherm->tz_device);
  1055. ret = devm_request_threaded_irq(&pdev->dev, mtherm->irq_tjalarm1, NULL,
  1056. max77620_thermal_irq,
  1057. --
  1058. 2.44.0
  1059. From 652292925b6083912c3ffd597811556f2aa5414a Mon Sep 17 00:00:00 2001
  1060. From: Rayyan Ansari <[email protected]>
  1061. Date: Thu, 10 Aug 2023 22:45:41 +0100
  1062. Subject: [PATCH] arm64: tegra: Enable IOMMU for host1x on Tegra132
  1063. Add the iommu property to the host1x node to register it with its
  1064. swgroup.
  1065. Signed-off-by: Rayyan Ansari <[email protected]>
  1066. Signed-off-by: Thierry Reding <[email protected]>
  1067. ---
  1068. arch/arm64/boot/dts/nvidia/tegra132.dtsi | 2 ++
  1069. 1 file changed, 2 insertions(+)
  1070. diff --git a/arch/arm64/boot/dts/nvidia/tegra132.dtsi b/arch/arm64/boot/dts/nvidia/tegra132.dtsi
  1071. index 8b78be8f4f9d..7e24a212c7e4 100644
  1072. --- a/arch/arm64/boot/dts/nvidia/tegra132.dtsi
  1073. +++ b/arch/arm64/boot/dts/nvidia/tegra132.dtsi
  1074. @@ -93,6 +93,8 @@ host1x@50000000 {
  1075. resets = <&tegra_car 28>;
  1076. reset-names = "host1x";
  1077. + iommus = <&mc TEGRA_SWGROUP_HC>;
  1078. +
  1079. #address-cells = <2>;
  1080. #size-cells = <2>;
  1081. --
  1082. 2.44.0
  1083. From 6539557c68954d2a0038290d596920b597797d47 Mon Sep 17 00:00:00 2001
  1084. From: Thierry Reding <[email protected]>
  1085. Date: Wed, 26 Jul 2023 18:27:38 +0200
  1086. Subject: [PATCH] dt-bindings: arm: tegra: pmc: Improve property descriptions
  1087. Reformat the description of various properties to make them more
  1088. consistent with existing ones. Make use of json-schema's ability to
  1089. provide a description for individual list items to make improve the
  1090. documentation further.
  1091. Reviewed-by: Rob Herring <[email protected]>
  1092. Signed-off-by: Thierry Reding <[email protected]>
  1093. ---
  1094. .../arm/tegra/nvidia,tegra20-pmc.yaml | 212 +++++++++---------
  1095. 1 file changed, 103 insertions(+), 109 deletions(-)
  1096. diff --git a/Documentation/devicetree/bindings/arm/tegra/nvidia,tegra20-pmc.yaml b/Documentation/devicetree/bindings/arm/tegra/nvidia,tegra20-pmc.yaml
  1097. index 89191cfdf619..38fe66142547 100644
  1098. --- a/Documentation/devicetree/bindings/arm/tegra/nvidia,tegra20-pmc.yaml
  1099. +++ b/Documentation/devicetree/bindings/arm/tegra/nvidia,tegra20-pmc.yaml
  1100. @@ -26,12 +26,10 @@ properties:
  1101. clock-names:
  1102. items:
  1103. + # Tegra clock of the same name
  1104. - const: pclk
  1105. + # 32 KHz clock input
  1106. - const: clk32k_in
  1107. - description:
  1108. - Must includes entries pclk and clk32k_in.
  1109. - pclk is the Tegra clock of that name and clk32k_in is 32KHz clock
  1110. - input to Tegra.
  1111. clocks:
  1112. maxItems: 2
  1113. @@ -41,105 +39,103 @@ properties:
  1114. '#clock-cells':
  1115. const: 1
  1116. - description:
  1117. - Tegra PMC has clk_out_1, clk_out_2, and clk_out_3.
  1118. - PMC also has blink control which allows 32Khz clock output to
  1119. - Tegra blink pad.
  1120. - Consumer of PMC clock should specify the desired clock by having
  1121. - the clock ID in its "clocks" phandle cell with pmc clock provider.
  1122. - See include/dt-bindings/soc/tegra-pmc.h for the list of Tegra PMC
  1123. - clock IDs.
  1124. + description: |
  1125. + Tegra PMC has clk_out_1, clk_out_2, and clk_out_3. PMC also has blink
  1126. + control which allows 32Khz clock output to Tegra blink pad.
  1127. +
  1128. + Consumer of PMC clock should specify the desired clock by having the
  1129. + clock ID in its "clocks" phandle cell with PMC clock provider. See
  1130. + include/dt-bindings/soc/tegra-pmc.h for the list of Tegra PMC clock IDs.
  1131. '#interrupt-cells':
  1132. const: 2
  1133. - description:
  1134. - Specifies number of cells needed to encode an interrupt source.
  1135. - The value must be 2.
  1136. + description: Specifies number of cells needed to encode an interrupt
  1137. + source.
  1138. interrupt-controller: true
  1139. nvidia,invert-interrupt:
  1140. $ref: /schemas/types.yaml#/definitions/flag
  1141. - description: Inverts the PMU interrupt signal.
  1142. - The PMU is an external Power Management Unit, whose interrupt output
  1143. - signal is fed into the PMC. This signal is optionally inverted, and
  1144. - then fed into the ARM GIC. The PMC is not involved in the detection
  1145. - or handling of this interrupt signal, merely its inversion.
  1146. + description: Inverts the PMU interrupt signal. The PMU is an external Power
  1147. + Management Unit, whose interrupt output signal is fed into the PMC. This
  1148. + signal is optionally inverted, and then fed into the ARM GIC. The PMC is
  1149. + not involved in the detection or handling of this interrupt signal,
  1150. + merely its inversion.
  1151. nvidia,core-power-req-active-high:
  1152. $ref: /schemas/types.yaml#/definitions/flag
  1153. - description: Core power request active-high.
  1154. + description: core power request active-high
  1155. nvidia,sys-clock-req-active-high:
  1156. $ref: /schemas/types.yaml#/definitions/flag
  1157. - description: System clock request active-high.
  1158. + description: system clock request active-high
  1159. nvidia,combined-power-req:
  1160. $ref: /schemas/types.yaml#/definitions/flag
  1161. - description: combined power request for CPU and Core.
  1162. + description: combined power request for CPU and core
  1163. nvidia,cpu-pwr-good-en:
  1164. $ref: /schemas/types.yaml#/definitions/flag
  1165. - description:
  1166. - CPU power good signal from external PMIC to PMC is enabled.
  1167. + description: CPU power good signal from external PMIC to PMC is enabled
  1168. nvidia,suspend-mode:
  1169. $ref: /schemas/types.yaml#/definitions/uint32
  1170. - enum: [0, 1, 2]
  1171. - description:
  1172. - The suspend mode that the platform should use.
  1173. - Mode 0 is for LP0, CPU + Core voltage off and DRAM in self-refresh
  1174. - Mode 1 is for LP1, CPU voltage off and DRAM in self-refresh
  1175. - Mode 2 is for LP2, CPU voltage off
  1176. + description: the suspend mode that the platform should use
  1177. + oneOf:
  1178. + - description: LP0, CPU + Core voltage off and DRAM in self-refresh
  1179. + const: 0
  1180. + - description: LP1, CPU voltage off and DRAM in self-refresh
  1181. + const: 1
  1182. + - description: LP2, CPU voltage off
  1183. + const: 2
  1184. nvidia,cpu-pwr-good-time:
  1185. $ref: /schemas/types.yaml#/definitions/uint32
  1186. - description: CPU power good time in uSec.
  1187. + description: CPU power good time in microseconds
  1188. nvidia,cpu-pwr-off-time:
  1189. $ref: /schemas/types.yaml#/definitions/uint32
  1190. - description: CPU power off time in uSec.
  1191. + description: CPU power off time in microseconds
  1192. nvidia,core-pwr-good-time:
  1193. $ref: /schemas/types.yaml#/definitions/uint32-array
  1194. - description:
  1195. - <Oscillator-stable-time Power-stable-time>
  1196. - Core power good time in uSec.
  1197. + description: core power good time in microseconds
  1198. + items:
  1199. + - description: oscillator stable time
  1200. + - description: power stable time
  1201. nvidia,core-pwr-off-time:
  1202. $ref: /schemas/types.yaml#/definitions/uint32
  1203. - description: Core power off time in uSec.
  1204. + description: core power off time in microseconds
  1205. nvidia,lp0-vec:
  1206. $ref: /schemas/types.yaml#/definitions/uint32-array
  1207. - description:
  1208. - <start length> Starting address and length of LP0 vector.
  1209. - The LP0 vector contains the warm boot code that is executed
  1210. - by AVP when resuming from the LP0 state.
  1211. - The AVP (Audio-Video Processor) is an ARM7 processor and
  1212. - always being the first boot processor when chip is power on
  1213. - or resume from deep sleep mode. When the system is resumed
  1214. - from the deep sleep mode, the warm boot code will restore
  1215. - some PLLs, clocks and then brings up CPU0 for resuming the
  1216. - system.
  1217. + description: |
  1218. + Starting address and length of LP0 vector. The LP0 vector contains the
  1219. + warm boot code that is executed by AVP when resuming from the LP0 state.
  1220. + The AVP (Audio-Video Processor) is an ARM7 processor and always being
  1221. + the first boot processor when chip is power on or resume from deep sleep
  1222. + mode. When the system is resumed from the deep sleep mode, the warm boot
  1223. + code will restore some PLLs, clocks and then brings up CPU0 for resuming
  1224. + the system.
  1225. + items:
  1226. + - description: starting address of LP0 vector
  1227. + - description: length of LP0 vector
  1228. core-supply:
  1229. - description:
  1230. - Phandle to voltage regulator connected to the SoC Core power rail.
  1231. + description: phandle to voltage regulator connected to the SoC core power
  1232. + rail
  1233. core-domain:
  1234. type: object
  1235. - description: |
  1236. - The vast majority of hardware blocks of Tegra SoC belong to a
  1237. - Core power domain, which has a dedicated voltage rail that powers
  1238. - the blocks.
  1239. -
  1240. + description: The vast majority of hardware blocks of Tegra SoC belong to a
  1241. + core power domain, which has a dedicated voltage rail that powers the
  1242. + blocks.
  1243. properties:
  1244. operating-points-v2:
  1245. - description:
  1246. - Should contain level, voltages and opp-supported-hw property.
  1247. - The supported-hw is a bitfield indicating SoC speedo or process
  1248. - ID mask.
  1249. + description: Should contain level, voltages and opp-supported-hw
  1250. + property. The supported-hw is a bitfield indicating SoC speedo or
  1251. + process ID mask.
  1252. "#power-domain-cells":
  1253. const: 0
  1254. @@ -152,37 +148,32 @@ properties:
  1255. i2c-thermtrip:
  1256. type: object
  1257. - description:
  1258. - On Tegra30, Tegra114 and Tegra124 if i2c-thermtrip subnode exists,
  1259. - hardware-triggered thermal reset will be enabled.
  1260. -
  1261. + description: On Tegra30, Tegra114 and Tegra124 if i2c-thermtrip subnode
  1262. + exists, hardware-triggered thermal reset will be enabled.
  1263. properties:
  1264. nvidia,i2c-controller-id:
  1265. $ref: /schemas/types.yaml#/definitions/uint32
  1266. - description:
  1267. - ID of I2C controller to send poweroff command to PMU.
  1268. - Valid values are described in section 9.2.148
  1269. - "APBDEV_PMC_SCRATCH53_0" of the Tegra K1 Technical Reference
  1270. - Manual.
  1271. + description: ID of I2C controller to send poweroff command to PMU.
  1272. + Valid values are described in section 9.2.148 "APBDEV_PMC_SCRATCH53_0"
  1273. + of the Tegra K1 Technical Reference Manual.
  1274. nvidia,bus-addr:
  1275. $ref: /schemas/types.yaml#/definitions/uint32
  1276. - description: Bus address of the PMU on the I2C bus.
  1277. + description: bus address of the PMU on the I2C bus
  1278. nvidia,reg-addr:
  1279. $ref: /schemas/types.yaml#/definitions/uint32
  1280. - description: PMU I2C register address to issue poweroff command.
  1281. + description: PMU I2C register address to issue poweroff command
  1282. nvidia,reg-data:
  1283. $ref: /schemas/types.yaml#/definitions/uint32
  1284. - description: Poweroff command to write to PMU.
  1285. + description: power-off command to write to PMU
  1286. nvidia,pinmux-id:
  1287. $ref: /schemas/types.yaml#/definitions/uint32
  1288. - description:
  1289. - Pinmux used by the hardware when issuing Poweroff command.
  1290. - Defaults to 0. Valid values are described in section 12.5.2
  1291. - "Pinmux Support" of the Tegra4 Technical Reference Manual.
  1292. + description: Pinmux used by the hardware when issuing power-off command.
  1293. + Defaults to 0. Valid values are described in section 12.5.2 "Pinmux
  1294. + Support" of the Tegra4 Technical Reference Manual.
  1295. required:
  1296. - nvidia,i2c-controller-id
  1297. @@ -195,41 +186,44 @@ properties:
  1298. powergates:
  1299. type: object
  1300. description: |
  1301. - This node contains a hierarchy of power domain nodes, which should
  1302. - match the powergates on the Tegra SoC. Each powergate node
  1303. - represents a power-domain on the Tegra SoC that can be power-gated
  1304. - by the Tegra PMC.
  1305. - Hardware blocks belonging to a power domain should contain
  1306. - "power-domains" property that is a phandle pointing to corresponding
  1307. - powergate node.
  1308. - The name of the powergate node should be one of the below. Note that
  1309. - not every powergate is applicable to all Tegra devices and the following
  1310. - list shows which powergates are applicable to which devices.
  1311. - Please refer to Tegra TRM for mode details on the powergate nodes to
  1312. - use for each power-gate block inside Tegra.
  1313. - Name Description Devices Applicable
  1314. - 3d 3D Graphics Tegra20/114/124/210
  1315. - 3d0 3D Graphics 0 Tegra30
  1316. - 3d1 3D Graphics 1 Tegra30
  1317. - aud Audio Tegra210
  1318. - dfd Debug Tegra210
  1319. - dis Display A Tegra114/124/210
  1320. - disb Display B Tegra114/124/210
  1321. - heg 2D Graphics Tegra30/114/124/210
  1322. - iram Internal RAM Tegra124/210
  1323. - mpe MPEG Encode All
  1324. - nvdec NVIDIA Video Decode Engine Tegra210
  1325. - nvjpg NVIDIA JPEG Engine Tegra210
  1326. - pcie PCIE Tegra20/30/124/210
  1327. - sata SATA Tegra30/124/210
  1328. - sor Display interfaces Tegra124/210
  1329. - ve2 Video Encode Engine 2 Tegra210
  1330. - venc Video Encode Engine All
  1331. - vdec Video Decode Engine Tegra20/30/114/124
  1332. - vic Video Imaging Compositor Tegra124/210
  1333. - xusba USB Partition A Tegra114/124/210
  1334. - xusbb USB Partition B Tegra114/124/210
  1335. - xusbc USB Partition C Tegra114/124/210
  1336. + This node contains a hierarchy of power domain nodes, which should match
  1337. + the powergates on the Tegra SoC. Each powergate node represents a power-
  1338. + domain on the Tegra SoC that can be power-gated by the Tegra PMC.
  1339. +
  1340. + Hardware blocks belonging to a power domain should contain "power-domains"
  1341. + property that is a phandle pointing to corresponding powergate node.
  1342. +
  1343. + The name of the powergate node should be one of the below. Note that not
  1344. + every powergate is applicable to all Tegra devices and the following list
  1345. + shows which powergates are applicable to which devices.
  1346. +
  1347. + Please refer to Tegra TRM for mode details on the powergate nodes to use
  1348. + for each power-gate block inside Tegra.
  1349. +
  1350. + Name Description Devices Applicable
  1351. + --------------------------------------------------------------
  1352. + 3d 3D Graphics Tegra20/114/124/210
  1353. + 3d0 3D Graphics 0 Tegra30
  1354. + 3d1 3D Graphics 1 Tegra30
  1355. + aud Audio Tegra210
  1356. + dfd Debug Tegra210
  1357. + dis Display A Tegra114/124/210
  1358. + disb Display B Tegra114/124/210
  1359. + heg 2D Graphics Tegra30/114/124/210
  1360. + iram Internal RAM Tegra124/210
  1361. + mpe MPEG Encode All
  1362. + nvdec NVIDIA Video Decode Engine Tegra210
  1363. + nvjpg NVIDIA JPEG Engine Tegra210
  1364. + pcie PCIE Tegra20/30/124/210
  1365. + sata SATA Tegra30/124/210
  1366. + sor Display interfaces Tegra124/210
  1367. + ve2 Video Encode Engine 2 Tegra210
  1368. + venc Video Encode Engine All
  1369. + vdec Video Decode Engine Tegra20/30/114/124
  1370. + vic Video Imaging Compositor Tegra124/210
  1371. + xusba USB Partition A Tegra114/124/210
  1372. + xusbb USB Partition B Tegra114/124/210
  1373. + xusbc USB Partition C Tegra114/124/210
  1374. patternProperties:
  1375. "^[a-z0-9]+$":
  1376. --
  1377. 2.44.0
  1378. From 97b2d1274a657915726c3a579781769aebfac0fe Mon Sep 17 00:00:00 2001
  1379. From: Thierry Reding <[email protected]>
  1380. Date: Wed, 26 Jul 2023 18:27:39 +0200
  1381. Subject: [PATCH] dt-bindings: arm: tegra: pmc: Remove useless boilerplate
  1382. descriptions
  1383. The descriptions for the clocks and resets properties are no longer
  1384. useful in the context of json-schema, so drop them.
  1385. Reviewed-by: Rob Herring <[email protected]>
  1386. Signed-off-by: Thierry Reding <[email protected]>
  1387. ---
  1388. .../bindings/arm/tegra/nvidia,tegra20-pmc.yaml | 13 -------------
  1389. 1 file changed, 13 deletions(-)
  1390. diff --git a/Documentation/devicetree/bindings/arm/tegra/nvidia,tegra20-pmc.yaml b/Documentation/devicetree/bindings/arm/tegra/nvidia,tegra20-pmc.yaml
  1391. index 38fe66142547..0ac258bc7be0 100644
  1392. --- a/Documentation/devicetree/bindings/arm/tegra/nvidia,tegra20-pmc.yaml
  1393. +++ b/Documentation/devicetree/bindings/arm/tegra/nvidia,tegra20-pmc.yaml
  1394. @@ -21,8 +21,6 @@ properties:
  1395. reg:
  1396. maxItems: 1
  1397. - description:
  1398. - Offset and length of the register set for the device.
  1399. clock-names:
  1400. items:
  1401. @@ -33,9 +31,6 @@ properties:
  1402. clocks:
  1403. maxItems: 2
  1404. - description:
  1405. - Must contain an entry for each entry in clock-names.
  1406. - See ../clocks/clocks-bindings.txt for details.
  1407. '#clock-cells':
  1408. const: 1
  1409. @@ -234,18 +229,10 @@ properties:
  1410. clocks:
  1411. minItems: 1
  1412. maxItems: 8
  1413. - description:
  1414. - Must contain an entry for each clock required by the PMC
  1415. - for controlling a power-gate.
  1416. - See ../clocks/clock-bindings.txt document for more details.
  1417. resets:
  1418. minItems: 1
  1419. maxItems: 8
  1420. - description:
  1421. - Must contain an entry for each reset required by the PMC
  1422. - for controlling a power-gate.
  1423. - See ../reset/reset.txt for more details.
  1424. power-domains:
  1425. maxItems: 1
  1426. --
  1427. 2.44.0
  1428. From 834f699bde1c647a300da5271f7b5f791f91830e Mon Sep 17 00:00:00 2001
  1429. From: Thierry Reding <[email protected]>
  1430. Date: Wed, 26 Jul 2023 18:27:40 +0200
  1431. Subject: [PATCH] dt-bindings: arm: tegra: pmc: Move additionalProperties
  1432. For indented subschemas it can be difficult to understand which block an
  1433. additionalProperties property belongs to. Moving it closer to the
  1434. beginning of a block is a good way to clarify this.
  1435. Reviewed-by: Rob Herring <[email protected]>
  1436. Signed-off-by: Thierry Reding <[email protected]>
  1437. ---
  1438. .../bindings/arm/tegra/nvidia,tegra20-pmc.yaml | 10 +++-------
  1439. 1 file changed, 3 insertions(+), 7 deletions(-)
  1440. diff --git a/Documentation/devicetree/bindings/arm/tegra/nvidia,tegra20-pmc.yaml b/Documentation/devicetree/bindings/arm/tegra/nvidia,tegra20-pmc.yaml
  1441. index 0ac258bc7be0..d6f2c5862841 100644
  1442. --- a/Documentation/devicetree/bindings/arm/tegra/nvidia,tegra20-pmc.yaml
  1443. +++ b/Documentation/devicetree/bindings/arm/tegra/nvidia,tegra20-pmc.yaml
  1444. @@ -126,6 +126,7 @@ properties:
  1445. description: The vast majority of hardware blocks of Tegra SoC belong to a
  1446. core power domain, which has a dedicated voltage rail that powers the
  1447. blocks.
  1448. + additionalProperties: false
  1449. properties:
  1450. operating-points-v2:
  1451. description: Should contain level, voltages and opp-supported-hw
  1452. @@ -139,12 +140,11 @@ properties:
  1453. - operating-points-v2
  1454. - "#power-domain-cells"
  1455. - additionalProperties: false
  1456. -
  1457. i2c-thermtrip:
  1458. type: object
  1459. description: On Tegra30, Tegra114 and Tegra124 if i2c-thermtrip subnode
  1460. exists, hardware-triggered thermal reset will be enabled.
  1461. + additionalProperties: false
  1462. properties:
  1463. nvidia,i2c-controller-id:
  1464. $ref: /schemas/types.yaml#/definitions/uint32
  1465. @@ -176,10 +176,9 @@ properties:
  1466. - nvidia,reg-addr
  1467. - nvidia,reg-data
  1468. - additionalProperties: false
  1469. -
  1470. powergates:
  1471. type: object
  1472. + additionalProperties: false
  1473. description: |
  1474. This node contains a hierarchy of power domain nodes, which should match
  1475. the powergates on the Tegra SoC. Each powergate node represents a power-
  1476. @@ -224,7 +223,6 @@ properties:
  1477. "^[a-z0-9]+$":
  1478. type: object
  1479. additionalProperties: false
  1480. -
  1481. properties:
  1482. clocks:
  1483. minItems: 1
  1484. @@ -246,8 +244,6 @@ properties:
  1485. - resets
  1486. - '#power-domain-cells'
  1487. - additionalProperties: false
  1488. -
  1489. patternProperties:
  1490. "^[a-f0-9]+-[a-f0-9]+$":
  1491. type: object
  1492. --
  1493. 2.44.0
  1494. From 26b5a37071c58ee3407509bb5c314a6eb411b1f0 Mon Sep 17 00:00:00 2001
  1495. From: Thierry Reding <[email protected]>
  1496. Date: Wed, 26 Jul 2023 18:27:41 +0200
  1497. Subject: [PATCH] dt-bindings: arm: tegra: pmc: Increase maximum number of
  1498. clocks per powergate
  1499. Some powergate definitions need more than 8 clocks, so bump the number
  1500. up to 10, which is the current maximum in any known device tree file.
  1501. Acked-by: Rob Herring <[email protected]>
  1502. Signed-off-by: Thierry Reding <[email protected]>
  1503. ---
  1504. .../devicetree/bindings/arm/tegra/nvidia,tegra20-pmc.yaml | 2 +-
  1505. 1 file changed, 1 insertion(+), 1 deletion(-)
  1506. diff --git a/Documentation/devicetree/bindings/arm/tegra/nvidia,tegra20-pmc.yaml b/Documentation/devicetree/bindings/arm/tegra/nvidia,tegra20-pmc.yaml
  1507. index d6f2c5862841..a336a75d8b82 100644
  1508. --- a/Documentation/devicetree/bindings/arm/tegra/nvidia,tegra20-pmc.yaml
  1509. +++ b/Documentation/devicetree/bindings/arm/tegra/nvidia,tegra20-pmc.yaml
  1510. @@ -226,7 +226,7 @@ properties:
  1511. properties:
  1512. clocks:
  1513. minItems: 1
  1514. - maxItems: 8
  1515. + maxItems: 10
  1516. resets:
  1517. minItems: 1
  1518. --
  1519. 2.44.0
  1520. From 4cf88bea8e6712b62479720c695dab39735a5560 Mon Sep 17 00:00:00 2001
  1521. From: Thierry Reding <[email protected]>
  1522. Date: Wed, 26 Jul 2023 18:27:42 +0200
  1523. Subject: [PATCH] dt-bindings: arm: tegra: pmc: Restructure pad configuration
  1524. node schema
  1525. The pad configuration node schema in its current form can accidentally
  1526. match other properties as well. Restructure the schema to better match
  1527. how the device trees are using these.
  1528. Reviewed-by: Rob Herring <[email protected]>
  1529. Signed-off-by: Thierry Reding <[email protected]>
  1530. ---
  1531. .../arm/tegra/nvidia,tegra20-pmc.yaml | 171 +++++++++++-------
  1532. 1 file changed, 109 insertions(+), 62 deletions(-)
  1533. diff --git a/Documentation/devicetree/bindings/arm/tegra/nvidia,tegra20-pmc.yaml b/Documentation/devicetree/bindings/arm/tegra/nvidia,tegra20-pmc.yaml
  1534. index a336a75d8b82..de1b23167658 100644
  1535. --- a/Documentation/devicetree/bindings/arm/tegra/nvidia,tegra20-pmc.yaml
  1536. +++ b/Documentation/devicetree/bindings/arm/tegra/nvidia,tegra20-pmc.yaml
  1537. @@ -244,69 +244,76 @@ properties:
  1538. - resets
  1539. - '#power-domain-cells'
  1540. -patternProperties:
  1541. - "^[a-f0-9]+-[a-f0-9]+$":
  1542. + pinmux:
  1543. type: object
  1544. - description:
  1545. - This is a Pad configuration node. On Tegra SOCs a pad is a set of
  1546. - pins which are configured as a group. The pin grouping is a fixed
  1547. - attribute of the hardware. The PMC can be used to set pad power state
  1548. - and signaling voltage. A pad can be either in active or power down mode.
  1549. - The support for power state and signaling voltage configuration varies
  1550. - depending on the pad in question. 3.3V and 1.8V signaling voltages
  1551. - are supported on pins where software controllable signaling voltage
  1552. - switching is available.
  1553. -
  1554. - The pad configuration state nodes are placed under the pmc node and they
  1555. - are referred to by the pinctrl client properties. For more information
  1556. - see Documentation/devicetree/bindings/pinctrl/pinctrl-bindings.txt.
  1557. - The pad name should be used as the value of the pins property in pin
  1558. - configuration nodes.
  1559. -
  1560. - The following pads are present on Tegra124 and Tegra132
  1561. - audio, bb, cam, comp, csia, csb, cse, dsi, dsib, dsic, dsid, hdmi, hsic,
  1562. - hv, lvds, mipi-bias, nand, pex-bias, pex-clk1, pex-clk2, pex-cntrl,
  1563. - sdmmc1, sdmmc3, sdmmc4, sys_ddc, uart, usb0, usb1, usb2, usb_bias.
  1564. -
  1565. - The following pads are present on Tegra210
  1566. - audio, audio-hv, cam, csia, csib, csic, csid, csie, csif, dbg,
  1567. - debug-nonao, dmic, dp, dsi, dsib, dsic, dsid, emmc, emmc2, gpio, hdmi,
  1568. - hsic, lvds, mipi-bias, pex-bias, pex-clk1, pex-clk2, pex-cntrl, sdmmc1,
  1569. - sdmmc3, spi, spi-hv, uart, usb0, usb1, usb2, usb3, usb-bias.
  1570. -
  1571. - properties:
  1572. - pins:
  1573. - $ref: /schemas/types.yaml#/definitions/string
  1574. - description: Must contain name of the pad(s) to be configured.
  1575. -
  1576. - low-power-enable:
  1577. - $ref: /schemas/types.yaml#/definitions/flag
  1578. - description: Configure the pad into power down mode.
  1579. -
  1580. - low-power-disable:
  1581. - $ref: /schemas/types.yaml#/definitions/flag
  1582. - description: Configure the pad into active mode.
  1583. -
  1584. - power-source:
  1585. - $ref: /schemas/types.yaml#/definitions/uint32
  1586. - description:
  1587. - Must contain either TEGRA_IO_PAD_VOLTAGE_1V8 or
  1588. - TEGRA_IO_PAD_VOLTAGE_3V3 to select between signaling voltages.
  1589. - The values are defined in
  1590. - include/dt-bindings/pinctrl/pinctrl-tegra-io-pad.h.
  1591. - Power state can be configured on all Tegra124 and Tegra132
  1592. - pads. None of the Tegra124 or Tegra132 pads support signaling
  1593. - voltage switching.
  1594. - All of the listed Tegra210 pads except pex-cntrl support power
  1595. - state configuration. Signaling voltage switching is supported
  1596. - on below Tegra210 pads.
  1597. - audio, audio-hv, cam, dbg, dmic, gpio, pex-cntrl, sdmmc1,
  1598. - sdmmc3, spi, spi-hv, and uart.
  1599. -
  1600. - required:
  1601. - - pins
  1602. -
  1603. - additionalProperties: false
  1604. + additionalProperties:
  1605. + type: object
  1606. + description: |
  1607. + This is a pad configuration node. On Tegra SoCs a pad is a set of pins
  1608. + which are configured as a group. The pin grouping is a fixed attribute
  1609. + of the hardware. The PMC can be used to set pad power state and
  1610. + signaling voltage. A pad can be either in active or power down mode.
  1611. + The support for power state and signaling voltage configuration varies
  1612. + depending on the pad in question. 3.3V and 1.8V signaling voltages are
  1613. + supported on pins where software controllable signaling voltage
  1614. + switching is available.
  1615. +
  1616. + The pad configuration state nodes are placed under the pmc node and
  1617. + they are referred to by the pinctrl client properties. For more
  1618. + information see:
  1619. +
  1620. + Documentation/devicetree/bindings/pinctrl/pinctrl-bindings.txt
  1621. +
  1622. + The pad name should be used as the value of the pins property in pin
  1623. + configuration nodes.
  1624. +
  1625. + The following pads are present on Tegra124 and Tegra132:
  1626. +
  1627. + audio, bb, cam, comp, csia, csb, cse, dsi, dsib, dsic, dsid, hdmi,
  1628. + hsic, hv, lvds, mipi-bias, nand, pex-bias, pex-clk1, pex-clk2,
  1629. + pex-cntrl, sdmmc1, sdmmc3, sdmmc4, sys_ddc, uart, usb0, usb1, usb2,
  1630. + usb_bias
  1631. +
  1632. + The following pads are present on Tegra210:
  1633. +
  1634. + audio, audio-hv, cam, csia, csib, csic, csid, csie, csif, dbg,
  1635. + debug-nonao, dmic, dp, dsi, dsib, dsic, dsid, emmc, emmc2, gpio,
  1636. + hdmi, hsic, lvds, mipi-bias, pex-bias, pex-clk1, pex-clk2, pex-cntrl,
  1637. + sdmmc1, sdmmc3, spi, spi-hv, uart, usb0, usb1, usb2, usb3, usb-bias
  1638. + additionalProperties: false
  1639. + properties:
  1640. + pins:
  1641. + $ref: /schemas/types.yaml#/definitions/string-array
  1642. + description: Must contain name of the pad(s) to be configured.
  1643. +
  1644. + low-power-enable:
  1645. + $ref: /schemas/types.yaml#/definitions/flag
  1646. + description: Configure the pad into power down mode.
  1647. +
  1648. + low-power-disable:
  1649. + $ref: /schemas/types.yaml#/definitions/flag
  1650. + description: Configure the pad into active mode.
  1651. +
  1652. + power-source:
  1653. + $ref: /schemas/types.yaml#/definitions/uint32
  1654. + description: |
  1655. + Must contain either TEGRA_IO_PAD_VOLTAGE_1V8 or
  1656. + TEGRA_IO_PAD_VOLTAGE_3V3 to select between signaling voltages. The
  1657. + values are defined in:
  1658. +
  1659. + include/dt-bindings/pinctrl/pinctrl-tegra-io-pad.h
  1660. +
  1661. + Power state can be configured on all Tegra124 and Tegra132 pads.
  1662. + None of the Tegra124 or Tegra132 pads support signaling voltage
  1663. + switching. All of the listed Tegra210 pads except pex-cntrl support
  1664. + power state configuration. Signaling voltage switching is supported
  1665. + on the following Tegra210 pads:
  1666. +
  1667. + audio, audio-hv, cam, dbg, dmic, gpio, pex-cntrl, sdmmc1, sdmmc3,
  1668. + spi, spi-hv, uart
  1669. +
  1670. + required:
  1671. + - pins
  1672. required:
  1673. - compatible
  1674. @@ -315,6 +322,46 @@ required:
  1675. - clocks
  1676. - '#clock-cells'
  1677. +allOf:
  1678. + - if:
  1679. + properties:
  1680. + compatible:
  1681. + contains:
  1682. + const: nvidia,tegra124-pmc
  1683. + then:
  1684. + properties:
  1685. + pinmux:
  1686. + additionalProperties:
  1687. + type: object
  1688. + properties:
  1689. + pins:
  1690. + items:
  1691. + enum: [ audio, bb, cam, comp, csia, csb, cse, dsi, dsib,
  1692. + dsic, dsid, hdmi, hsic, hv, lvds, mipi-bias, nand,
  1693. + pex-bias, pex-clk1, pex-clk2, pex-cntrl, sdmmc1,
  1694. + sdmmc3, sdmmc4, sys_ddc, uart, usb0, usb1, usb2,
  1695. + usb_bias ]
  1696. +
  1697. + - if:
  1698. + properties:
  1699. + compatible:
  1700. + contains:
  1701. + const: nvidia,tegra210-pmc
  1702. + then:
  1703. + properties:
  1704. + pinmux:
  1705. + additionalProperties:
  1706. + type: object
  1707. + properties:
  1708. + pins:
  1709. + items:
  1710. + enum: [ audio, audio-hv, cam, csia, csib, csic, csid, csie,
  1711. + csif, dbg, debug-nonao, dmic, dp, dsi, dsib, dsic,
  1712. + dsid, emmc, emmc2, gpio, hdmi, hsic, lvds, mipi-bias,
  1713. + pex-bias, pex-clk1, pex-clk2, pex-cntrl, sdmmc1,
  1714. + sdmmc3, spi, spi-hv, uart, usb0, usb1, usb2, usb3,
  1715. + usb-bias ]
  1716. +
  1717. additionalProperties: false
  1718. dependencies:
  1719. --
  1720. 2.44.0
  1721. From fb41b6eaf418755926840a60d17a1947f08f8b19 Mon Sep 17 00:00:00 2001
  1722. From: Thierry Reding <[email protected]>
  1723. Date: Wed, 26 Jul 2023 18:27:43 +0200
  1724. Subject: [PATCH] dt-bindings: arm: tegra: pmc: Reformat example
  1725. Reformat the example using 4 spaces for indentation.
  1726. Acked-by: Rob Herring <[email protected]>
  1727. Signed-off-by: Thierry Reding <[email protected]>
  1728. ---
  1729. .../arm/tegra/nvidia,tegra20-pmc.yaml | 77 +++++++++----------
  1730. 1 file changed, 38 insertions(+), 39 deletions(-)
  1731. diff --git a/Documentation/devicetree/bindings/arm/tegra/nvidia,tegra20-pmc.yaml b/Documentation/devicetree/bindings/arm/tegra/nvidia,tegra20-pmc.yaml
  1732. index de1b23167658..a54b562e2a1c 100644
  1733. --- a/Documentation/devicetree/bindings/arm/tegra/nvidia,tegra20-pmc.yaml
  1734. +++ b/Documentation/devicetree/bindings/arm/tegra/nvidia,tegra20-pmc.yaml
  1735. @@ -371,47 +371,46 @@ dependencies:
  1736. examples:
  1737. - |
  1738. -
  1739. #include <dt-bindings/clock/tegra210-car.h>
  1740. #include <dt-bindings/pinctrl/pinctrl-tegra-io-pad.h>
  1741. #include <dt-bindings/soc/tegra-pmc.h>
  1742. - tegra_pmc: pmc@7000e400 {
  1743. - compatible = "nvidia,tegra210-pmc";
  1744. - reg = <0x7000e400 0x400>;
  1745. - core-supply = <&regulator>;
  1746. - clocks = <&tegra_car TEGRA210_CLK_PCLK>, <&clk32k_in>;
  1747. - clock-names = "pclk", "clk32k_in";
  1748. - #clock-cells = <1>;
  1749. -
  1750. - nvidia,invert-interrupt;
  1751. - nvidia,suspend-mode = <0>;
  1752. - nvidia,cpu-pwr-good-time = <0>;
  1753. - nvidia,cpu-pwr-off-time = <0>;
  1754. - nvidia,core-pwr-good-time = <4587 3876>;
  1755. - nvidia,core-pwr-off-time = <39065>;
  1756. - nvidia,core-power-req-active-high;
  1757. - nvidia,sys-clock-req-active-high;
  1758. -
  1759. - pd_core: core-domain {
  1760. - operating-points-v2 = <&core_opp_table>;
  1761. - #power-domain-cells = <0>;
  1762. - };
  1763. -
  1764. - powergates {
  1765. - pd_audio: aud {
  1766. - clocks = <&tegra_car TEGRA210_CLK_APE>,
  1767. - <&tegra_car TEGRA210_CLK_APB2APE>;
  1768. - resets = <&tegra_car 198>;
  1769. - power-domains = <&pd_core>;
  1770. - #power-domain-cells = <0>;
  1771. - };
  1772. -
  1773. - pd_xusbss: xusba {
  1774. - clocks = <&tegra_car TEGRA210_CLK_XUSB_SS>;
  1775. - resets = <&tegra_car TEGRA210_CLK_XUSB_SS>;
  1776. - power-domains = <&pd_core>;
  1777. - #power-domain-cells = <0>;
  1778. - };
  1779. - };
  1780. + pmc@7000e400 {
  1781. + compatible = "nvidia,tegra210-pmc";
  1782. + reg = <0x7000e400 0x400>;
  1783. + core-supply = <&regulator>;
  1784. + clocks = <&tegra_car TEGRA210_CLK_PCLK>, <&clk32k_in>;
  1785. + clock-names = "pclk", "clk32k_in";
  1786. + #clock-cells = <1>;
  1787. +
  1788. + nvidia,invert-interrupt;
  1789. + nvidia,suspend-mode = <0>;
  1790. + nvidia,cpu-pwr-good-time = <0>;
  1791. + nvidia,cpu-pwr-off-time = <0>;
  1792. + nvidia,core-pwr-good-time = <4587 3876>;
  1793. + nvidia,core-pwr-off-time = <39065>;
  1794. + nvidia,core-power-req-active-high;
  1795. + nvidia,sys-clock-req-active-high;
  1796. +
  1797. + pd_core: core-domain {
  1798. + operating-points-v2 = <&core_opp_table>;
  1799. + #power-domain-cells = <0>;
  1800. + };
  1801. +
  1802. + powergates {
  1803. + pd_audio: aud {
  1804. + clocks = <&tegra_car TEGRA210_CLK_APE>,
  1805. + <&tegra_car TEGRA210_CLK_APB2APE>;
  1806. + resets = <&tegra_car 198>;
  1807. + power-domains = <&pd_core>;
  1808. + #power-domain-cells = <0>;
  1809. + };
  1810. +
  1811. + pd_xusbss: xusba {
  1812. + clocks = <&tegra_car TEGRA210_CLK_XUSB_SS>;
  1813. + resets = <&tegra_car TEGRA210_CLK_XUSB_SS>;
  1814. + power-domains = <&pd_core>;
  1815. + #power-domain-cells = <0>;
  1816. + };
  1817. + };
  1818. };
  1819. --
  1820. 2.44.0
  1821. From 3935ccef7c301603373cf87a19d68e606b8e34ec Mon Sep 17 00:00:00 2001
  1822. From: Thierry Reding <[email protected]>
  1823. Date: Wed, 26 Jul 2023 18:27:44 +0200
  1824. Subject: [PATCH] dt-bindings: arm: tegra: pmc: Relicense and move into
  1825. soc/tegra directory
  1826. Dual-license this binding for consistency with other Tegra bindings and
  1827. move it into the soc/tegra directory.
  1828. Reviewed-by: Rob Herring <[email protected]>
  1829. Signed-off-by: Thierry Reding <[email protected]>
  1830. ---
  1831. .../bindings/{arm => soc}/tegra/nvidia,tegra20-pmc.yaml | 4 ++--
  1832. 1 file changed, 2 insertions(+), 2 deletions(-)
  1833. rename Documentation/devicetree/bindings/{arm => soc}/tegra/nvidia,tegra20-pmc.yaml (99%)
  1834. diff --git a/Documentation/devicetree/bindings/arm/tegra/nvidia,tegra20-pmc.yaml b/Documentation/devicetree/bindings/soc/tegra/nvidia,tegra20-pmc.yaml
  1835. similarity index 99%
  1836. rename from Documentation/devicetree/bindings/arm/tegra/nvidia,tegra20-pmc.yaml
  1837. rename to Documentation/devicetree/bindings/soc/tegra/nvidia,tegra20-pmc.yaml
  1838. index a54b562e2a1c..b86f6f53ca95 100644
  1839. --- a/Documentation/devicetree/bindings/arm/tegra/nvidia,tegra20-pmc.yaml
  1840. +++ b/Documentation/devicetree/bindings/soc/tegra/nvidia,tegra20-pmc.yaml
  1841. @@ -1,7 +1,7 @@
  1842. -# SPDX-License-Identifier: GPL-2.0
  1843. +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
  1844. %YAML 1.2
  1845. ---
  1846. -$id: http://devicetree.org/schemas/arm/tegra/nvidia,tegra20-pmc.yaml#
  1847. +$id: http://devicetree.org/schemas/soc/tegra/nvidia,tegra20-pmc.yaml#
  1848. $schema: http://devicetree.org/meta-schemas/core.yaml#
  1849. title: Tegra Power Management Controller (PMC)
  1850. --
  1851. 2.44.0
  1852. From dd7e1d02ac6e219c99752588166011889a8702d9 Mon Sep 17 00:00:00 2001
  1853. From: =?UTF-8?q?Uwe=20Kleine-K=C3=B6nig?= <[email protected]>
  1854. Date: Mon, 25 Sep 2023 11:55:23 +0200
  1855. Subject: [PATCH] soc/tegra: cbb: tegra194-cbb: Convert to platform remove
  1856. callback returning void
  1857. MIME-Version: 1.0
  1858. Content-Type: text/plain; charset=UTF-8
  1859. Content-Transfer-Encoding: 8bit
  1860. The .remove() callback for a platform driver returns an int which makes
  1861. many driver authors wrongly assume it's possible to do error handling by
  1862. returning an error code. However the value returned is ignored (apart
  1863. from emitting a warning) and this typically results in resource leaks.
  1864. To improve here there is a quest to make the remove callback return
  1865. void. In the first step of this quest all drivers are converted to
  1866. .remove_new() which already returns void. Eventually after all drivers
  1867. are converted, .remove_new() will be renamed to .remove().
  1868. Trivially convert this driver from always returning zero in the remove
  1869. callback to the void returning variant.
  1870. Signed-off-by: Uwe Kleine-König <[email protected]>
  1871. Signed-off-by: Thierry Reding <[email protected]>
  1872. ---
  1873. drivers/soc/tegra/cbb/tegra194-cbb.c | 6 ++----
  1874. 1 file changed, 2 insertions(+), 4 deletions(-)
  1875. diff --git a/drivers/soc/tegra/cbb/tegra194-cbb.c b/drivers/soc/tegra/cbb/tegra194-cbb.c
  1876. index cf6886f362d3..9cbc562ae7d3 100644
  1877. --- a/drivers/soc/tegra/cbb/tegra194-cbb.c
  1878. +++ b/drivers/soc/tegra/cbb/tegra194-cbb.c
  1879. @@ -2293,7 +2293,7 @@ static int tegra194_cbb_probe(struct platform_device *pdev)
  1880. return tegra_cbb_register(&cbb->base);
  1881. }
  1882. -static int tegra194_cbb_remove(struct platform_device *pdev)
  1883. +static void tegra194_cbb_remove(struct platform_device *pdev)
  1884. {
  1885. struct tegra194_cbb *cbb = platform_get_drvdata(pdev);
  1886. struct tegra_cbb *noc, *tmp;
  1887. @@ -2311,8 +2311,6 @@ static int tegra194_cbb_remove(struct platform_device *pdev)
  1888. }
  1889. spin_unlock_irqrestore(&cbb_lock, flags);
  1890. -
  1891. - return 0;
  1892. }
  1893. static int __maybe_unused tegra194_cbb_resume_noirq(struct device *dev)
  1894. @@ -2332,7 +2330,7 @@ static const struct dev_pm_ops tegra194_cbb_pm = {
  1895. static struct platform_driver tegra194_cbb_driver = {
  1896. .probe = tegra194_cbb_probe,
  1897. - .remove = tegra194_cbb_remove,
  1898. + .remove_new = tegra194_cbb_remove,
  1899. .driver = {
  1900. .name = "tegra194-cbb",
  1901. .of_match_table = of_match_ptr(tegra194_cbb_match),
  1902. --
  1903. 2.44.0
  1904. From 448b1e383a575f0d1f946c462b4d1f89814473e3 Mon Sep 17 00:00:00 2001
  1905. From: Ulf Hansson <[email protected]>
  1906. Date: Thu, 12 Oct 2023 17:35:36 +0200
  1907. Subject: [PATCH] soc/tegra: pmc: Drop the ->opp_to_performance_state()
  1908. callback
  1909. Since commit 7c41cdcd3bbe ("OPP: Simplify the over-designed pstate <->
  1910. level dance"), there is no longer any need for genpd providers to assign
  1911. the ->opp_to_performance_state(), hence let's drop it.
  1912. Cc: Thierry Reding <[email protected]>
  1913. Cc: Jonathan Hunter <[email protected]>
  1914. Cc: [email protected]
  1915. Signed-off-by: Ulf Hansson <[email protected]>
  1916. Signed-off-by: Thierry Reding <[email protected]>
  1917. ---
  1918. drivers/soc/tegra/pmc.c | 8 --------
  1919. 1 file changed, 8 deletions(-)
  1920. diff --git a/drivers/soc/tegra/pmc.c b/drivers/soc/tegra/pmc.c
  1921. index 162f52456f65..f432aa022ace 100644
  1922. --- a/drivers/soc/tegra/pmc.c
  1923. +++ b/drivers/soc/tegra/pmc.c
  1924. @@ -1393,13 +1393,6 @@ tegra_pmc_core_pd_set_performance_state(struct generic_pm_domain *genpd,
  1925. return 0;
  1926. }
  1927. -static unsigned int
  1928. -tegra_pmc_core_pd_opp_to_performance_state(struct generic_pm_domain *genpd,
  1929. - struct dev_pm_opp *opp)
  1930. -{
  1931. - return dev_pm_opp_get_level(opp);
  1932. -}
  1933. -
  1934. static int tegra_pmc_core_pd_add(struct tegra_pmc *pmc, struct device_node *np)
  1935. {
  1936. struct generic_pm_domain *genpd;
  1937. @@ -1412,7 +1405,6 @@ static int tegra_pmc_core_pd_add(struct tegra_pmc *pmc, struct device_node *np)
  1938. genpd->name = "core";
  1939. genpd->set_performance_state = tegra_pmc_core_pd_set_performance_state;
  1940. - genpd->opp_to_performance_state = tegra_pmc_core_pd_opp_to_performance_state;
  1941. err = devm_pm_opp_set_regulators(pmc->dev, rname);
  1942. if (err)
  1943. --
  1944. 2.44.0
  1945. From e0bf68d764454da84578a5e2762f6787f600130e Mon Sep 17 00:00:00 2001
  1946. From: Deming Wang <[email protected]>
  1947. Date: Tue, 12 Sep 2023 08:10:30 -0400
  1948. Subject: [PATCH] firmware: tegra: Fix a typo
  1949. successfully, not 'succesfully'
  1950. Signed-off-by: Deming Wang <[email protected]>
  1951. Signed-off-by: Thierry Reding <[email protected]>
  1952. ---
  1953. include/soc/tegra/bpmp-abi.h | 2 +-
  1954. 1 file changed, 1 insertion(+), 1 deletion(-)
  1955. diff --git a/include/soc/tegra/bpmp-abi.h b/include/soc/tegra/bpmp-abi.h
  1956. index ecefcaec7e66..6b995a8f0f6d 100644
  1957. --- a/include/soc/tegra/bpmp-abi.h
  1958. +++ b/include/soc/tegra/bpmp-abi.h
  1959. @@ -1194,7 +1194,7 @@ struct cmd_clk_is_enabled_request {
  1960. */
  1961. struct cmd_clk_is_enabled_response {
  1962. /**
  1963. - * @brief The state of the clock that has been succesfully
  1964. + * @brief The state of the clock that has been successfully
  1965. * requested with CMD_CLK_ENABLE or CMD_CLK_DISABLE by the
  1966. * master invoking the command earlier.
  1967. *
  1968. --
  1969. 2.44.0
  1970. From 0ac4c434ad6f74ea958ab6b563f88daeac09e4f1 Mon Sep 17 00:00:00 2001
  1971. From: Diogo Ivo <[email protected]>
  1972. Date: Mon, 7 Aug 2023 14:33:03 +0100
  1973. Subject: [PATCH] arm64: tegra: Add DSI/CSI regulator on Smaug
  1974. Add the node for the DSI/CSI regulator in the Pixel C.
  1975. Signed-off-by: Diogo Ivo <[email protected]>
  1976. Signed-off-by: Thierry Reding <[email protected]>
  1977. ---
  1978. arch/arm64/boot/dts/nvidia/tegra210-smaug.dts | 8 ++++++++
  1979. 1 file changed, 8 insertions(+)
  1980. diff --git a/arch/arm64/boot/dts/nvidia/tegra210-smaug.dts b/arch/arm64/boot/dts/nvidia/tegra210-smaug.dts
  1981. index 53805555dd2d..9acf33aae902 100644
  1982. --- a/arch/arm64/boot/dts/nvidia/tegra210-smaug.dts
  1983. +++ b/arch/arm64/boot/dts/nvidia/tegra210-smaug.dts
  1984. @@ -1932,4 +1932,12 @@ usbc_vbus: regulator-usbc-vbus {
  1985. regulator-min-microvolt = <5000000>;
  1986. regulator-max-microvolt = <5000000>;
  1987. };
  1988. +
  1989. + vdd_dsi_csi: regulator-vdd-dsi-csi {
  1990. + compatible = "regulator-fixed";
  1991. + regulator-name = "AVDD_DSI_CSI_1V2";
  1992. + regulator-min-microvolt = <1200000>;
  1993. + regulator-max-microvolt = <1200000>;
  1994. + vin-supply = <&pp1200_avdd>;
  1995. + };
  1996. };
  1997. --
  1998. 2.44.0
  1999. From 1de69533ec2cf33083b3683b521c7ada265c78fd Mon Sep 17 00:00:00 2001
  2000. From: Diogo Ivo <[email protected]>
  2001. Date: Mon, 7 Aug 2023 14:33:04 +0100
  2002. Subject: [PATCH] arm64: tegra: Add backlight node on Smaug
  2003. The Google Pixel C has a TI LP8557 backlight controller, so add a
  2004. DT node for it.
  2005. Signed-off-by: Diogo Ivo <[email protected]>
  2006. Signed-off-by: Thierry Reding <[email protected]>
  2007. ---
  2008. arch/arm64/boot/dts/nvidia/tegra210-smaug.dts | 31 +++++++++++++++++++
  2009. 1 file changed, 31 insertions(+)
  2010. diff --git a/arch/arm64/boot/dts/nvidia/tegra210-smaug.dts b/arch/arm64/boot/dts/nvidia/tegra210-smaug.dts
  2011. index 9acf33aae902..9c8ffbf8ef65 100644
  2012. --- a/arch/arm64/boot/dts/nvidia/tegra210-smaug.dts
  2013. +++ b/arch/arm64/boot/dts/nvidia/tegra210-smaug.dts
  2014. @@ -1651,6 +1651,37 @@ nau8825@1a {
  2015. status = "okay";
  2016. };
  2017. + backlight: backlight@2c {
  2018. + compatible = "ti,lp8557";
  2019. + reg = <0x2c>;
  2020. + power-supply = <&pplcd_vdd>;
  2021. + enable-supply = <&pp1800_lcdio>;
  2022. + bl-name = "lp8557-backlight";
  2023. + dev-ctrl = /bits/ 8 <0x01>;
  2024. + init-brt = /bits/ 8 <0x80>;
  2025. +
  2026. + /* Full scale current, 20mA */
  2027. + rom-11h {
  2028. + rom-addr = /bits/ 8 <0x11>;
  2029. + rom-val = /bits/ 8 <0x05>;
  2030. + };
  2031. + /* Frequency = 4.9kHz, magic undocumented val */
  2032. + rom-12h {
  2033. + rom-addr = /bits/ 8 <0x12>;
  2034. + rom-val = /bits/ 8 <0x29>;
  2035. + };
  2036. + /* Boost freq = 1MHz, BComp option = 1 */
  2037. + rom-13h {
  2038. + rom-addr = /bits/ 8 <0x13>;
  2039. + rom-val = /bits/ 8 <0x03>;
  2040. + };
  2041. + /* 4V OV, 6 output LED string enabled */
  2042. + rom-14h {
  2043. + rom-addr = /bits/ 8 <0x14>;
  2044. + rom-val = /bits/ 8 <0xbf>;
  2045. + };
  2046. + };
  2047. +
  2048. audio-codec@2d {
  2049. compatible = "realtek,rt5677";
  2050. reg = <0x2d>;
  2051. --
  2052. 2.44.0
  2053. From ba829ae1312962094bed036a8192f11eacfcec23 Mon Sep 17 00:00:00 2001
  2054. From: Diogo Ivo <[email protected]>
  2055. Date: Mon, 7 Aug 2023 14:33:05 +0100
  2056. Subject: [PATCH] arm64: tegra: Add display panel node on Smaug
  2057. The Google Pixel C has a JDI LPM102A188A display panel, so add a
  2058. DT node for it.
  2059. Signed-off-by: Diogo Ivo <[email protected]>
  2060. Signed-off-by: Thierry Reding <[email protected]>
  2061. ---
  2062. arch/arm64/boot/dts/nvidia/tegra210-smaug.dts | 27 +++++++++++++++++++
  2063. 1 file changed, 27 insertions(+)
  2064. diff --git a/arch/arm64/boot/dts/nvidia/tegra210-smaug.dts b/arch/arm64/boot/dts/nvidia/tegra210-smaug.dts
  2065. index 9c8ffbf8ef65..9ebb7369256e 100644
  2066. --- a/arch/arm64/boot/dts/nvidia/tegra210-smaug.dts
  2067. +++ b/arch/arm64/boot/dts/nvidia/tegra210-smaug.dts
  2068. @@ -31,6 +31,33 @@ memory {
  2069. };
  2070. host1x@50000000 {
  2071. + dsia: dsi@54300000 {
  2072. + avdd-dsi-csi-supply = <&vdd_dsi_csi>;
  2073. + status = "okay";
  2074. +
  2075. + link2: panel@0 {
  2076. + compatible = "jdi,lpm102a188a";
  2077. + reg = <0>;
  2078. + };
  2079. + };
  2080. +
  2081. + dsib: dsi@54400000 {
  2082. + avdd-dsi-csi-supply = <&vdd_dsi_csi>;
  2083. + nvidia,ganged-mode = <&dsia>;
  2084. + status = "okay";
  2085. +
  2086. + link1: panel@0 {
  2087. + compatible = "jdi,lpm102a188a";
  2088. + reg = <0>;
  2089. + power-supply = <&pplcd_vdd>;
  2090. + ddi-supply = <&pp1800_lcdio>;
  2091. + enable-gpios = <&gpio TEGRA_GPIO(V, 1) GPIO_ACTIVE_HIGH>;
  2092. + reset-gpios = <&gpio TEGRA_GPIO(V, 2) GPIO_ACTIVE_LOW>;
  2093. + link2 = <&link2>;
  2094. + backlight = <&backlight>;
  2095. + };
  2096. + };
  2097. +
  2098. dpaux: dpaux@545c0000 {
  2099. status = "okay";
  2100. };
  2101. --
  2102. 2.44.0
  2103. From b18513618ead4d6e9abadeaa19735d1a7f1a9fca Mon Sep 17 00:00:00 2001
  2104. From: Thierry Reding <[email protected]>
  2105. Date: Thu, 17 Aug 2023 16:14:03 +0200
  2106. Subject: [PATCH] arm64: tegra: Add missing current-speed for SBSA UART
  2107. The SBSA UART device tree bindings require a current-speed property that
  2108. specifies the baud rate configured by the firmware. Add it on Jetson AGX
  2109. Orin and Jetson Orin Nano/NX.
  2110. Signed-off-by: Thierry Reding <[email protected]>
  2111. ---
  2112. arch/arm64/boot/dts/nvidia/tegra234-p3737-0000+p3701-0000.dts | 1 +
  2113. arch/arm64/boot/dts/nvidia/tegra234-p3768-0000.dtsi | 1 +
  2114. 2 files changed, 2 insertions(+)
  2115. diff --git a/arch/arm64/boot/dts/nvidia/tegra234-p3737-0000+p3701-0000.dts b/arch/arm64/boot/dts/nvidia/tegra234-p3737-0000+p3701-0000.dts
  2116. index bf2ccc8ff93c..81a82933e350 100644
  2117. --- a/arch/arm64/boot/dts/nvidia/tegra234-p3737-0000+p3701-0000.dts
  2118. +++ b/arch/arm64/boot/dts/nvidia/tegra234-p3737-0000+p3701-0000.dts
  2119. @@ -30,6 +30,7 @@ serial@3100000 {
  2120. };
  2121. serial@31d0000 {
  2122. + current-speed = <115200>;
  2123. status = "okay";
  2124. };
  2125. diff --git a/arch/arm64/boot/dts/nvidia/tegra234-p3768-0000.dtsi b/arch/arm64/boot/dts/nvidia/tegra234-p3768-0000.dtsi
  2126. index 39110c1232e0..5d0298b6c30d 100644
  2127. --- a/arch/arm64/boot/dts/nvidia/tegra234-p3768-0000.dtsi
  2128. +++ b/arch/arm64/boot/dts/nvidia/tegra234-p3768-0000.dtsi
  2129. @@ -29,6 +29,7 @@ eeprom@57 {
  2130. };
  2131. serial@31d0000 {
  2132. + current-speed = <115200>;
  2133. status = "okay";
  2134. };
  2135. --
  2136. 2.44.0
  2137. From 7aa80cfac4903c7e098a5c46bfd580e652b6cd6f Mon Sep 17 00:00:00 2001
  2138. From: Thierry Reding <[email protected]>
  2139. Date: Thu, 17 Aug 2023 16:14:04 +0200
  2140. Subject: [PATCH] arm64: tegra: Remove duplicate nodes on Jetson Orin NX
  2141. The SBSA UART and TCU as well as the TCU alias and the stdout-path are
  2142. configured via the P3768 carrier board DTS include, so the can be
  2143. removed from the system DTS file.
  2144. Signed-off-by: Thierry Reding <[email protected]>
  2145. ---
  2146. .../dts/nvidia/tegra234-p3768-0000+p3767-0000.dts | 13 -------------
  2147. 1 file changed, 13 deletions(-)
  2148. diff --git a/arch/arm64/boot/dts/nvidia/tegra234-p3768-0000+p3767-0000.dts b/arch/arm64/boot/dts/nvidia/tegra234-p3768-0000+p3767-0000.dts
  2149. index e9460aedd47c..61b0e69d3d20 100644
  2150. --- a/arch/arm64/boot/dts/nvidia/tegra234-p3768-0000+p3767-0000.dts
  2151. +++ b/arch/arm64/boot/dts/nvidia/tegra234-p3768-0000+p3767-0000.dts
  2152. @@ -12,15 +12,10 @@ / {
  2153. model = "NVIDIA Jetson Orin NX Engineering Reference Developer Kit";
  2154. aliases {
  2155. - serial0 = &tcu;
  2156. serial1 = &uarta;
  2157. serial2 = &uarte;
  2158. };
  2159. - chosen {
  2160. - stdout-path = "serial0:115200n8";
  2161. - };
  2162. -
  2163. bus@0 {
  2164. serial@3100000 {
  2165. compatible = "nvidia,tegra194-hsuart";
  2166. @@ -34,10 +29,6 @@ serial@3140000 {
  2167. status = "okay";
  2168. };
  2169. - serial@31d0000 {
  2170. - status = "okay";
  2171. - };
  2172. -
  2173. pwm@32a0000 {
  2174. assigned-clocks = <&bpmp TEGRA234_CLK_PWM3>;
  2175. assigned-clock-parents = <&bpmp TEGRA234_CLK_PLLP_OUT0>;
  2176. @@ -94,10 +85,6 @@ vdd_3v3_pcie: regulator-vdd-3v3-pcie {
  2177. enable-active-high;
  2178. };
  2179. - serial {
  2180. - status = "okay";
  2181. - };
  2182. -
  2183. thermal-zones {
  2184. tj-thermal {
  2185. cooling-maps {
  2186. --
  2187. 2.44.0
  2188. From f13f2e024fdc163507e6fe7ceacef20bd67a2c7a Mon Sep 17 00:00:00 2001
  2189. From: Thierry Reding <[email protected]>
  2190. Date: Thu, 17 Aug 2023 16:14:05 +0200
  2191. Subject: [PATCH] arm64: tegra: Use correct format for clocks property
  2192. phandle and clock specifier pairs should be enclosed in angular
  2193. brackets.
  2194. Signed-off-by: Thierry Reding <[email protected]>
  2195. ---
  2196. arch/arm64/boot/dts/nvidia/tegra234.dtsi | 32 ++++++++++++------------
  2197. 1 file changed, 16 insertions(+), 16 deletions(-)
  2198. diff --git a/arch/arm64/boot/dts/nvidia/tegra234.dtsi b/arch/arm64/boot/dts/nvidia/tegra234.dtsi
  2199. index ac69eacf8a6b..1a9866cf1e19 100644
  2200. --- a/arch/arm64/boot/dts/nvidia/tegra234.dtsi
  2201. +++ b/arch/arm64/boot/dts/nvidia/tegra234.dtsi
  2202. @@ -705,8 +705,8 @@ gen1_i2c: i2c@3160000 {
  2203. #address-cells = <1>;
  2204. #size-cells = <0>;
  2205. clock-frequency = <400000>;
  2206. - clocks = <&bpmp TEGRA234_CLK_I2C1
  2207. - &bpmp TEGRA234_CLK_PLLP_OUT0>;
  2208. + clocks = <&bpmp TEGRA234_CLK_I2C1>,
  2209. + <&bpmp TEGRA234_CLK_PLLP_OUT0>;
  2210. assigned-clocks = <&bpmp TEGRA234_CLK_I2C1>;
  2211. assigned-clock-parents = <&bpmp TEGRA234_CLK_PLLP_OUT0>;
  2212. clock-names = "div-clk", "parent";
  2213. @@ -724,8 +724,8 @@ cam_i2c: i2c@3180000 {
  2214. #size-cells = <0>;
  2215. status = "disabled";
  2216. clock-frequency = <400000>;
  2217. - clocks = <&bpmp TEGRA234_CLK_I2C3
  2218. - &bpmp TEGRA234_CLK_PLLP_OUT0>;
  2219. + clocks = <&bpmp TEGRA234_CLK_I2C3>,
  2220. + <&bpmp TEGRA234_CLK_PLLP_OUT0>;
  2221. assigned-clocks = <&bpmp TEGRA234_CLK_I2C3>;
  2222. assigned-clock-parents = <&bpmp TEGRA234_CLK_PLLP_OUT0>;
  2223. clock-names = "div-clk", "parent";
  2224. @@ -743,8 +743,8 @@ dp_aux_ch1_i2c: i2c@3190000 {
  2225. #size-cells = <0>;
  2226. status = "disabled";
  2227. clock-frequency = <100000>;
  2228. - clocks = <&bpmp TEGRA234_CLK_I2C4
  2229. - &bpmp TEGRA234_CLK_PLLP_OUT0>;
  2230. + clocks = <&bpmp TEGRA234_CLK_I2C4>,
  2231. + <&bpmp TEGRA234_CLK_PLLP_OUT0>;
  2232. assigned-clocks = <&bpmp TEGRA234_CLK_I2C4>;
  2233. assigned-clock-parents = <&bpmp TEGRA234_CLK_PLLP_OUT0>;
  2234. clock-names = "div-clk", "parent";
  2235. @@ -762,8 +762,8 @@ dp_aux_ch0_i2c: i2c@31b0000 {
  2236. #size-cells = <0>;
  2237. status = "disabled";
  2238. clock-frequency = <100000>;
  2239. - clocks = <&bpmp TEGRA234_CLK_I2C6
  2240. - &bpmp TEGRA234_CLK_PLLP_OUT0>;
  2241. + clocks = <&bpmp TEGRA234_CLK_I2C6>,
  2242. + <&bpmp TEGRA234_CLK_PLLP_OUT0>;
  2243. assigned-clocks = <&bpmp TEGRA234_CLK_I2C6>;
  2244. assigned-clock-parents = <&bpmp TEGRA234_CLK_PLLP_OUT0>;
  2245. clock-names = "div-clk", "parent";
  2246. @@ -781,8 +781,8 @@ dp_aux_ch2_i2c: i2c@31c0000 {
  2247. #size-cells = <0>;
  2248. status = "disabled";
  2249. clock-frequency = <100000>;
  2250. - clocks = <&bpmp TEGRA234_CLK_I2C7
  2251. - &bpmp TEGRA234_CLK_PLLP_OUT0>;
  2252. + clocks = <&bpmp TEGRA234_CLK_I2C7>,
  2253. + <&bpmp TEGRA234_CLK_PLLP_OUT0>;
  2254. assigned-clocks = <&bpmp TEGRA234_CLK_I2C7>;
  2255. assigned-clock-parents = <&bpmp TEGRA234_CLK_PLLP_OUT0>;
  2256. clock-names = "div-clk", "parent";
  2257. @@ -807,8 +807,8 @@ dp_aux_ch3_i2c: i2c@31e0000 {
  2258. #size-cells = <0>;
  2259. status = "disabled";
  2260. clock-frequency = <100000>;
  2261. - clocks = <&bpmp TEGRA234_CLK_I2C9
  2262. - &bpmp TEGRA234_CLK_PLLP_OUT0>;
  2263. + clocks = <&bpmp TEGRA234_CLK_I2C9>,
  2264. + <&bpmp TEGRA234_CLK_PLLP_OUT0>;
  2265. assigned-clocks = <&bpmp TEGRA234_CLK_I2C9>;
  2266. assigned-clock-parents = <&bpmp TEGRA234_CLK_PLLP_OUT0>;
  2267. clock-names = "div-clk", "parent";
  2268. @@ -1751,8 +1751,8 @@ gen2_i2c: i2c@c240000 {
  2269. #size-cells = <0>;
  2270. status = "disabled";
  2271. clock-frequency = <100000>;
  2272. - clocks = <&bpmp TEGRA234_CLK_I2C2
  2273. - &bpmp TEGRA234_CLK_PLLP_OUT0>;
  2274. + clocks = <&bpmp TEGRA234_CLK_I2C2>,
  2275. + <&bpmp TEGRA234_CLK_PLLP_OUT0>;
  2276. clock-names = "div-clk", "parent";
  2277. assigned-clocks = <&bpmp TEGRA234_CLK_I2C2>;
  2278. assigned-clock-parents = <&bpmp TEGRA234_CLK_PLLP_OUT0>;
  2279. @@ -1770,8 +1770,8 @@ gen8_i2c: i2c@c250000 {
  2280. #size-cells = <0>;
  2281. status = "disabled";
  2282. clock-frequency = <400000>;
  2283. - clocks = <&bpmp TEGRA234_CLK_I2C8
  2284. - &bpmp TEGRA234_CLK_PLLP_OUT0>;
  2285. + clocks = <&bpmp TEGRA234_CLK_I2C8>,
  2286. + <&bpmp TEGRA234_CLK_PLLP_OUT0>;
  2287. clock-names = "div-clk", "parent";
  2288. assigned-clocks = <&bpmp TEGRA234_CLK_I2C8>;
  2289. assigned-clock-parents = <&bpmp TEGRA234_CLK_PLLP_OUT0>;
  2290. --
  2291. 2.44.0
  2292. From ea43b110d36b5d298b95cfa781ca79209d4f291e Mon Sep 17 00:00:00 2001
  2293. From: Thierry Reding <[email protected]>
  2294. Date: Thu, 17 Aug 2023 16:14:06 +0200
  2295. Subject: [PATCH] arm64: tegra: Add dmas and dma-names for Tegra234 UARTE
  2296. Commit 940acdac99b2 ("arm64: tegra: Add UARTE device tree node on
  2297. Tegra234") added the device tree node for the UARTE on Tegra234 but
  2298. didn't include the "dmas" and "dma-names" properties required for this
  2299. device when it's used in high-speed mode.
  2300. Signed-off-by: Thierry Reding <[email protected]>
  2301. ---
  2302. arch/arm64/boot/dts/nvidia/tegra234.dtsi | 2 ++
  2303. 1 file changed, 2 insertions(+)
  2304. diff --git a/arch/arm64/boot/dts/nvidia/tegra234.dtsi b/arch/arm64/boot/dts/nvidia/tegra234.dtsi
  2305. index 1a9866cf1e19..d1fe41cc3e0b 100644
  2306. --- a/arch/arm64/boot/dts/nvidia/tegra234.dtsi
  2307. +++ b/arch/arm64/boot/dts/nvidia/tegra234.dtsi
  2308. @@ -694,6 +694,8 @@ uarte: serial@3140000 {
  2309. interrupts = <GIC_SPI 116 IRQ_TYPE_LEVEL_HIGH>;
  2310. clocks = <&bpmp TEGRA234_CLK_UARTE>;
  2311. resets = <&bpmp TEGRA234_RESET_UARTE>;
  2312. + dmas = <&gpcdma 20>, <&gpcdma 20>;
  2313. + dma-names = "rx", "tx";
  2314. status = "disabled";
  2315. };
  2316. --
  2317. 2.44.0
  2318. From 9c5534efd875098bbebde4da8b9a027a54a3c288 Mon Sep 17 00:00:00 2001
  2319. From: Thierry Reding <[email protected]>
  2320. Date: Thu, 17 Aug 2023 16:14:07 +0200
  2321. Subject: [PATCH] arm64: tegra: Mark Tegra234 SPI as compatible with Tegra114
  2322. According to the bindings, both Tegra210 and Tegra114 compatible strings
  2323. need to be specified since the version of this hardware block found in
  2324. Tegra210 is backwards-compatible.
  2325. Signed-off-by: Thierry Reding <[email protected]>
  2326. ---
  2327. arch/arm64/boot/dts/nvidia/tegra234.dtsi | 6 +++---
  2328. 1 file changed, 3 insertions(+), 3 deletions(-)
  2329. diff --git a/arch/arm64/boot/dts/nvidia/tegra234.dtsi b/arch/arm64/boot/dts/nvidia/tegra234.dtsi
  2330. index d1fe41cc3e0b..3f16595d099c 100644
  2331. --- a/arch/arm64/boot/dts/nvidia/tegra234.dtsi
  2332. +++ b/arch/arm64/boot/dts/nvidia/tegra234.dtsi
  2333. @@ -821,7 +821,7 @@ dp_aux_ch3_i2c: i2c@31e0000 {
  2334. };
  2335. spi@3210000 {
  2336. - compatible = "nvidia,tegra210-spi";
  2337. + compatible = "nvidia,tegra210-spi", "nvidia,tegra114-spi";
  2338. reg = <0x0 0x03210000 0x0 0x1000>;
  2339. interrupts = <GIC_SPI 36 IRQ_TYPE_LEVEL_HIGH>;
  2340. #address-cells = <1>;
  2341. @@ -840,7 +840,7 @@ spi@3210000 {
  2342. };
  2343. spi@3230000 {
  2344. - compatible = "nvidia,tegra210-spi";
  2345. + compatible = "nvidia,tegra210-spi", "nvidia,tegra114-spi";
  2346. reg = <0x0 0x03230000 0x0 0x1000>;
  2347. interrupts = <GIC_SPI 38 IRQ_TYPE_LEVEL_HIGH>;
  2348. #address-cells = <1>;
  2349. @@ -1784,7 +1784,7 @@ gen8_i2c: i2c@c250000 {
  2350. };
  2351. spi@c260000 {
  2352. - compatible = "nvidia,tegra210-spi";
  2353. + compatible = "nvidia,tegra210-spi", "nvidia,tegra114-spi";
  2354. reg = <0x0 0x0c260000 0x0 0x1000>;
  2355. interrupts = <GIC_SPI 37 IRQ_TYPE_LEVEL_HIGH>;
  2356. #address-cells = <1>;
  2357. --
  2358. 2.44.0
  2359. From cd76c21e85a6c7fece6ed4b664de08bddc793151 Mon Sep 17 00:00:00 2001
  2360. From: Jon Hunter <[email protected]>
  2361. Date: Fri, 29 Sep 2023 11:36:50 +0100
  2362. Subject: [PATCH] arm64: tegra: Add power-sensors for Tegra234 boards
  2363. Populate the ina219 and ina3221 power-sensors for the various Tegra234
  2364. boards. These sensors are located on the Tegra234 module boards and the
  2365. configuration of some sensors is common across the different Tegra234
  2366. modules. Therefore, add any common sensor configurations to appropriate
  2367. device tree source file so it can be re-used across modules.
  2368. Signed-off-by: Jon Hunter <[email protected]>
  2369. Signed-off-by: Thierry Reding <[email protected]>
  2370. ---
  2371. .../boot/dts/nvidia/tegra234-p3701-0008.dtsi | 33 ++++++++++++
  2372. .../arm64/boot/dts/nvidia/tegra234-p3701.dtsi | 53 +++++++++++++++++++
  2373. .../arm64/boot/dts/nvidia/tegra234-p3767.dtsi | 29 ++++++++++
  2374. 3 files changed, 115 insertions(+)
  2375. diff --git a/arch/arm64/boot/dts/nvidia/tegra234-p3701-0008.dtsi b/arch/arm64/boot/dts/nvidia/tegra234-p3701-0008.dtsi
  2376. index 62c4fdad0b60..553fa4ba1cd4 100644
  2377. --- a/arch/arm64/boot/dts/nvidia/tegra234-p3701-0008.dtsi
  2378. +++ b/arch/arm64/boot/dts/nvidia/tegra234-p3701-0008.dtsi
  2379. @@ -44,6 +44,39 @@ i2c@c240000 {
  2380. status = "okay";
  2381. };
  2382. + i2c@c250000 {
  2383. + power-sensor@41 {
  2384. + compatible = "ti,ina3221";
  2385. + reg = <0x41>;
  2386. + #address-cells = <1>;
  2387. + #size-cells = <0>;
  2388. +
  2389. + input@0 {
  2390. + reg = <0x0>;
  2391. + label = "CVB_ATX_12V";
  2392. + shunt-resistor-micro-ohms = <2000>;
  2393. + };
  2394. +
  2395. + input@1 {
  2396. + reg = <0x1>;
  2397. + label = "CVB_ATX_3V3";
  2398. + shunt-resistor-micro-ohms = <2000>;
  2399. + };
  2400. +
  2401. + input@2 {
  2402. + reg = <0x2>;
  2403. + label = "CVB_ATX_5V";
  2404. + shunt-resistor-micro-ohms = <2000>;
  2405. + };
  2406. + };
  2407. +
  2408. + power-sensor@44 {
  2409. + compatible = "ti,ina219";
  2410. + reg = <0x44>;
  2411. + shunt-resistor = <2000>;
  2412. + };
  2413. + };
  2414. +
  2415. rtc@c2a0000 {
  2416. status = "okay";
  2417. };
  2418. diff --git a/arch/arm64/boot/dts/nvidia/tegra234-p3701.dtsi b/arch/arm64/boot/dts/nvidia/tegra234-p3701.dtsi
  2419. index 5e7797df50c2..db6ef711674a 100644
  2420. --- a/arch/arm64/boot/dts/nvidia/tegra234-p3701.dtsi
  2421. +++ b/arch/arm64/boot/dts/nvidia/tegra234-p3701.dtsi
  2422. @@ -1987,5 +1987,58 @@ interrupt-controller@2a40000 {
  2423. status = "okay";
  2424. };
  2425. };
  2426. +
  2427. + i2c@c240000 {
  2428. + status = "okay";
  2429. +
  2430. + power-sensor@40 {
  2431. + compatible = "ti,ina3221";
  2432. + reg = <0x40>;
  2433. + #address-cells = <1>;
  2434. + #size-cells = <0>;
  2435. +
  2436. + input@0 {
  2437. + reg = <0x0>;
  2438. + label = "VDD_GPU_SOC";
  2439. + shunt-resistor-micro-ohms = <2000>;
  2440. + };
  2441. +
  2442. + input@1 {
  2443. + reg = <0x1>;
  2444. + label = "VDD_CPU_CV";
  2445. + shunt-resistor-micro-ohms = <2000>;
  2446. + };
  2447. +
  2448. + input@2 {
  2449. + reg = <0x2>;
  2450. + label = "VIN_SYS_5V0";
  2451. + shunt-resistor-micro-ohms = <2000>;
  2452. + ti,summation-disable;
  2453. + };
  2454. + };
  2455. +
  2456. + power-sensor@41 {
  2457. + compatible = "ti,ina3221";
  2458. + reg = <0x41>;
  2459. + #address-cells = <1>;
  2460. + #size-cells = <0>;
  2461. +
  2462. + input@0 {
  2463. + reg = <0x0>;
  2464. + status = "disabled";
  2465. + };
  2466. +
  2467. + input@1 {
  2468. + reg = <0x1>;
  2469. + label = "VDDQ_VDD2_1V8AO";
  2470. + shunt-resistor-micro-ohms = <2000>;
  2471. + };
  2472. +
  2473. + input@2 {
  2474. + reg = <0x2>;
  2475. + status = "disabled";
  2476. + };
  2477. + };
  2478. + };
  2479. };
  2480. };
  2481. diff --git a/arch/arm64/boot/dts/nvidia/tegra234-p3767.dtsi b/arch/arm64/boot/dts/nvidia/tegra234-p3767.dtsi
  2482. index fe08e131b7b9..59c14ded5e9f 100644
  2483. --- a/arch/arm64/boot/dts/nvidia/tegra234-p3767.dtsi
  2484. +++ b/arch/arm64/boot/dts/nvidia/tegra234-p3767.dtsi
  2485. @@ -55,6 +55,35 @@ padctl@3520000 {
  2486. avdd-usb-supply = <&vdd_3v3_ao>;
  2487. };
  2488. + i2c@c240000 {
  2489. + status = "okay";
  2490. +
  2491. + power-sensor@40 {
  2492. + compatible = "ti,ina3221";
  2493. + reg = <0x40>;
  2494. + #address-cells = <1>;
  2495. + #size-cells = <0>;
  2496. +
  2497. + input@0 {
  2498. + reg = <0x0>;
  2499. + label = "VDD_IN";
  2500. + shunt-resistor-micro-ohms = <5000>;
  2501. + };
  2502. +
  2503. + input@1 {
  2504. + reg = <0x1>;
  2505. + label = "VDD_CPU_GPU_CV";
  2506. + shunt-resistor-micro-ohms = <5000>;
  2507. + };
  2508. +
  2509. + input@2 {
  2510. + reg = <0x2>;
  2511. + label = "VDD_SOC";
  2512. + shunt-resistor-micro-ohms = <5000>;
  2513. + };
  2514. + };
  2515. + };
  2516. +
  2517. rtc@c2a0000 {
  2518. status = "okay";
  2519. };
  2520. --
  2521. 2.44.0
  2522. From 695a4755e60e4eb197f56aa10c5844224d320eb9 Mon Sep 17 00:00:00 2001
  2523. From: Christophe JAILLET <[email protected]>
  2524. Date: Sun, 12 Nov 2023 08:04:14 +0100
  2525. Subject: [PATCH] soc/tegra: pmc: Remove some old and deprecated functions and
  2526. constants
  2527. These TEGRA_IO_RAIL_... functions and constants have been deprecated in
  2528. commit 21b499105178 ("soc/tegra: pmc: Add I/O pad voltage support") in
  2529. 2016-11.
  2530. There seems to be no users since kernel 4.16.
  2531. Remove them now.
  2532. Signed-off-by: Christophe JAILLET <[email protected]>
  2533. Signed-off-by: Thierry Reding <[email protected]>
  2534. ---
  2535. drivers/soc/tegra/pmc.c | 24 ------------------------
  2536. include/soc/tegra/pmc.h | 18 ------------------
  2537. 2 files changed, 42 deletions(-)
  2538. diff --git a/drivers/soc/tegra/pmc.c b/drivers/soc/tegra/pmc.c
  2539. index f432aa022ace..6dfcc7f50ece 100644
  2540. --- a/drivers/soc/tegra/pmc.c
  2541. +++ b/drivers/soc/tegra/pmc.c
  2542. @@ -1777,30 +1777,6 @@ static int tegra_io_pad_get_voltage(struct tegra_pmc *pmc, enum tegra_io_pad id)
  2543. return TEGRA_IO_PAD_VOLTAGE_3V3;
  2544. }
  2545. -/**
  2546. - * tegra_io_rail_power_on() - enable power to I/O rail
  2547. - * @id: Tegra I/O pad ID for which to enable power
  2548. - *
  2549. - * See also: tegra_io_pad_power_enable()
  2550. - */
  2551. -int tegra_io_rail_power_on(unsigned int id)
  2552. -{
  2553. - return tegra_io_pad_power_enable(id);
  2554. -}
  2555. -EXPORT_SYMBOL(tegra_io_rail_power_on);
  2556. -
  2557. -/**
  2558. - * tegra_io_rail_power_off() - disable power to I/O rail
  2559. - * @id: Tegra I/O pad ID for which to disable power
  2560. - *
  2561. - * See also: tegra_io_pad_power_disable()
  2562. - */
  2563. -int tegra_io_rail_power_off(unsigned int id)
  2564. -{
  2565. - return tegra_io_pad_power_disable(id);
  2566. -}
  2567. -EXPORT_SYMBOL(tegra_io_rail_power_off);
  2568. -
  2569. #ifdef CONFIG_PM_SLEEP
  2570. enum tegra_suspend_mode tegra_pmc_get_suspend_mode(void)
  2571. {
  2572. diff --git a/include/soc/tegra/pmc.h b/include/soc/tegra/pmc.h
  2573. index aadb845d281d..c545875d0ff1 100644
  2574. --- a/include/soc/tegra/pmc.h
  2575. +++ b/include/soc/tegra/pmc.h
  2576. @@ -148,10 +148,6 @@ enum tegra_io_pad {
  2577. TEGRA_IO_PAD_AO_HV,
  2578. };
  2579. -/* deprecated, use TEGRA_IO_PAD_{HDMI,LVDS} instead */
  2580. -#define TEGRA_IO_RAIL_HDMI TEGRA_IO_PAD_HDMI
  2581. -#define TEGRA_IO_RAIL_LVDS TEGRA_IO_PAD_LVDS
  2582. -
  2583. #ifdef CONFIG_SOC_TEGRA_PMC
  2584. int tegra_powergate_power_on(unsigned int id);
  2585. int tegra_powergate_power_off(unsigned int id);
  2586. @@ -164,10 +160,6 @@ int tegra_powergate_sequence_power_up(unsigned int id, struct clk *clk,
  2587. int tegra_io_pad_power_enable(enum tegra_io_pad id);
  2588. int tegra_io_pad_power_disable(enum tegra_io_pad id);
  2589. -/* deprecated, use tegra_io_pad_power_{enable,disable}() instead */
  2590. -int tegra_io_rail_power_on(unsigned int id);
  2591. -int tegra_io_rail_power_off(unsigned int id);
  2592. -
  2593. void tegra_pmc_set_suspend_mode(enum tegra_suspend_mode mode);
  2594. void tegra_pmc_enter_suspend_mode(enum tegra_suspend_mode mode);
  2595. @@ -211,16 +203,6 @@ static inline int tegra_io_pad_get_voltage(enum tegra_io_pad id)
  2596. return -ENOSYS;
  2597. }
  2598. -static inline int tegra_io_rail_power_on(unsigned int id)
  2599. -{
  2600. - return -ENOSYS;
  2601. -}
  2602. -
  2603. -static inline int tegra_io_rail_power_off(unsigned int id)
  2604. -{
  2605. - return -ENOSYS;
  2606. -}
  2607. -
  2608. static inline void tegra_pmc_set_suspend_mode(enum tegra_suspend_mode mode)
  2609. {
  2610. }
  2611. --
  2612. 2.44.0
  2613. From f40dfb313467895d3a1ab6183693127e98a0aa19 Mon Sep 17 00:00:00 2001
  2614. From: Kartik <[email protected]>
  2615. Date: Tue, 17 Oct 2023 10:53:15 +0530
  2616. Subject: [PATCH] mm/util: Introduce kmemdup_array()
  2617. Introduce kmemdup_array() API to duplicate `n` number of elements
  2618. from a given array. This internally uses kmemdup to allocate and duplicate
  2619. the `src` array.
  2620. Signed-off-by: Kartik <[email protected]>
  2621. Acked-by: Kees Cook <[email protected]>
  2622. Signed-off-by: Thierry Reding <[email protected]>
  2623. ---
  2624. include/linux/string.h | 1 +
  2625. mm/util.c | 17 +++++++++++++++++
  2626. 2 files changed, 18 insertions(+)
  2627. diff --git a/include/linux/string.h b/include/linux/string.h
  2628. index 5077776e995e..361294697f8c 100644
  2629. --- a/include/linux/string.h
  2630. +++ b/include/linux/string.h
  2631. @@ -219,6 +219,7 @@ extern char *kstrndup(const char *s, size_t len, gfp_t gfp);
  2632. extern void *kmemdup(const void *src, size_t len, gfp_t gfp) __realloc_size(2);
  2633. extern void *kvmemdup(const void *src, size_t len, gfp_t gfp) __realloc_size(2);
  2634. extern char *kmemdup_nul(const char *s, size_t len, gfp_t gfp);
  2635. +extern void *kmemdup_array(const void *src, size_t element_size, size_t count, gfp_t gfp);
  2636. extern char **argv_split(gfp_t gfp, const char *str, int *argcp);
  2637. extern void argv_free(char **argv);
  2638. diff --git a/mm/util.c b/mm/util.c
  2639. index be798981acc7..c79e6f174cd9 100644
  2640. --- a/mm/util.c
  2641. +++ b/mm/util.c
  2642. @@ -135,6 +135,23 @@ void *kmemdup(const void *src, size_t len, gfp_t gfp)
  2643. }
  2644. EXPORT_SYMBOL(kmemdup);
  2645. +/**
  2646. + * kmemdup_array - duplicate a given array.
  2647. + *
  2648. + * @src: array to duplicate.
  2649. + * @element_size: size of each element of array.
  2650. + * @count: number of elements to duplicate from array.
  2651. + * @gfp: GFP mask to use.
  2652. + *
  2653. + * Return: duplicated array of @src or %NULL in case of error,
  2654. + * result is physically contiguous. Use kfree() to free.
  2655. + */
  2656. +void *kmemdup_array(const void *src, size_t element_size, size_t count, gfp_t gfp)
  2657. +{
  2658. + return kmemdup(src, size_mul(element_size, count), gfp);
  2659. +}
  2660. +EXPORT_SYMBOL(kmemdup_array);
  2661. +
  2662. /**
  2663. * kvmemdup - duplicate region of memory
  2664. *
  2665. --
  2666. 2.44.0
  2667. From 30f2f37b8894149f442a4f6e15c1a63635be4080 Mon Sep 17 00:00:00 2001
  2668. From: Kartik <[email protected]>
  2669. Date: Tue, 17 Oct 2023 10:53:16 +0530
  2670. Subject: [PATCH] soc/tegra: fuse: Use dev_err_probe for probe failures
  2671. Currently, in tegra_fuse_probe() if clock/reset get fails, then the
  2672. driver prints an error if the error is not caused by -EPROBE_DEFER.
  2673. This can be improved by using dev_err_probe() instead.
  2674. So, return dev_err_probe() if clock/reset get fails.
  2675. Signed-off-by: Kartik <[email protected]>
  2676. Signed-off-by: Thierry Reding <[email protected]>
  2677. ---
  2678. drivers/soc/tegra/fuse/fuse-tegra.c | 17 ++++-------------
  2679. 1 file changed, 4 insertions(+), 13 deletions(-)
  2680. diff --git a/drivers/soc/tegra/fuse/fuse-tegra.c b/drivers/soc/tegra/fuse/fuse-tegra.c
  2681. index a2c28f493a75..98805885158e 100644
  2682. --- a/drivers/soc/tegra/fuse/fuse-tegra.c
  2683. +++ b/drivers/soc/tegra/fuse/fuse-tegra.c
  2684. @@ -131,13 +131,8 @@ static int tegra_fuse_probe(struct platform_device *pdev)
  2685. fuse->phys = res->start;
  2686. fuse->clk = devm_clk_get(&pdev->dev, "fuse");
  2687. - if (IS_ERR(fuse->clk)) {
  2688. - if (PTR_ERR(fuse->clk) != -EPROBE_DEFER)
  2689. - dev_err(&pdev->dev, "failed to get FUSE clock: %ld",
  2690. - PTR_ERR(fuse->clk));
  2691. -
  2692. - return PTR_ERR(fuse->clk);
  2693. - }
  2694. + if (IS_ERR(fuse->clk))
  2695. + return dev_err_probe(&pdev->dev, PTR_ERR(fuse->clk), "failed to get FUSE clock\n");
  2696. platform_set_drvdata(pdev, fuse);
  2697. fuse->dev = &pdev->dev;
  2698. @@ -179,12 +174,8 @@ static int tegra_fuse_probe(struct platform_device *pdev)
  2699. }
  2700. fuse->rst = devm_reset_control_get_optional(&pdev->dev, "fuse");
  2701. - if (IS_ERR(fuse->rst)) {
  2702. - err = PTR_ERR(fuse->rst);
  2703. - dev_err(&pdev->dev, "failed to get FUSE reset: %pe\n",
  2704. - fuse->rst);
  2705. - return err;
  2706. - }
  2707. + if (IS_ERR(fuse->rst))
  2708. + return dev_err_probe(&pdev->dev, PTR_ERR(fuse->rst), "failed to get FUSE reset\n");
  2709. /*
  2710. * FUSE clock is enabled at a boot time, hence this resume/suspend
  2711. --
  2712. 2.44.0
  2713. From 2f89f2b59621343ca873f7ff6ca2ae9516cf9fae Mon Sep 17 00:00:00 2001
  2714. From: Kartik <[email protected]>
  2715. Date: Tue, 17 Oct 2023 10:53:17 +0530
  2716. Subject: [PATCH] soc/tegra: fuse: Refactor resource mapping
  2717. MIME-Version: 1.0
  2718. Content-Type: text/plain; charset=UTF-8
  2719. Content-Transfer-Encoding: 8bit
  2720. To prepare for adding ACPI support to the tegra-apbmisc driver,
  2721. relocate the code responsible for mapping memory resources from
  2722. the function ‘tegra_init_apbmisc’ to the function
  2723. ‘tegra_init_apbmisc_resources.’ This adjustment will allow the
  2724. code to be shared between ‘tegra_init_apbmisc’ and the upcoming
  2725. ‘tegra_acpi_init_apbmisc’ function.
  2726. Signed-off-by: Kartik <[email protected]>
  2727. Signed-off-by: Thierry Reding <[email protected]>
  2728. ---
  2729. drivers/soc/tegra/fuse/tegra-apbmisc.c | 37 +++++++++++++++-----------
  2730. 1 file changed, 21 insertions(+), 16 deletions(-)
  2731. diff --git a/drivers/soc/tegra/fuse/tegra-apbmisc.c b/drivers/soc/tegra/fuse/tegra-apbmisc.c
  2732. index da970f3dbf35..06c1b3a2c7ec 100644
  2733. --- a/drivers/soc/tegra/fuse/tegra-apbmisc.c
  2734. +++ b/drivers/soc/tegra/fuse/tegra-apbmisc.c
  2735. @@ -160,9 +160,28 @@ void __init tegra_init_revision(void)
  2736. tegra_sku_info.platform = tegra_get_platform();
  2737. }
  2738. -void __init tegra_init_apbmisc(void)
  2739. +static void tegra_init_apbmisc_resources(struct resource *apbmisc,
  2740. + struct resource *straps)
  2741. {
  2742. void __iomem *strapping_base;
  2743. +
  2744. + apbmisc_base = ioremap(apbmisc->start, resource_size(apbmisc));
  2745. + if (apbmisc_base)
  2746. + chipid = readl_relaxed(apbmisc_base + 4);
  2747. + else
  2748. + pr_err("failed to map APBMISC registers\n");
  2749. +
  2750. + strapping_base = ioremap(straps->start, resource_size(straps));
  2751. + if (strapping_base) {
  2752. + strapping = readl_relaxed(strapping_base);
  2753. + iounmap(strapping_base);
  2754. + } else {
  2755. + pr_err("failed to map strapping options registers\n");
  2756. + }
  2757. +}
  2758. +
  2759. +void __init tegra_init_apbmisc(void)
  2760. +{
  2761. struct resource apbmisc, straps;
  2762. struct device_node *np;
  2763. @@ -219,21 +238,7 @@ void __init tegra_init_apbmisc(void)
  2764. }
  2765. }
  2766. - apbmisc_base = ioremap(apbmisc.start, resource_size(&apbmisc));
  2767. - if (!apbmisc_base) {
  2768. - pr_err("failed to map APBMISC registers\n");
  2769. - } else {
  2770. - chipid = readl_relaxed(apbmisc_base + 4);
  2771. - }
  2772. -
  2773. - strapping_base = ioremap(straps.start, resource_size(&straps));
  2774. - if (!strapping_base) {
  2775. - pr_err("failed to map strapping options registers\n");
  2776. - } else {
  2777. - strapping = readl_relaxed(strapping_base);
  2778. - iounmap(strapping_base);
  2779. - }
  2780. -
  2781. + tegra_init_apbmisc_resources(&apbmisc, &straps);
  2782. long_ram_code = of_property_read_bool(np, "nvidia,long-ram-code");
  2783. put:
  2784. --
  2785. 2.44.0
  2786. From 27d340f90cfca1f5761248436ead6d13affa481b Mon Sep 17 00:00:00 2001
  2787. From: Kartik <[email protected]>
  2788. Date: Tue, 17 Oct 2023 10:53:18 +0530
  2789. Subject: [PATCH] soc/tegra: fuse: Add tegra_acpi_init_apbmisc()
  2790. In preparation to ACPI support in Tegra fuse driver add function
  2791. tegra_acpi_init_apbmisc() to initialize tegra-apbmisc driver.
  2792. Also, document the reason of calling tegra_init_apbmisc() at early init.
  2793. Note that function tegra_acpi_init_apbmisc() is not placed in the __init
  2794. section, because it will be called during probe.
  2795. Signed-off-by: Kartik <[email protected]>
  2796. Signed-off-by: Thierry Reding <[email protected]>
  2797. ---
  2798. drivers/soc/tegra/fuse/fuse.h | 1 +
  2799. drivers/soc/tegra/fuse/tegra-apbmisc.c | 72 ++++++++++++++++++++++++++
  2800. 2 files changed, 73 insertions(+)
  2801. diff --git a/drivers/soc/tegra/fuse/fuse.h b/drivers/soc/tegra/fuse/fuse.h
  2802. index 90f23be73894..a41e9f85281a 100644
  2803. --- a/drivers/soc/tegra/fuse/fuse.h
  2804. +++ b/drivers/soc/tegra/fuse/fuse.h
  2805. @@ -69,6 +69,7 @@ struct tegra_fuse {
  2806. void tegra_init_revision(void);
  2807. void tegra_init_apbmisc(void);
  2808. +void tegra_acpi_init_apbmisc(void);
  2809. u32 __init tegra_fuse_read_spare(unsigned int spare);
  2810. u32 __init tegra_fuse_read_early(unsigned int offset);
  2811. diff --git a/drivers/soc/tegra/fuse/tegra-apbmisc.c b/drivers/soc/tegra/fuse/tegra-apbmisc.c
  2812. index 06c1b3a2c7ec..6457f80821bb 100644
  2813. --- a/drivers/soc/tegra/fuse/tegra-apbmisc.c
  2814. +++ b/drivers/soc/tegra/fuse/tegra-apbmisc.c
  2815. @@ -3,9 +3,11 @@
  2816. * Copyright (c) 2014-2023, NVIDIA CORPORATION. All rights reserved.
  2817. */
  2818. +#include <linux/acpi.h>
  2819. #include <linux/export.h>
  2820. #include <linux/io.h>
  2821. #include <linux/kernel.h>
  2822. +#include <linux/mod_devicetable.h>
  2823. #include <linux/of.h>
  2824. #include <linux/of_address.h>
  2825. @@ -180,6 +182,12 @@ static void tegra_init_apbmisc_resources(struct resource *apbmisc,
  2826. }
  2827. }
  2828. +/**
  2829. + * tegra_init_apbmisc - Initializes Tegra APBMISC and Strapping registers.
  2830. + *
  2831. + * This is called during early init as some of the old 32-bit ARM code needs
  2832. + * information from the APBMISC registers very early during boot.
  2833. + */
  2834. void __init tegra_init_apbmisc(void)
  2835. {
  2836. struct resource apbmisc, straps;
  2837. @@ -244,3 +252,67 @@ void __init tegra_init_apbmisc(void)
  2838. put:
  2839. of_node_put(np);
  2840. }
  2841. +
  2842. +#ifdef CONFIG_ACPI
  2843. +static const struct acpi_device_id apbmisc_acpi_match[] = {
  2844. + { "NVDA2010" },
  2845. + { /* sentinel */ }
  2846. +};
  2847. +
  2848. +void tegra_acpi_init_apbmisc(void)
  2849. +{
  2850. + struct resource *resources[2] = { NULL };
  2851. + struct resource_entry *rentry;
  2852. + struct acpi_device *adev = NULL;
  2853. + struct list_head resource_list;
  2854. + int rcount = 0;
  2855. + int ret;
  2856. +
  2857. + adev = acpi_dev_get_first_match_dev(apbmisc_acpi_match[0].id, NULL, -1);
  2858. + if (!adev)
  2859. + return;
  2860. +
  2861. + INIT_LIST_HEAD(&resource_list);
  2862. +
  2863. + ret = acpi_dev_get_memory_resources(adev, &resource_list);
  2864. + if (ret < 0) {
  2865. + pr_err("failed to get APBMISC memory resources");
  2866. + goto out_put_acpi_dev;
  2867. + }
  2868. +
  2869. + /*
  2870. + * Get required memory resources.
  2871. + *
  2872. + * resources[0]: apbmisc.
  2873. + * resources[1]: straps.
  2874. + */
  2875. + resource_list_for_each_entry(rentry, &resource_list) {
  2876. + if (rcount >= ARRAY_SIZE(resources))
  2877. + break;
  2878. +
  2879. + resources[rcount++] = rentry->res;
  2880. + }
  2881. +
  2882. + if (!resources[0]) {
  2883. + pr_err("failed to get APBMISC registers\n");
  2884. + goto out_free_resource_list;
  2885. + }
  2886. +
  2887. + if (!resources[1]) {
  2888. + pr_err("failed to get strapping options registers\n");
  2889. + goto out_free_resource_list;
  2890. + }
  2891. +
  2892. + tegra_init_apbmisc_resources(resources[0], resources[1]);
  2893. +
  2894. +out_free_resource_list:
  2895. + acpi_dev_free_resource_list(&resource_list);
  2896. +
  2897. +out_put_acpi_dev:
  2898. + acpi_dev_put(adev);
  2899. +}
  2900. +#else
  2901. +void tegra_acpi_init_apbmisc(void)
  2902. +{
  2903. +}
  2904. +#endif
  2905. --
  2906. 2.44.0
  2907. From 845ff015be575e5420799944dc9fae79d14045da Mon Sep 17 00:00:00 2001
  2908. From: Kartik <[email protected]>
  2909. Date: Tue, 17 Oct 2023 10:53:19 +0530
  2910. Subject: [PATCH] soc/tegra: fuse: Add function to add lookups
  2911. Add helper function tegra_fuse_add_lookups() to register Tegra fuse
  2912. nvmem lookups. So, this can be shared between tegra_fuse_init() and
  2913. ACPI probe, which is to be introduced later.
  2914. Use kmemdup_array to duplicate fuse->soc->lookups.
  2915. Signed-off-by: Kartik <[email protected]>
  2916. Signed-off-by: Thierry Reding <[email protected]>
  2917. ---
  2918. drivers/soc/tegra/fuse/fuse-tegra.c | 25 +++++++++++++++++--------
  2919. 1 file changed, 17 insertions(+), 8 deletions(-)
  2920. diff --git a/drivers/soc/tegra/fuse/fuse-tegra.c b/drivers/soc/tegra/fuse/fuse-tegra.c
  2921. index 98805885158e..4ebb5597a77b 100644
  2922. --- a/drivers/soc/tegra/fuse/fuse-tegra.c
  2923. +++ b/drivers/soc/tegra/fuse/fuse-tegra.c
  2924. @@ -113,6 +113,18 @@ static void tegra_fuse_restore(void *base)
  2925. fuse->clk = NULL;
  2926. }
  2927. +static int tegra_fuse_add_lookups(struct tegra_fuse *fuse)
  2928. +{
  2929. + fuse->lookups = kmemdup_array(fuse->soc->lookups, sizeof(*fuse->lookups),
  2930. + fuse->soc->num_lookups, GFP_KERNEL);
  2931. + if (!fuse->lookups)
  2932. + return -ENOMEM;
  2933. +
  2934. + nvmem_add_cell_lookups(fuse->lookups, fuse->soc->num_lookups);
  2935. +
  2936. + return 0;
  2937. +}
  2938. +
  2939. static int tegra_fuse_probe(struct platform_device *pdev)
  2940. {
  2941. void __iomem *base = fuse->base;
  2942. @@ -398,6 +410,7 @@ static int __init tegra_init_fuse(void)
  2943. const struct of_device_id *match;
  2944. struct device_node *np;
  2945. struct resource regs;
  2946. + int err;
  2947. tegra_init_apbmisc();
  2948. @@ -495,15 +508,11 @@ static int __init tegra_init_fuse(void)
  2949. pr_debug("Tegra CPU Speedo ID %d, SoC Speedo ID %d\n",
  2950. tegra_sku_info.cpu_speedo_id, tegra_sku_info.soc_speedo_id);
  2951. - if (fuse->soc->lookups) {
  2952. - size_t size = sizeof(*fuse->lookups) * fuse->soc->num_lookups;
  2953. -
  2954. - fuse->lookups = kmemdup(fuse->soc->lookups, size, GFP_KERNEL);
  2955. - if (fuse->lookups)
  2956. - nvmem_add_cell_lookups(fuse->lookups, fuse->soc->num_lookups);
  2957. - }
  2958. + err = tegra_fuse_add_lookups(fuse);
  2959. + if (err)
  2960. + pr_err("failed to add FUSE lookups\n");
  2961. - return 0;
  2962. + return err;
  2963. }
  2964. early_initcall(tegra_init_fuse);
  2965. --
  2966. 2.44.0
  2967. From 1c4b913a7b389937f3b2d69d5bcdef4b6ebada14 Mon Sep 17 00:00:00 2001
  2968. From: Kartik <[email protected]>
  2969. Date: Tue, 17 Oct 2023 10:53:20 +0530
  2970. Subject: [PATCH] soc/tegra: fuse: Add function to print SKU info
  2971. Add helper function tegra_fuse_print_sku_info() to print Tegra SKU
  2972. information. So, it can be shared between tegra_fuse_init() and
  2973. ACPI probe which is to be introduced later.
  2974. Signed-off-by: Kartik <[email protected]>
  2975. Signed-off-by: Thierry Reding <[email protected]>
  2976. ---
  2977. drivers/soc/tegra/fuse/fuse-tegra.c | 17 +++++++++++------
  2978. 1 file changed, 11 insertions(+), 6 deletions(-)
  2979. diff --git a/drivers/soc/tegra/fuse/fuse-tegra.c b/drivers/soc/tegra/fuse/fuse-tegra.c
  2980. index 4ebb5597a77b..7a93c6512f7b 100644
  2981. --- a/drivers/soc/tegra/fuse/fuse-tegra.c
  2982. +++ b/drivers/soc/tegra/fuse/fuse-tegra.c
  2983. @@ -113,6 +113,16 @@ static void tegra_fuse_restore(void *base)
  2984. fuse->clk = NULL;
  2985. }
  2986. +static void tegra_fuse_print_sku_info(struct tegra_sku_info *tegra_sku_info)
  2987. +{
  2988. + pr_info("Tegra Revision: %s SKU: %d CPU Process: %d SoC Process: %d\n",
  2989. + tegra_revision_name[tegra_sku_info->revision],
  2990. + tegra_sku_info->sku_id, tegra_sku_info->cpu_process_id,
  2991. + tegra_sku_info->soc_process_id);
  2992. + pr_debug("Tegra CPU Speedo ID %d, SoC Speedo ID %d\n",
  2993. + tegra_sku_info->cpu_speedo_id, tegra_sku_info->soc_speedo_id);
  2994. +}
  2995. +
  2996. static int tegra_fuse_add_lookups(struct tegra_fuse *fuse)
  2997. {
  2998. fuse->lookups = kmemdup_array(fuse->soc->lookups, sizeof(*fuse->lookups),
  2999. @@ -501,12 +511,7 @@ static int __init tegra_init_fuse(void)
  3000. fuse->soc->init(fuse);
  3001. - pr_info("Tegra Revision: %s SKU: %d CPU Process: %d SoC Process: %d\n",
  3002. - tegra_revision_name[tegra_sku_info.revision],
  3003. - tegra_sku_info.sku_id, tegra_sku_info.cpu_process_id,
  3004. - tegra_sku_info.soc_process_id);
  3005. - pr_debug("Tegra CPU Speedo ID %d, SoC Speedo ID %d\n",
  3006. - tegra_sku_info.cpu_speedo_id, tegra_sku_info.soc_speedo_id);
  3007. + tegra_fuse_print_sku_info(&tegra_sku_info);
  3008. err = tegra_fuse_add_lookups(fuse);
  3009. if (err)
  3010. --
  3011. 2.44.0
  3012. From b89bfe274e7a49db3b69108037c2fefc50ebec5b Mon Sep 17 00:00:00 2001
  3013. From: Kartik <[email protected]>
  3014. Date: Tue, 17 Oct 2023 10:53:21 +0530
  3015. Subject: [PATCH] soc/tegra: fuse: Add ACPI support for Tegra194 and Tegra234
  3016. Add ACPI support for Tegra194 & Tegra243 SoC's. This requires
  3017. following modifications to the probe when ACPI boot is used:
  3018. - Initialize soc data.
  3019. - Add nvmem lookups.
  3020. - Register soc device.
  3021. - use devm_clk_get_optional() instead of devm_clk_get() to get
  3022. fuse->clk, as fuse clocks are not required when using ACPI boot.
  3023. Also, drop '__init' keyword for tegra_soc_device_register() as this is also
  3024. used by tegra_fuse_probe() and use dev_err_probe() wherever applicable.
  3025. Signed-off-by: Kartik <[email protected]>
  3026. Signed-off-by: Thierry Reding <[email protected]>
  3027. ---
  3028. drivers/soc/tegra/fuse/fuse-tegra.c | 52 +++++++++++++++++++++++++++--
  3029. 1 file changed, 49 insertions(+), 3 deletions(-)
  3030. diff --git a/drivers/soc/tegra/fuse/fuse-tegra.c b/drivers/soc/tegra/fuse/fuse-tegra.c
  3031. index 7a93c6512f7b..1c758f121f91 100644
  3032. --- a/drivers/soc/tegra/fuse/fuse-tegra.c
  3033. +++ b/drivers/soc/tegra/fuse/fuse-tegra.c
  3034. @@ -3,11 +3,13 @@
  3035. * Copyright (c) 2013-2023, NVIDIA CORPORATION. All rights reserved.
  3036. */
  3037. +#include <linux/acpi.h>
  3038. #include <linux/clk.h>
  3039. #include <linux/device.h>
  3040. #include <linux/kobject.h>
  3041. #include <linux/init.h>
  3042. #include <linux/io.h>
  3043. +#include <linux/mod_devicetable.h>
  3044. #include <linux/nvmem-consumer.h>
  3045. #include <linux/nvmem-provider.h>
  3046. #include <linux/of.h>
  3047. @@ -152,7 +154,38 @@ static int tegra_fuse_probe(struct platform_device *pdev)
  3048. return PTR_ERR(fuse->base);
  3049. fuse->phys = res->start;
  3050. - fuse->clk = devm_clk_get(&pdev->dev, "fuse");
  3051. + /* Initialize the soc data and lookups if using ACPI boot. */
  3052. + if (is_acpi_node(dev_fwnode(&pdev->dev)) && !fuse->soc) {
  3053. + u8 chip;
  3054. +
  3055. + tegra_acpi_init_apbmisc();
  3056. +
  3057. + chip = tegra_get_chip_id();
  3058. + switch (chip) {
  3059. +#if defined(CONFIG_ARCH_TEGRA_194_SOC)
  3060. + case TEGRA194:
  3061. + fuse->soc = &tegra194_fuse_soc;
  3062. + break;
  3063. +#endif
  3064. +#if defined(CONFIG_ARCH_TEGRA_234_SOC)
  3065. + case TEGRA234:
  3066. + fuse->soc = &tegra234_fuse_soc;
  3067. + break;
  3068. +#endif
  3069. + default:
  3070. + return dev_err_probe(&pdev->dev, -EINVAL, "Unsupported SoC: %02x\n", chip);
  3071. + }
  3072. +
  3073. + fuse->soc->init(fuse);
  3074. + tegra_fuse_print_sku_info(&tegra_sku_info);
  3075. + tegra_soc_device_register();
  3076. +
  3077. + err = tegra_fuse_add_lookups(fuse);
  3078. + if (err)
  3079. + return dev_err_probe(&pdev->dev, err, "failed to add FUSE lookups\n");
  3080. + }
  3081. +
  3082. + fuse->clk = devm_clk_get_optional(&pdev->dev, "fuse");
  3083. if (IS_ERR(fuse->clk))
  3084. return dev_err_probe(&pdev->dev, PTR_ERR(fuse->clk), "failed to get FUSE clock\n");
  3085. @@ -275,10 +308,17 @@ static const struct dev_pm_ops tegra_fuse_pm = {
  3086. SET_SYSTEM_SLEEP_PM_OPS(tegra_fuse_suspend, tegra_fuse_resume)
  3087. };
  3088. +static const struct acpi_device_id tegra_fuse_acpi_match[] = {
  3089. + { "NVDA200F" },
  3090. + { /* sentinel */ }
  3091. +};
  3092. +MODULE_DEVICE_TABLE(acpi, tegra_fuse_acpi_match);
  3093. +
  3094. static struct platform_driver tegra_fuse_driver = {
  3095. .driver = {
  3096. .name = "tegra-fuse",
  3097. .of_match_table = tegra_fuse_match,
  3098. + .acpi_match_table = tegra_fuse_acpi_match,
  3099. .pm = &tegra_fuse_pm,
  3100. .suppress_bind_attrs = true,
  3101. },
  3102. @@ -300,7 +340,13 @@ u32 __init tegra_fuse_read_early(unsigned int offset)
  3103. int tegra_fuse_readl(unsigned long offset, u32 *value)
  3104. {
  3105. - if (!fuse->read || !fuse->clk)
  3106. + /*
  3107. + * Wait for fuse->clk to be initialized if device-tree boot is used.
  3108. + */
  3109. + if (is_of_node(dev_fwnode(fuse->dev)) && !fuse->clk)
  3110. + return -EPROBE_DEFER;
  3111. +
  3112. + if (!fuse->read)
  3113. return -EPROBE_DEFER;
  3114. if (IS_ERR(fuse->clk))
  3115. @@ -383,7 +429,7 @@ const struct attribute_group tegra194_soc_attr_group = {
  3116. };
  3117. #endif
  3118. -struct device * __init tegra_soc_device_register(void)
  3119. +struct device *tegra_soc_device_register(void)
  3120. {
  3121. struct soc_device_attribute *attr;
  3122. struct soc_device *dev;
  3123. --
  3124. 2.44.0
  3125. From 4009fd6095c6a524606a098c9557d226d31b3bfe Mon Sep 17 00:00:00 2001
  3126. From: Kartik <[email protected]>
  3127. Date: Tue, 17 Oct 2023 10:53:22 +0530
  3128. Subject: [PATCH] soc/tegra: fuse: Add support for Tegra241
  3129. Add support for Tegra241 which use ACPI boot.
  3130. Signed-off-by: Kartik <[email protected]>
  3131. Signed-off-by: Thierry Reding <[email protected]>
  3132. ---
  3133. drivers/soc/tegra/Kconfig | 5 +++++
  3134. drivers/soc/tegra/fuse/fuse-tegra.c | 5 +++++
  3135. drivers/soc/tegra/fuse/fuse-tegra30.c | 20 ++++++++++++++++++++
  3136. drivers/soc/tegra/fuse/fuse.h | 4 ++++
  3137. drivers/soc/tegra/fuse/tegra-apbmisc.c | 1 +
  3138. include/soc/tegra/fuse.h | 1 +
  3139. 6 files changed, 36 insertions(+)
  3140. diff --git a/drivers/soc/tegra/Kconfig b/drivers/soc/tegra/Kconfig
  3141. index 6f3098822969..5f5d9d663fef 100644
  3142. --- a/drivers/soc/tegra/Kconfig
  3143. +++ b/drivers/soc/tegra/Kconfig
  3144. @@ -133,6 +133,11 @@ config ARCH_TEGRA_234_SOC
  3145. help
  3146. Enable support for the NVIDIA Tegra234 SoC.
  3147. +config ARCH_TEGRA_241_SOC
  3148. + bool "NVIDIA Tegra241 SoC"
  3149. + help
  3150. + Enable support for the NVIDIA Tegra241 SoC.
  3151. +
  3152. endif
  3153. endif
  3154. diff --git a/drivers/soc/tegra/fuse/fuse-tegra.c b/drivers/soc/tegra/fuse/fuse-tegra.c
  3155. index 1c758f121f91..233b8e7bb41b 100644
  3156. --- a/drivers/soc/tegra/fuse/fuse-tegra.c
  3157. +++ b/drivers/soc/tegra/fuse/fuse-tegra.c
  3158. @@ -171,6 +171,11 @@ static int tegra_fuse_probe(struct platform_device *pdev)
  3159. case TEGRA234:
  3160. fuse->soc = &tegra234_fuse_soc;
  3161. break;
  3162. +#endif
  3163. +#if defined(CONFIG_ARCH_TEGRA_241_SOC)
  3164. + case TEGRA241:
  3165. + fuse->soc = &tegra241_fuse_soc;
  3166. + break;
  3167. #endif
  3168. default:
  3169. return dev_err_probe(&pdev->dev, -EINVAL, "Unsupported SoC: %02x\n", chip);
  3170. diff --git a/drivers/soc/tegra/fuse/fuse-tegra30.c b/drivers/soc/tegra/fuse/fuse-tegra30.c
  3171. index e94d46372a63..2070d36c510d 100644
  3172. --- a/drivers/soc/tegra/fuse/fuse-tegra30.c
  3173. +++ b/drivers/soc/tegra/fuse/fuse-tegra30.c
  3174. @@ -678,3 +678,23 @@ const struct tegra_fuse_soc tegra234_fuse_soc = {
  3175. .clk_suspend_on = false,
  3176. };
  3177. #endif
  3178. +
  3179. +#if defined(CONFIG_ARCH_TEGRA_241_SOC)
  3180. +static const struct tegra_fuse_info tegra241_fuse_info = {
  3181. + .read = tegra30_fuse_read,
  3182. + .size = 0x16008,
  3183. + .spare = 0xcf0,
  3184. +};
  3185. +
  3186. +static const struct nvmem_keepout tegra241_fuse_keepouts[] = {
  3187. + { .start = 0xc, .end = 0x1600c }
  3188. +};
  3189. +
  3190. +const struct tegra_fuse_soc tegra241_fuse_soc = {
  3191. + .init = tegra30_fuse_init,
  3192. + .info = &tegra241_fuse_info,
  3193. + .keepouts = tegra241_fuse_keepouts,
  3194. + .num_keepouts = ARRAY_SIZE(tegra241_fuse_keepouts),
  3195. + .soc_attr_group = &tegra194_soc_attr_group,
  3196. +};
  3197. +#endif
  3198. diff --git a/drivers/soc/tegra/fuse/fuse.h b/drivers/soc/tegra/fuse/fuse.h
  3199. index a41e9f85281a..f3b705327c20 100644
  3200. --- a/drivers/soc/tegra/fuse/fuse.h
  3201. +++ b/drivers/soc/tegra/fuse/fuse.h
  3202. @@ -136,4 +136,8 @@ extern const struct tegra_fuse_soc tegra194_fuse_soc;
  3203. extern const struct tegra_fuse_soc tegra234_fuse_soc;
  3204. #endif
  3205. +#ifdef CONFIG_ARCH_TEGRA_241_SOC
  3206. +extern const struct tegra_fuse_soc tegra241_fuse_soc;
  3207. +#endif
  3208. +
  3209. #endif
  3210. diff --git a/drivers/soc/tegra/fuse/tegra-apbmisc.c b/drivers/soc/tegra/fuse/tegra-apbmisc.c
  3211. index 6457f80821bb..e2ca5d55fd31 100644
  3212. --- a/drivers/soc/tegra/fuse/tegra-apbmisc.c
  3213. +++ b/drivers/soc/tegra/fuse/tegra-apbmisc.c
  3214. @@ -64,6 +64,7 @@ bool tegra_is_silicon(void)
  3215. switch (tegra_get_chip_id()) {
  3216. case TEGRA194:
  3217. case TEGRA234:
  3218. + case TEGRA241:
  3219. case TEGRA264:
  3220. if (tegra_get_platform() == 0)
  3221. return true;
  3222. diff --git a/include/soc/tegra/fuse.h b/include/soc/tegra/fuse.h
  3223. index 3a513be50243..8f421b9f7585 100644
  3224. --- a/include/soc/tegra/fuse.h
  3225. +++ b/include/soc/tegra/fuse.h
  3226. @@ -17,6 +17,7 @@
  3227. #define TEGRA186 0x18
  3228. #define TEGRA194 0x19
  3229. #define TEGRA234 0x23
  3230. +#define TEGRA241 0x24
  3231. #define TEGRA264 0x26
  3232. #define TEGRA_FUSE_SKU_CALIB_0 0xf0
  3233. --
  3234. 2.44.0
  3235. From 9f3808742d74a477f686fe13ac43daa3680233af Mon Sep 17 00:00:00 2001
  3236. From: Kartik <[email protected]>
  3237. Date: Wed, 20 Dec 2023 11:40:13 +0530
  3238. Subject: [PATCH] soc/tegra: fuse: Define tegra194_soc_attr_group for Tegra241
  3239. Tegra241 SoC data uses tegra194_soc_attr_group, which is only defined
  3240. if config CONFIG_ARCH_TEGRA_194_SOC or CONFIG_ARCH_TEGRA_234_SOC or
  3241. both are enabled. This causes a build failure if both of these configs
  3242. are disabled and CONFIG_ARCH_TEGRA_241_SOC is enabled.
  3243. Define tegra194_soc_attr_group if CONFIG_ARCH_TEGRA_241_SOC is enabled.
  3244. Signed-off-by: Kartik <[email protected]>
  3245. Acked-by: Randy Dunlap <[email protected]>
  3246. Tested-by: Randy Dunlap <[email protected]> # build-tested
  3247. Signed-off-by: Thierry Reding <[email protected]>
  3248. ---
  3249. drivers/soc/tegra/fuse/fuse-tegra.c | 3 ++-
  3250. drivers/soc/tegra/fuse/fuse.h | 3 ++-
  3251. 2 files changed, 4 insertions(+), 2 deletions(-)
  3252. diff --git a/drivers/soc/tegra/fuse/fuse-tegra.c b/drivers/soc/tegra/fuse/fuse-tegra.c
  3253. index 233b8e7bb41b..c34efa5bf44c 100644
  3254. --- a/drivers/soc/tegra/fuse/fuse-tegra.c
  3255. +++ b/drivers/soc/tegra/fuse/fuse-tegra.c
  3256. @@ -407,7 +407,8 @@ const struct attribute_group tegra_soc_attr_group = {
  3257. };
  3258. #if IS_ENABLED(CONFIG_ARCH_TEGRA_194_SOC) || \
  3259. - IS_ENABLED(CONFIG_ARCH_TEGRA_234_SOC)
  3260. + IS_ENABLED(CONFIG_ARCH_TEGRA_234_SOC) || \
  3261. + IS_ENABLED(CONFIG_ARCH_TEGRA_241_SOC)
  3262. static ssize_t platform_show(struct device *dev, struct device_attribute *attr,
  3263. char *buf)
  3264. {
  3265. diff --git a/drivers/soc/tegra/fuse/fuse.h b/drivers/soc/tegra/fuse/fuse.h
  3266. index f3b705327c20..9fee6ad6ad9e 100644
  3267. --- a/drivers/soc/tegra/fuse/fuse.h
  3268. +++ b/drivers/soc/tegra/fuse/fuse.h
  3269. @@ -124,7 +124,8 @@ extern const struct tegra_fuse_soc tegra186_fuse_soc;
  3270. #endif
  3271. #if IS_ENABLED(CONFIG_ARCH_TEGRA_194_SOC) || \
  3272. - IS_ENABLED(CONFIG_ARCH_TEGRA_234_SOC)
  3273. + IS_ENABLED(CONFIG_ARCH_TEGRA_234_SOC) || \
  3274. + IS_ENABLED(CONFIG_ARCH_TEGRA_241_SOC)
  3275. extern const struct attribute_group tegra194_soc_attr_group;
  3276. #endif
  3277. --
  3278. 2.44.0
  3279. From 6f4afa855941eec29f95a5facc3af8ceda9fc613 Mon Sep 17 00:00:00 2001
  3280. From: Jon Hunter <[email protected]>
  3281. Date: Fri, 16 Feb 2024 11:57:48 +0000
  3282. Subject: [PATCH] arm64: tegra: Fix Tegra234 MGBE power-domains
  3283. The MGBE power-domains on Tegra234 are mapped to the MGBE controllers as
  3284. follows:
  3285. MGBE0 (0x68000000) --> Power-Domain MGBEB
  3286. MGBE1 (0x69000000) --> Power-Domain MGBEC
  3287. MGBE2 (0x6a000000) --> Power-Domain MGBED
  3288. Update the device-tree nodes for Tegra234 to correct this.
  3289. Fixes: 610cdf3186bc ("arm64: tegra: Add MGBE nodes on Tegra234")
  3290. Signed-off-by: Jon Hunter <[email protected]>
  3291. Signed-off-by: Thierry Reding <[email protected]>
  3292. ---
  3293. arch/arm64/boot/dts/nvidia/tegra234.dtsi | 6 +++---
  3294. 1 file changed, 3 insertions(+), 3 deletions(-)
  3295. diff --git a/arch/arm64/boot/dts/nvidia/tegra234.dtsi b/arch/arm64/boot/dts/nvidia/tegra234.dtsi
  3296. index 3f16595d099c..d1bd328892af 100644
  3297. --- a/arch/arm64/boot/dts/nvidia/tegra234.dtsi
  3298. +++ b/arch/arm64/boot/dts/nvidia/tegra234.dtsi
  3299. @@ -1459,7 +1459,7 @@ ethernet@6800000 {
  3300. <&mc TEGRA234_MEMORY_CLIENT_MGBEAWR &emc>;
  3301. interconnect-names = "dma-mem", "write";
  3302. iommus = <&smmu_niso0 TEGRA234_SID_MGBE>;
  3303. - power-domains = <&bpmp TEGRA234_POWER_DOMAIN_MGBEA>;
  3304. + power-domains = <&bpmp TEGRA234_POWER_DOMAIN_MGBEB>;
  3305. status = "disabled";
  3306. };
  3307. @@ -1493,7 +1493,7 @@ ethernet@6900000 {
  3308. <&mc TEGRA234_MEMORY_CLIENT_MGBEBWR &emc>;
  3309. interconnect-names = "dma-mem", "write";
  3310. iommus = <&smmu_niso0 TEGRA234_SID_MGBE_VF1>;
  3311. - power-domains = <&bpmp TEGRA234_POWER_DOMAIN_MGBEB>;
  3312. + power-domains = <&bpmp TEGRA234_POWER_DOMAIN_MGBEC>;
  3313. status = "disabled";
  3314. };
  3315. @@ -1527,7 +1527,7 @@ ethernet@6a00000 {
  3316. <&mc TEGRA234_MEMORY_CLIENT_MGBECWR &emc>;
  3317. interconnect-names = "dma-mem", "write";
  3318. iommus = <&smmu_niso0 TEGRA234_SID_MGBE_VF2>;
  3319. - power-domains = <&bpmp TEGRA234_POWER_DOMAIN_MGBEC>;
  3320. + power-domains = <&bpmp TEGRA234_POWER_DOMAIN_MGBED>;
  3321. status = "disabled";
  3322. };
  3323. --
  3324. 2.44.0