12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188318931903191319231933194319531963197319831993200320132023203320432053206320732083209321032113212321332143215321632173218321932203221322232233224322532263227322832293230323132323233323432353236323732383239324032413242324332443245324632473248324932503251325232533254325532563257325832593260326132623263326432653266326732683269327032713272327332743275327632773278327932803281328232833284328532863287328832893290329132923293329432953296329732983299330033013302330333043305330633073308330933103311331233133314331533163317331833193320332133223323332433253326332733283329333033313332333333343335333633373338333933403341334233433344334533463347334833493350335133523353335433553356335733583359336033613362336333643365336633673368336933703371337233733374337533763377337833793380338133823383338433853386338733883389339033913392339333943395339633973398339934003401340234033404340534063407340834093410341134123413341434153416341734183419342034213422342334243425342634273428342934303431343234333434343534363437343834393440344134423443344434453446344734483449345034513452345334543455345634573458345934603461346234633464346534663467346834693470347134723473347434753476347734783479348034813482348334843485348634873488348934903491349234933494349534963497349834993500350135023503350435053506350735083509351035113512351335143515351635173518351935203521352235233524352535263527352835293530353135323533353435353536353735383539354035413542354335443545354635473548354935503551355235533554355535563557355835593560356135623563356435653566356735683569357035713572357335743575357635773578357935803581358235833584358535863587358835893590359135923593359435953596359735983599360036013602360336043605360636073608360936103611361236133614361536163617361836193620362136223623362436253626362736283629363036313632363336343635363636373638363936403641364236433644364536463647364836493650365136523653365436553656365736583659366036613662366336643665366636673668366936703671367236733674367536763677367836793680368136823683368436853686368736883689369036913692369336943695369636973698369937003701370237033704370537063707370837093710371137123713371437153716371737183719372037213722372337243725372637273728372937303731 |
- From 5b78b500a9ef076594ed5d17fd1b4b21ad7c01c8 Mon Sep 17 00:00:00 2001
- From: Thierry Reding <[email protected]>
- Date: Wed, 12 Jun 2019 17:45:53 +0200
- Subject: [PATCH] rtc: tegra: Implement suspend clock source
- The suspend clock source for Tegra210 and earlier is currently
- implemented in the Tegra timer driver. However, the suspend clock source
- code accesses registers that are part of the RTC hardware block, so both
- can step on each others' toes. In practice this isn't an issue, but
- there is no reason why the RTC driver can't implement the clock source,
- so move the code over to the tegra-rtc driver.
- Signed-off-by: Thierry Reding <[email protected]>
- ---
- drivers/clocksource/timer-tegra.c | 44 -------------------------------
- drivers/rtc/rtc-tegra.c | 42 +++++++++++++++++++++++++++++
- 2 files changed, 42 insertions(+), 44 deletions(-)
- diff --git a/drivers/clocksource/timer-tegra.c b/drivers/clocksource/timer-tegra.c
- index e9635c25eef4..c15ba84f0bd1 100644
- --- a/drivers/clocksource/timer-tegra.c
- +++ b/drivers/clocksource/timer-tegra.c
- @@ -23,10 +23,6 @@
-
- #include "timer-of.h"
-
- -#define RTC_SECONDS 0x08
- -#define RTC_SHADOW_SECONDS 0x0c
- -#define RTC_MILLISECONDS 0x10
- -
- #define TIMERUS_CNTR_1US 0x10
- #define TIMERUS_USEC_CFG 0x14
- #define TIMERUS_CNTR_FREEZE 0x4c
- @@ -181,34 +177,6 @@ static struct delay_timer tegra_delay_timer = {
- };
- #endif
-
- -static struct timer_of suspend_rtc_to = {
- - .flags = TIMER_OF_BASE | TIMER_OF_CLOCK,
- -};
- -
- -/*
- - * tegra_rtc_read - Reads the Tegra RTC registers
- - * Care must be taken that this function is not called while the
- - * tegra_rtc driver could be executing to avoid race conditions
- - * on the RTC shadow register
- - */
- -static u64 tegra_rtc_read_ms(struct clocksource *cs)
- -{
- - void __iomem *reg_base = timer_of_base(&suspend_rtc_to);
- -
- - u32 ms = readl_relaxed(reg_base + RTC_MILLISECONDS);
- - u32 s = readl_relaxed(reg_base + RTC_SHADOW_SECONDS);
- -
- - return (u64)s * MSEC_PER_SEC + ms;
- -}
- -
- -static struct clocksource suspend_rtc_clocksource = {
- - .name = "tegra_suspend_timer",
- - .rating = 200,
- - .read = tegra_rtc_read_ms,
- - .mask = CLOCKSOURCE_MASK(32),
- - .flags = CLOCK_SOURCE_IS_CONTINUOUS | CLOCK_SOURCE_SUSPEND_NONSTOP,
- -};
- -
- static inline unsigned int tegra_base_for_cpu(int cpu, bool tegra20)
- {
- if (tegra20) {
- @@ -402,15 +370,3 @@ static int __init tegra20_init_timer(struct device_node *np)
- return tegra_init_timer(np, true, rating);
- }
- TIMER_OF_DECLARE(tegra20_timer, "nvidia,tegra20-timer", tegra20_init_timer);
- -
- -static int __init tegra20_init_rtc(struct device_node *np)
- -{
- - int ret;
- -
- - ret = timer_of_init(np, &suspend_rtc_to);
- - if (ret)
- - return ret;
- -
- - return clocksource_register_hz(&suspend_rtc_clocksource, 1000);
- -}
- -TIMER_OF_DECLARE(tegra20_rtc, "nvidia,tegra20-rtc", tegra20_init_rtc);
- diff --git a/drivers/rtc/rtc-tegra.c b/drivers/rtc/rtc-tegra.c
- index 441e0a66b215..000ca81ea0c6 100644
- --- a/drivers/rtc/rtc-tegra.c
- +++ b/drivers/rtc/rtc-tegra.c
- @@ -6,6 +6,7 @@
- */
-
- #include <linux/clk.h>
- +#include <linux/clocksource.h>
- #include <linux/delay.h>
- #include <linux/init.h>
- #include <linux/io.h>
- @@ -52,8 +53,15 @@ struct tegra_rtc_info {
- struct clk *clk;
- int irq; /* alarm and periodic IRQ */
- spinlock_t lock;
- +
- + struct clocksource clksrc;
- };
-
- +static inline struct tegra_rtc_info *to_tegra_rtc(struct clocksource *clksrc)
- +{
- + return container_of(clksrc, struct tegra_rtc_info, clksrc);
- +}
- +
- /*
- * RTC hardware is busy when it is updating its values over AHB once every
- * eight 32 kHz clocks (~250 us). Outside of these updates the CPU is free to
- @@ -268,6 +276,17 @@ static const struct rtc_class_ops tegra_rtc_ops = {
- .alarm_irq_enable = tegra_rtc_alarm_irq_enable,
- };
-
- +static u64 tegra_rtc_read_ms(struct clocksource *clksrc)
- +{
- + struct tegra_rtc_info *info = to_tegra_rtc(clksrc);
- + u32 ms, s;
- +
- + ms = readl_relaxed(info->base + TEGRA_RTC_REG_MILLI_SECONDS);
- + s = readl_relaxed(info->base + TEGRA_RTC_REG_SHADOW_SECONDS);
- +
- + return (u64)s * MSEC_PER_SEC + ms;
- +}
- +
- static const struct of_device_id tegra_rtc_dt_match[] = {
- { .compatible = "nvidia,tegra20-rtc", },
- {}
- @@ -333,6 +352,28 @@ static int tegra_rtc_probe(struct platform_device *pdev)
- if (ret)
- goto disable_clk;
-
- + /*
- + * The Tegra RTC is the only reliable clock source that persists
- + * across an SC7 transition (VDD_CPU and VDD_CORE off) on Tegra210
- + * and earlier. Starting with Tegra186, the ARM v8 architected timer
- + * is in an always on power partition and its reference clock keeps
- + * running during SC7. Therefore, we technically don't need to have
- + * the RTC register as a clock source on Tegra186 and later, but it
- + * doesn't hurt either, so we just register it unconditionally here.
- + */
- + info->clksrc.name = "tegra_rtc";
- + info->clksrc.rating = 200;
- + info->clksrc.read = tegra_rtc_read_ms;
- + info->clksrc.mask = CLOCKSOURCE_MASK(42);
- + info->clksrc.flags = CLOCK_SOURCE_SUSPEND_NONSTOP |
- + CLOCK_SOURCE_IS_CONTINUOUS;
- +
- + ret = clocksource_register_hz(&info->clksrc, 1000);
- + if (ret) {
- + dev_err(&pdev->dev, "failed to register clock source: %d\n", ret);
- + goto disable_clk;
- + }
- +
- dev_notice(&pdev->dev, "Tegra internal Real Time Clock\n");
-
- return 0;
- @@ -346,6 +387,7 @@ static void tegra_rtc_remove(struct platform_device *pdev)
- {
- struct tegra_rtc_info *info = platform_get_drvdata(pdev);
-
- + clocksource_unregister(&info->clksrc);
- clk_disable_unprepare(info->clk);
- }
-
- --
- 2.44.0
- From 358f95ff76d353fb3b0e15ce352777b0729f4211 Mon Sep 17 00:00:00 2001
- From: Jon Hunter <[email protected]>
- Date: Thu, 12 Oct 2023 11:49:09 +0100
- Subject: [PATCH] memory: tegra: Add Tegra234 clients for RCE and VI
- Add the Tegra234 memory client entries for the Real-time Camera Engine
- (RCE) and Video Input (VI) devices.
- Signed-off-by: Jon Hunter <[email protected]>
- Acked-by: Thierry Reding <[email protected]>
- Link: https://lore.kernel.org/r/[email protected]
- Signed-off-by: Krzysztof Kozlowski <[email protected]>
- ---
- drivers/memory/tegra/tegra234.c | 60 +++++++++++++++++++++++++++++++++
- 1 file changed, 60 insertions(+)
- diff --git a/drivers/memory/tegra/tegra234.c b/drivers/memory/tegra/tegra234.c
- index fa40c49b070d..b8a7af2d36c1 100644
- --- a/drivers/memory/tegra/tegra234.c
- +++ b/drivers/memory/tegra/tegra234.c
- @@ -449,6 +449,18 @@ static const struct tegra_mc_client tegra234_mc_clients[] = {
- .security = 0x38c,
- },
- },
- + }, {
- + .id = TEGRA234_MEMORY_CLIENT_VIW,
- + .name = "viw",
- + .bpmp_id = TEGRA_ICC_BPMP_VI,
- + .type = TEGRA_ICC_ISO_VI,
- + .sid = TEGRA234_SID_ISO_VI,
- + .regs = {
- + .sid = {
- + .override = 0x390,
- + .security = 0x394,
- + },
- + },
- }, {
- .id = TEGRA234_MEMORY_CLIENT_NVDECSRD,
- .name = "nvdecsrd",
- @@ -621,6 +633,30 @@ static const struct tegra_mc_client tegra234_mc_clients[] = {
- .security = 0x50c,
- },
- },
- + }, {
- + .id = TEGRA234_MEMORY_CLIENT_VIFALR,
- + .name = "vifalr",
- + .bpmp_id = TEGRA_ICC_BPMP_VIFAL,
- + .type = TEGRA_ICC_ISO_VIFAL,
- + .sid = TEGRA234_SID_ISO_VIFALC,
- + .regs = {
- + .sid = {
- + .override = 0x5e0,
- + .security = 0x5e4,
- + },
- + },
- + }, {
- + .id = TEGRA234_MEMORY_CLIENT_VIFALW,
- + .name = "vifalw",
- + .bpmp_id = TEGRA_ICC_BPMP_VIFAL,
- + .type = TEGRA_ICC_ISO_VIFAL,
- + .sid = TEGRA234_SID_ISO_VIFALC,
- + .regs = {
- + .sid = {
- + .override = 0x5e8,
- + .security = 0x5ec,
- + },
- + },
- }, {
- .id = TEGRA234_MEMORY_CLIENT_DLA0RDA,
- .name = "dla0rda",
- @@ -701,6 +737,30 @@ static const struct tegra_mc_client tegra234_mc_clients[] = {
- .security = 0x62c,
- },
- },
- + }, {
- + .id = TEGRA234_MEMORY_CLIENT_RCER,
- + .name = "rcer",
- + .bpmp_id = TEGRA_ICC_BPMP_RCE,
- + .type = TEGRA_ICC_NISO,
- + .sid = TEGRA234_SID_RCE,
- + .regs = {
- + .sid = {
- + .override = 0x690,
- + .security = 0x694,
- + },
- + },
- + }, {
- + .id = TEGRA234_MEMORY_CLIENT_RCEW,
- + .name = "rcew",
- + .bpmp_id = TEGRA_ICC_BPMP_RCE,
- + .type = TEGRA_ICC_NISO,
- + .sid = TEGRA234_SID_RCE,
- + .regs = {
- + .sid = {
- + .override = 0x698,
- + .security = 0x69c,
- + },
- + },
- }, {
- .id = TEGRA234_MEMORY_CLIENT_PCIE0R,
- .name = "pcie0r",
- --
- 2.44.0
- From 25c7cb88f78928b48fae9e200a55ec0d4db41925 Mon Sep 17 00:00:00 2001
- From: Ninad Malwade <[email protected]>
- Date: Fri, 29 Sep 2023 11:36:49 +0100
- Subject: [PATCH] hwmon: (ina3221) Add support for channel summation disable
- The INA3221 allows the Critical alert pin to be controlled by the
- summation control function. This function adds the single
- shunt-voltage conversions for the desired channels in order to compare
- the combined sum to the programmed limit. The Shunt-Voltage Sum Limit
- register contains the programmed value that is compared to the value in
- the Shunt-Voltage Sum register in order to determine if the total summed
- limit is exceeded. If the shunt-voltage sum limit value is exceeded, the
- Critical alert pin pulls low.
- For the summation limit to have a meaningful value, we have to use the
- same shunt-resistor value on all included channels. Unless equal
- shunt-resistor values are used for each channel, the summation control
- function cannot be used and it is not enabled by the driver.
- To address this, add support to disable the summation of specific
- channels via device tree property "ti,summation-disable". The channel
- which has this property would be excluded from the calculation of
- summation control function.
- For example, summation control function calculates Shunt-Voltage Sum as:
- - input_shunt_voltage_summation = input_shunt_voltage_channel1
- + input_shunt_voltage_channel2
- + input_shunt_voltage_channel3
- If we want the summation to only use channel1 and channel3, we can add
- 'ti,summation-disable' property in device tree node for channel2. Then
- the calculation will skip channel2.
- - input_shunt_voltage_summation = input_shunt_voltage_channel1
- + input_shunt_voltage_channel3
- Note that we only want the channel to be skipped for summation control
- function rather than completely disabled. Therefore, even if we add the
- property 'ti,summation-disable', the channel is still enabled and
- functional.
- Finally, create debugfs entries that display if summation is disabled
- for each of the channels.
- Signed-off-by: Rajkumar Kasirajan <[email protected]>
- Signed-off-by: Ninad Malwade <[email protected]>
- Co-developed-by: Jon Hunter <[email protected]>
- Signed-off-by: Jon Hunter <[email protected]>
- Link: https://lore.kernel.org/r/[email protected]
- Signed-off-by: Guenter Roeck <[email protected]>
- ---
- drivers/hwmon/ina3221.c | 33 ++++++++++++++++++++++++++++++---
- 1 file changed, 30 insertions(+), 3 deletions(-)
- diff --git a/drivers/hwmon/ina3221.c b/drivers/hwmon/ina3221.c
- index 5ab944056ec0..5ffdc94db436 100644
- --- a/drivers/hwmon/ina3221.c
- +++ b/drivers/hwmon/ina3221.c
- @@ -6,6 +6,7 @@
- * Andrew F. Davis <[email protected]>
- */
-
- +#include <linux/debugfs.h>
- #include <linux/hwmon.h>
- #include <linux/hwmon-sysfs.h>
- #include <linux/i2c.h>
- @@ -99,11 +100,13 @@ enum ina3221_channels {
- * @label: label of channel input source
- * @shunt_resistor: shunt resistor value of channel input source
- * @disconnected: connection status of channel input source
- + * @summation_disable: channel summation status of input source
- */
- struct ina3221_input {
- const char *label;
- int shunt_resistor;
- bool disconnected;
- + bool summation_disable;
- };
-
- /**
- @@ -113,8 +116,10 @@ struct ina3221_input {
- * @fields: Register fields of the device
- * @inputs: Array of channel input source specific structures
- * @lock: mutex lock to serialize sysfs attribute accesses
- + * @debugfs: Pointer to debugfs entry for device
- * @reg_config: Register value of INA3221_CONFIG
- * @summation_shunt_resistor: equivalent shunt resistor value for summation
- + * @summation_channel_control: Value written to SCC field in INA3221_MASK_ENABLE
- * @single_shot: running in single-shot operating mode
- */
- struct ina3221_data {
- @@ -123,8 +128,10 @@ struct ina3221_data {
- struct regmap_field *fields[F_MAX_FIELDS];
- struct ina3221_input inputs[INA3221_NUM_CHANNELS];
- struct mutex lock;
- + struct dentry *debugfs;
- u32 reg_config;
- int summation_shunt_resistor;
- + u32 summation_channel_control;
-
- bool single_shot;
- };
- @@ -154,7 +161,8 @@ static inline int ina3221_summation_shunt_resistor(struct ina3221_data *ina)
- int i, shunt_resistor = 0;
-
- for (i = 0; i < INA3221_NUM_CHANNELS; i++) {
- - if (input[i].disconnected || !input[i].shunt_resistor)
- + if (input[i].disconnected || !input[i].shunt_resistor ||
- + input[i].summation_disable)
- continue;
- if (!shunt_resistor) {
- /* Found the reference shunt resistor value */
- @@ -786,6 +794,9 @@ static int ina3221_probe_child_from_dt(struct device *dev,
- /* Save the connected input label if available */
- of_property_read_string(child, "label", &input->label);
-
- + /* summation channel control */
- + input->summation_disable = of_property_read_bool(child, "ti,summation-disable");
- +
- /* Overwrite default shunt resistor value optionally */
- if (!of_property_read_u32(child, "shunt-resistor-micro-ohms", &val)) {
- if (val < 1 || val > INT_MAX) {
- @@ -827,6 +838,7 @@ static int ina3221_probe(struct i2c_client *client)
- struct device *dev = &client->dev;
- struct ina3221_data *ina;
- struct device *hwmon_dev;
- + char name[32];
- int i, ret;
-
- ina = devm_kzalloc(dev, sizeof(*ina), GFP_KERNEL);
- @@ -873,6 +885,10 @@ static int ina3221_probe(struct i2c_client *client)
-
- /* Initialize summation_shunt_resistor for summation channel control */
- ina->summation_shunt_resistor = ina3221_summation_shunt_resistor(ina);
- + for (i = 0; i < INA3221_NUM_CHANNELS; i++) {
- + if (!ina->inputs[i].summation_disable)
- + ina->summation_channel_control |= BIT(14 - i);
- + }
-
- ina->pm_dev = dev;
- mutex_init(&ina->lock);
- @@ -900,6 +916,15 @@ static int ina3221_probe(struct i2c_client *client)
- goto fail;
- }
-
- + scnprintf(name, sizeof(name), "%s-%s", INA3221_DRIVER_NAME, dev_name(dev));
- + ina->debugfs = debugfs_create_dir(name, NULL);
- +
- + for (i = 0; i < INA3221_NUM_CHANNELS; i++) {
- + scnprintf(name, sizeof(name), "in%d_summation_disable", i);
- + debugfs_create_bool(name, 0400, ina->debugfs,
- + &ina->inputs[i].summation_disable);
- + }
- +
- return 0;
-
- fail:
- @@ -918,6 +943,8 @@ static void ina3221_remove(struct i2c_client *client)
- struct ina3221_data *ina = dev_get_drvdata(&client->dev);
- int i;
-
- + debugfs_remove_recursive(ina->debugfs);
- +
- pm_runtime_disable(ina->pm_dev);
- pm_runtime_set_suspended(ina->pm_dev);
-
- @@ -978,13 +1005,13 @@ static int ina3221_resume(struct device *dev)
- /* Initialize summation channel control */
- if (ina->summation_shunt_resistor) {
- /*
- - * Take all three channels into summation by default
- + * Sum only channels that are not disabled for summation.
- * Shunt measurements of disconnected channels should
- * be 0, so it does not matter for summation.
- */
- ret = regmap_update_bits(ina->regmap, INA3221_MASK_ENABLE,
- INA3221_MASK_ENABLE_SCC_MASK,
- - INA3221_MASK_ENABLE_SCC_MASK);
- + ina->summation_channel_control);
- if (ret) {
- dev_err(dev, "Unable to control summation channel\n");
- return ret;
- --
- 2.44.0
- From 25a9a0d4819018096742defddaf6fd6ea237e76f Mon Sep 17 00:00:00 2001
- From: Sumit Gupta <[email protected]>
- Date: Wed, 4 Oct 2023 19:35:36 +0530
- Subject: [PATCH] cpufreq: tegra194: save CPU data to avoid repeated SMP calls
- Currently, we make SMP call on every frequency set request to get the
- physical 'CPU ID' and 'CLUSTER ID' for the target CPU. This change
- optimizes the repeated calls by storing the physical IDs and the per
- core frequency register offset for all CPUs during boot. Later this
- info is used directly when required to set the frequency or read it
- from ACTMON counters.
- Signed-off-by: Sumit Gupta <[email protected]>
- Signed-off-by: Viresh Kumar <[email protected]>
- ---
- drivers/cpufreq/tegra194-cpufreq.c | 79 +++++++++++++++++++-----------
- 1 file changed, 51 insertions(+), 28 deletions(-)
- diff --git a/drivers/cpufreq/tegra194-cpufreq.c b/drivers/cpufreq/tegra194-cpufreq.c
- index 386aed3637b4..f6a8e6cf6d94 100644
- --- a/drivers/cpufreq/tegra194-cpufreq.c
- +++ b/drivers/cpufreq/tegra194-cpufreq.c
- @@ -39,6 +39,12 @@
- /* cpufreq transisition latency */
- #define TEGRA_CPUFREQ_TRANSITION_LATENCY (300 * 1000) /* unit in nanoseconds */
-
- +struct tegra_cpu_data {
- + u32 cpuid;
- + u32 clusterid;
- + void __iomem *freq_core_reg;
- +};
- +
- struct tegra_cpu_ctr {
- u32 cpu;
- u32 coreclk_cnt, last_coreclk_cnt;
- @@ -69,6 +75,7 @@ struct tegra194_cpufreq_data {
- struct cpufreq_frequency_table **bpmp_luts;
- const struct tegra_cpufreq_soc *soc;
- bool icc_dram_bw_scaling;
- + struct tegra_cpu_data *cpu_data;
- };
-
- static struct workqueue_struct *read_counters_wq;
- @@ -116,14 +123,8 @@ static void tegra234_get_cpu_cluster_id(u32 cpu, u32 *cpuid, u32 *clusterid)
- static int tegra234_get_cpu_ndiv(u32 cpu, u32 cpuid, u32 clusterid, u64 *ndiv)
- {
- struct tegra194_cpufreq_data *data = cpufreq_get_driver_data();
- - void __iomem *freq_core_reg;
- - u64 mpidr_id;
- -
- - /* use physical id to get address of per core frequency register */
- - mpidr_id = (clusterid * data->soc->maxcpus_per_cluster) + cpuid;
- - freq_core_reg = SCRATCH_FREQ_CORE_REG(data, mpidr_id);
-
- - *ndiv = readl(freq_core_reg) & NDIV_MASK;
- + *ndiv = readl(data->cpu_data[cpu].freq_core_reg) & NDIV_MASK;
-
- return 0;
- }
- @@ -131,19 +132,10 @@ static int tegra234_get_cpu_ndiv(u32 cpu, u32 cpuid, u32 clusterid, u64 *ndiv)
- static void tegra234_set_cpu_ndiv(struct cpufreq_policy *policy, u64 ndiv)
- {
- struct tegra194_cpufreq_data *data = cpufreq_get_driver_data();
- - void __iomem *freq_core_reg;
- - u32 cpu, cpuid, clusterid;
- - u64 mpidr_id;
- -
- - for_each_cpu_and(cpu, policy->cpus, cpu_online_mask) {
- - data->soc->ops->get_cpu_cluster_id(cpu, &cpuid, &clusterid);
- -
- - /* use physical id to get address of per core frequency register */
- - mpidr_id = (clusterid * data->soc->maxcpus_per_cluster) + cpuid;
- - freq_core_reg = SCRATCH_FREQ_CORE_REG(data, mpidr_id);
- + u32 cpu;
-
- - writel(ndiv, freq_core_reg);
- - }
- + for_each_cpu_and(cpu, policy->cpus, cpu_online_mask)
- + writel(ndiv, data->cpu_data[cpu].freq_core_reg);
- }
-
- /*
- @@ -157,11 +149,10 @@ static void tegra234_read_counters(struct tegra_cpu_ctr *c)
- {
- struct tegra194_cpufreq_data *data = cpufreq_get_driver_data();
- void __iomem *actmon_reg;
- - u32 cpuid, clusterid;
- u64 val;
-
- - data->soc->ops->get_cpu_cluster_id(c->cpu, &cpuid, &clusterid);
- - actmon_reg = CORE_ACTMON_CNTR_REG(data, clusterid, cpuid);
- + actmon_reg = CORE_ACTMON_CNTR_REG(data, data->cpu_data[c->cpu].clusterid,
- + data->cpu_data[c->cpu].cpuid);
-
- val = readq(actmon_reg);
- c->last_refclk_cnt = upper_32_bits(val);
- @@ -357,19 +348,17 @@ static void tegra194_set_cpu_ndiv(struct cpufreq_policy *policy, u64 ndiv)
- static unsigned int tegra194_get_speed(u32 cpu)
- {
- struct tegra194_cpufreq_data *data = cpufreq_get_driver_data();
- + u32 clusterid = data->cpu_data[cpu].clusterid;
- struct cpufreq_frequency_table *pos;
- - u32 cpuid, clusterid;
- unsigned int rate;
- u64 ndiv;
- int ret;
-
- - data->soc->ops->get_cpu_cluster_id(cpu, &cpuid, &clusterid);
- -
- /* reconstruct actual cpu freq using counters */
- rate = tegra194_calculate_speed(cpu);
-
- /* get last written ndiv value */
- - ret = data->soc->ops->get_cpu_ndiv(cpu, cpuid, clusterid, &ndiv);
- + ret = data->soc->ops->get_cpu_ndiv(cpu, data->cpu_data[cpu].cpuid, clusterid, &ndiv);
- if (WARN_ON_ONCE(ret))
- return rate;
-
- @@ -475,13 +464,12 @@ static int tegra194_cpufreq_init(struct cpufreq_policy *policy)
- {
- struct tegra194_cpufreq_data *data = cpufreq_get_driver_data();
- int maxcpus_per_cluster = data->soc->maxcpus_per_cluster;
- + u32 clusterid = data->cpu_data[policy->cpu].clusterid;
- struct cpufreq_frequency_table *freq_table;
- struct cpufreq_frequency_table *bpmp_lut;
- u32 start_cpu, cpu;
- - u32 clusterid;
- int ret;
-
- - data->soc->ops->get_cpu_cluster_id(policy->cpu, NULL, &clusterid);
- if (clusterid >= data->soc->num_clusters || !data->bpmp_luts[clusterid])
- return -EINVAL;
-
- @@ -659,6 +647,28 @@ tegra_cpufreq_bpmp_read_lut(struct platform_device *pdev, struct tegra_bpmp *bpm
- return freq_table;
- }
-
- +static int tegra194_cpufreq_store_physids(unsigned int cpu, struct tegra194_cpufreq_data *data)
- +{
- + int num_cpus = data->soc->maxcpus_per_cluster * data->soc->num_clusters;
- + u32 cpuid, clusterid;
- + u64 mpidr_id;
- +
- + if (cpu > (num_cpus - 1)) {
- + pr_err("cpufreq: wrong num of cpus or clusters in soc data\n");
- + return -EINVAL;
- + }
- +
- + data->soc->ops->get_cpu_cluster_id(cpu, &cpuid, &clusterid);
- +
- + mpidr_id = (clusterid * data->soc->maxcpus_per_cluster) + cpuid;
- +
- + data->cpu_data[cpu].cpuid = cpuid;
- + data->cpu_data[cpu].clusterid = clusterid;
- + data->cpu_data[cpu].freq_core_reg = SCRATCH_FREQ_CORE_REG(data, mpidr_id);
- +
- + return 0;
- +}
- +
- static int tegra194_cpufreq_probe(struct platform_device *pdev)
- {
- const struct tegra_cpufreq_soc *soc;
- @@ -666,6 +676,7 @@ static int tegra194_cpufreq_probe(struct platform_device *pdev)
- struct tegra_bpmp *bpmp;
- struct device *cpu_dev;
- int err, i;
- + u32 cpu;
-
- data = devm_kzalloc(&pdev->dev, sizeof(*data), GFP_KERNEL);
- if (!data)
- @@ -692,6 +703,12 @@ static int tegra194_cpufreq_probe(struct platform_device *pdev)
- return PTR_ERR(data->regs);
- }
-
- + data->cpu_data = devm_kcalloc(&pdev->dev, data->soc->num_clusters *
- + data->soc->maxcpus_per_cluster,
- + sizeof(*data->cpu_data), GFP_KERNEL);
- + if (!data->cpu_data)
- + return -ENOMEM;
- +
- platform_set_drvdata(pdev, data);
-
- bpmp = tegra_bpmp_get(&pdev->dev);
- @@ -713,6 +730,12 @@ static int tegra194_cpufreq_probe(struct platform_device *pdev)
- }
- }
-
- + for_each_possible_cpu(cpu) {
- + err = tegra194_cpufreq_store_physids(cpu, data);
- + if (err)
- + goto err_free_res;
- + }
- +
- tegra194_cpufreq_driver.driver_data = data;
-
- /* Check for optional OPPv2 and interconnect paths on CPU0 to enable ICC scaling */
- --
- 2.44.0
- From 4bbfa5e4d6e16ed13acff33abc92913428530593 Mon Sep 17 00:00:00 2001
- From: Sumit Gupta <[email protected]>
- Date: Wed, 4 Oct 2023 19:35:37 +0530
- Subject: [PATCH] cpufreq: tegra194: use refclk delta based loop instead of
- udelay
- Use reference clock count based loop instead of "udelay()" for
- sampling of counters to improve the accuracy of re-generated CPU
- frequency. "udelay()" internally calls "WFE" which stops the
- counters and results in bigger delta between the last set freq
- and the re-generated value from counters. The counter sampling
- window used in loop is the minimum number of reference clock
- cycles which is known to give a stable value of CPU frequency.
- The change also helps to reduce the sampling window from "500us"
- to "<50us".
- Suggested-by: Antti Miettinen <[email protected]>
- Signed-off-by: Sumit Gupta <[email protected]>
- Signed-off-by: Viresh Kumar <[email protected]>
- ---
- drivers/cpufreq/tegra194-cpufreq.c | 72 +++++++++++++++++++++++-------
- 1 file changed, 55 insertions(+), 17 deletions(-)
- diff --git a/drivers/cpufreq/tegra194-cpufreq.c b/drivers/cpufreq/tegra194-cpufreq.c
- index f6a8e6cf6d94..9dae6195e0e7 100644
- --- a/drivers/cpufreq/tegra194-cpufreq.c
- +++ b/drivers/cpufreq/tegra194-cpufreq.c
- @@ -5,7 +5,6 @@
-
- #include <linux/cpu.h>
- #include <linux/cpufreq.h>
- -#include <linux/delay.h>
- #include <linux/dma-mapping.h>
- #include <linux/module.h>
- #include <linux/of.h>
- @@ -21,10 +20,11 @@
-
- #define KHZ 1000
- #define REF_CLK_MHZ 408 /* 408 MHz */
- -#define US_DELAY 500
- #define CPUFREQ_TBL_STEP_HZ (50 * KHZ * KHZ)
- #define MAX_CNT ~0U
-
- +#define MAX_DELTA_KHZ 115200
- +
- #define NDIV_MASK 0x1FF
-
- #define CORE_OFFSET(cpu) (cpu * 8)
- @@ -68,6 +68,7 @@ struct tegra_cpufreq_soc {
- int maxcpus_per_cluster;
- unsigned int num_clusters;
- phys_addr_t actmon_cntr_base;
- + u32 refclk_delta_min;
- };
-
- struct tegra194_cpufreq_data {
- @@ -149,6 +150,8 @@ static void tegra234_read_counters(struct tegra_cpu_ctr *c)
- {
- struct tegra194_cpufreq_data *data = cpufreq_get_driver_data();
- void __iomem *actmon_reg;
- + u32 delta_refcnt;
- + int cnt = 0;
- u64 val;
-
- actmon_reg = CORE_ACTMON_CNTR_REG(data, data->cpu_data[c->cpu].clusterid,
- @@ -157,10 +160,25 @@ static void tegra234_read_counters(struct tegra_cpu_ctr *c)
- val = readq(actmon_reg);
- c->last_refclk_cnt = upper_32_bits(val);
- c->last_coreclk_cnt = lower_32_bits(val);
- - udelay(US_DELAY);
- - val = readq(actmon_reg);
- - c->refclk_cnt = upper_32_bits(val);
- - c->coreclk_cnt = lower_32_bits(val);
- +
- + /*
- + * The sampling window is based on the minimum number of reference
- + * clock cycles which is known to give a stable value of CPU frequency.
- + */
- + do {
- + val = readq(actmon_reg);
- + c->refclk_cnt = upper_32_bits(val);
- + c->coreclk_cnt = lower_32_bits(val);
- + if (c->refclk_cnt < c->last_refclk_cnt)
- + delta_refcnt = c->refclk_cnt + (MAX_CNT - c->last_refclk_cnt);
- + else
- + delta_refcnt = c->refclk_cnt - c->last_refclk_cnt;
- + if (++cnt >= 0xFFFF) {
- + pr_warn("cpufreq: problem with refclk on cpu:%d, delta_refcnt:%u, cnt:%d\n",
- + c->cpu, delta_refcnt, cnt);
- + break;
- + }
- + } while (delta_refcnt < data->soc->refclk_delta_min);
- }
-
- static struct tegra_cpufreq_ops tegra234_cpufreq_ops = {
- @@ -175,6 +193,7 @@ static const struct tegra_cpufreq_soc tegra234_cpufreq_soc = {
- .actmon_cntr_base = 0x9000,
- .maxcpus_per_cluster = 4,
- .num_clusters = 3,
- + .refclk_delta_min = 16000,
- };
-
- static const struct tegra_cpufreq_soc tegra239_cpufreq_soc = {
- @@ -182,6 +201,7 @@ static const struct tegra_cpufreq_soc tegra239_cpufreq_soc = {
- .actmon_cntr_base = 0x4000,
- .maxcpus_per_cluster = 8,
- .num_clusters = 1,
- + .refclk_delta_min = 16000,
- };
-
- static void tegra194_get_cpu_cluster_id(u32 cpu, u32 *cpuid, u32 *clusterid)
- @@ -222,15 +242,33 @@ static inline u32 map_ndiv_to_freq(struct mrq_cpu_ndiv_limits_response
-
- static void tegra194_read_counters(struct tegra_cpu_ctr *c)
- {
- + struct tegra194_cpufreq_data *data = cpufreq_get_driver_data();
- + u32 delta_refcnt;
- + int cnt = 0;
- u64 val;
-
- val = read_freq_feedback();
- c->last_refclk_cnt = lower_32_bits(val);
- c->last_coreclk_cnt = upper_32_bits(val);
- - udelay(US_DELAY);
- - val = read_freq_feedback();
- - c->refclk_cnt = lower_32_bits(val);
- - c->coreclk_cnt = upper_32_bits(val);
- +
- + /*
- + * The sampling window is based on the minimum number of reference
- + * clock cycles which is known to give a stable value of CPU frequency.
- + */
- + do {
- + val = read_freq_feedback();
- + c->refclk_cnt = lower_32_bits(val);
- + c->coreclk_cnt = upper_32_bits(val);
- + if (c->refclk_cnt < c->last_refclk_cnt)
- + delta_refcnt = c->refclk_cnt + (MAX_CNT - c->last_refclk_cnt);
- + else
- + delta_refcnt = c->refclk_cnt - c->last_refclk_cnt;
- + if (++cnt >= 0xFFFF) {
- + pr_warn("cpufreq: problem with refclk on cpu:%d, delta_refcnt:%u, cnt:%d\n",
- + c->cpu, delta_refcnt, cnt);
- + break;
- + }
- + } while (delta_refcnt < data->soc->refclk_delta_min);
- }
-
- static void tegra_read_counters(struct work_struct *work)
- @@ -288,9 +326,8 @@ static unsigned int tegra194_calculate_speed(u32 cpu)
- u32 rate_mhz;
-
- /*
- - * udelay() is required to reconstruct cpu frequency over an
- - * observation window. Using workqueue to call udelay() with
- - * interrupts enabled.
- + * Reconstruct cpu frequency over an observation/sampling window.
- + * Using workqueue to keep interrupts enabled during the interval.
- */
- read_counters_work.c.cpu = cpu;
- INIT_WORK_ONSTACK(&read_counters_work.work, tegra_read_counters);
- @@ -372,9 +409,9 @@ static unsigned int tegra194_get_speed(u32 cpu)
- if (pos->driver_data != ndiv)
- continue;
-
- - if (abs(pos->frequency - rate) > 115200) {
- - pr_warn("cpufreq: cpu%d,cur:%u,set:%u,set ndiv:%llu\n",
- - cpu, rate, pos->frequency, ndiv);
- + if (abs(pos->frequency - rate) > MAX_DELTA_KHZ) {
- + pr_warn("cpufreq: cpu%d,cur:%u,set:%u,delta:%d,set ndiv:%llu\n",
- + cpu, rate, pos->frequency, abs(rate - pos->frequency), ndiv);
- } else {
- rate = pos->frequency;
- }
- @@ -568,6 +605,7 @@ static const struct tegra_cpufreq_soc tegra194_cpufreq_soc = {
- .ops = &tegra194_cpufreq_ops,
- .maxcpus_per_cluster = 2,
- .num_clusters = 4,
- + .refclk_delta_min = 16000,
- };
-
- static void tegra194_cpufreq_free_resources(void)
- @@ -684,7 +722,7 @@ static int tegra194_cpufreq_probe(struct platform_device *pdev)
-
- soc = of_device_get_match_data(&pdev->dev);
-
- - if (soc->ops && soc->maxcpus_per_cluster && soc->num_clusters) {
- + if (soc->ops && soc->maxcpus_per_cluster && soc->num_clusters && soc->refclk_delta_min) {
- data->soc = soc;
- } else {
- dev_err(&pdev->dev, "soc data missing\n");
- --
- 2.44.0
- From a9aa1762789716af85861e67349ccb7eedaca61a Mon Sep 17 00:00:00 2001
- From: Sumit Gupta <[email protected]>
- Date: Mon, 9 Oct 2023 13:54:23 +0530
- Subject: [PATCH] cpufreq: tegra194: remove redundant AND with cpu_online_mask
- Remove redundant 'AND' with cpu_online_mask as the policy->cpus always
- contains only the currently online CPUs.
- Suggested-by: Viresh Kumar <[email protected]>
- Link: https://lore.kernel.org/lkml/20231003050019.a6mcchw2o2z2wkrh@vireshk-i7/
- Signed-off-by: Sumit Gupta <[email protected]>
- [ Viresh: Fix rebase conflict ]
- Signed-off-by: Viresh Kumar <[email protected]>
- ---
- drivers/cpufreq/tegra194-cpufreq.c | 2 +-
- 1 file changed, 1 insertion(+), 1 deletion(-)
- diff --git a/drivers/cpufreq/tegra194-cpufreq.c b/drivers/cpufreq/tegra194-cpufreq.c
- index 9dae6195e0e7..59865ea455a8 100644
- --- a/drivers/cpufreq/tegra194-cpufreq.c
- +++ b/drivers/cpufreq/tegra194-cpufreq.c
- @@ -135,7 +135,7 @@ static void tegra234_set_cpu_ndiv(struct cpufreq_policy *policy, u64 ndiv)
- struct tegra194_cpufreq_data *data = cpufreq_get_driver_data();
- u32 cpu;
-
- - for_each_cpu_and(cpu, policy->cpus, cpu_online_mask)
- + for_each_cpu(cpu, policy->cpus)
- writel(ndiv, data->cpu_data[cpu].freq_core_reg);
- }
-
- --
- 2.44.0
- From 2d739084b8bf97d5aa230127cd9de200164641cb Mon Sep 17 00:00:00 2001
- From: Thierry Reding <[email protected]>
- Date: Wed, 1 Nov 2023 18:20:16 +0100
- Subject: [PATCH] fbdev/simplefb: Support memory-region property
- The simple-framebuffer bindings specify that the "memory-region"
- property can be used as an alternative to the "reg" property to define
- the framebuffer memory used by the display hardware. Implement support
- for this in the simplefb driver.
- Reviewed-by: Hans de Goede <[email protected]>
- Signed-off-by: Thierry Reding <[email protected]>
- Signed-off-by: Hans de Goede <[email protected]>
- Link: https://patchwork.freedesktop.org/patch/msgid/[email protected]
- ---
- drivers/video/fbdev/simplefb.c | 35 +++++++++++++++++++++++++++++-----
- 1 file changed, 30 insertions(+), 5 deletions(-)
- diff --git a/drivers/video/fbdev/simplefb.c b/drivers/video/fbdev/simplefb.c
- index 62f99f6fccd3..18025f34fde7 100644
- --- a/drivers/video/fbdev/simplefb.c
- +++ b/drivers/video/fbdev/simplefb.c
- @@ -21,6 +21,7 @@
- #include <linux/platform_device.h>
- #include <linux/clk.h>
- #include <linux/of.h>
- +#include <linux/of_address.h>
- #include <linux/of_clk.h>
- #include <linux/of_platform.h>
- #include <linux/parser.h>
- @@ -121,12 +122,13 @@ struct simplefb_params {
- u32 height;
- u32 stride;
- struct simplefb_format *format;
- + struct resource memory;
- };
-
- static int simplefb_parse_dt(struct platform_device *pdev,
- struct simplefb_params *params)
- {
- - struct device_node *np = pdev->dev.of_node;
- + struct device_node *np = pdev->dev.of_node, *mem;
- int ret;
- const char *format;
- int i;
- @@ -166,6 +168,23 @@ static int simplefb_parse_dt(struct platform_device *pdev,
- return -EINVAL;
- }
-
- + mem = of_parse_phandle(np, "memory-region", 0);
- + if (mem) {
- + ret = of_address_to_resource(mem, 0, ¶ms->memory);
- + if (ret < 0) {
- + dev_err(&pdev->dev, "failed to parse memory-region\n");
- + of_node_put(mem);
- + return ret;
- + }
- +
- + if (of_property_present(np, "reg"))
- + dev_warn(&pdev->dev, "preferring \"memory-region\" over \"reg\" property\n");
- +
- + of_node_put(mem);
- + } else {
- + memset(¶ms->memory, 0, sizeof(params->memory));
- + }
- +
- return 0;
- }
-
- @@ -193,6 +212,8 @@ static int simplefb_parse_pd(struct platform_device *pdev,
- return -EINVAL;
- }
-
- + memset(¶ms->memory, 0, sizeof(params->memory));
- +
- return 0;
- }
-
- @@ -431,10 +452,14 @@ static int simplefb_probe(struct platform_device *pdev)
- if (ret)
- return ret;
-
- - res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
- - if (!res) {
- - dev_err(&pdev->dev, "No memory resource\n");
- - return -EINVAL;
- + if (params.memory.start == 0 && params.memory.end == 0) {
- + res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
- + if (!res) {
- + dev_err(&pdev->dev, "No memory resource\n");
- + return -EINVAL;
- + }
- + } else {
- + res = ¶ms.memory;
- }
-
- mem = request_mem_region(res->start, resource_size(res), "simplefb");
- --
- 2.44.0
- From eda00f6c55deb6824ed12f8451e8079184447f18 Mon Sep 17 00:00:00 2001
- From: Thierry Reding <[email protected]>
- Date: Wed, 1 Nov 2023 18:20:17 +0100
- Subject: [PATCH] fbdev/simplefb: Add support for generic power-domains
- The simple-framebuffer device tree bindings document the power-domains
- property, so make sure that simplefb supports it. This ensures that the
- power domains remain enabled as long as simplefb is active.
- v2: - remove unnecessary call to simplefb_detach_genpds() since that's
- already done automatically by devres
- - fix crash if power-domains property is missing in DT
- Signed-off-by: Thierry Reding <[email protected]>
- Reviewed-by: Hans de Goede <[email protected]>
- Signed-off-by: Hans de Goede <[email protected]>
- Link: https://patchwork.freedesktop.org/patch/msgid/[email protected]
- ---
- drivers/video/fbdev/simplefb.c | 93 ++++++++++++++++++++++++++++++++++
- 1 file changed, 93 insertions(+)
- diff --git a/drivers/video/fbdev/simplefb.c b/drivers/video/fbdev/simplefb.c
- index 18025f34fde7..fe682af63827 100644
- --- a/drivers/video/fbdev/simplefb.c
- +++ b/drivers/video/fbdev/simplefb.c
- @@ -25,6 +25,7 @@
- #include <linux/of_clk.h>
- #include <linux/of_platform.h>
- #include <linux/parser.h>
- +#include <linux/pm_domain.h>
- #include <linux/regulator/consumer.h>
-
- static const struct fb_fix_screeninfo simplefb_fix = {
- @@ -78,6 +79,11 @@ struct simplefb_par {
- unsigned int clk_count;
- struct clk **clks;
- #endif
- +#if defined CONFIG_OF && defined CONFIG_PM_GENERIC_DOMAINS
- + unsigned int num_genpds;
- + struct device **genpds;
- + struct device_link **genpd_links;
- +#endif
- #if defined CONFIG_OF && defined CONFIG_REGULATOR
- bool regulators_enabled;
- u32 regulator_count;
- @@ -432,6 +438,89 @@ static void simplefb_regulators_enable(struct simplefb_par *par,
- static void simplefb_regulators_destroy(struct simplefb_par *par) { }
- #endif
-
- +#if defined CONFIG_OF && defined CONFIG_PM_GENERIC_DOMAINS
- +static void simplefb_detach_genpds(void *res)
- +{
- + struct simplefb_par *par = res;
- + unsigned int i = par->num_genpds;
- +
- + if (par->num_genpds <= 1)
- + return;
- +
- + while (i--) {
- + if (par->genpd_links[i])
- + device_link_del(par->genpd_links[i]);
- +
- + if (!IS_ERR_OR_NULL(par->genpds[i]))
- + dev_pm_domain_detach(par->genpds[i], true);
- + }
- +}
- +
- +static int simplefb_attach_genpds(struct simplefb_par *par,
- + struct platform_device *pdev)
- +{
- + struct device *dev = &pdev->dev;
- + unsigned int i;
- + int err;
- +
- + err = of_count_phandle_with_args(dev->of_node, "power-domains",
- + "#power-domain-cells");
- + if (err < 0) {
- + dev_info(dev, "failed to parse power-domains: %d\n", err);
- + return err;
- + }
- +
- + par->num_genpds = err;
- +
- + /*
- + * Single power-domain devices are handled by the driver core, so
- + * nothing to do here.
- + */
- + if (par->num_genpds <= 1)
- + return 0;
- +
- + par->genpds = devm_kcalloc(dev, par->num_genpds, sizeof(*par->genpds),
- + GFP_KERNEL);
- + if (!par->genpds)
- + return -ENOMEM;
- +
- + par->genpd_links = devm_kcalloc(dev, par->num_genpds,
- + sizeof(*par->genpd_links),
- + GFP_KERNEL);
- + if (!par->genpd_links)
- + return -ENOMEM;
- +
- + for (i = 0; i < par->num_genpds; i++) {
- + par->genpds[i] = dev_pm_domain_attach_by_id(dev, i);
- + if (IS_ERR(par->genpds[i])) {
- + err = PTR_ERR(par->genpds[i]);
- + if (err == -EPROBE_DEFER) {
- + simplefb_detach_genpds(par);
- + return err;
- + }
- +
- + dev_warn(dev, "failed to attach domain %u: %d\n", i, err);
- + continue;
- + }
- +
- + par->genpd_links[i] = device_link_add(dev, par->genpds[i],
- + DL_FLAG_STATELESS |
- + DL_FLAG_PM_RUNTIME |
- + DL_FLAG_RPM_ACTIVE);
- + if (!par->genpd_links[i])
- + dev_warn(dev, "failed to link power-domain %u\n", i);
- + }
- +
- + return devm_add_action_or_reset(dev, simplefb_detach_genpds, par);
- +}
- +#else
- +static int simplefb_attach_genpds(struct simplefb_par *par,
- + struct platform_device *pdev)
- +{
- + return 0;
- +}
- +#endif
- +
- static int simplefb_probe(struct platform_device *pdev)
- {
- int ret;
- @@ -518,6 +607,10 @@ static int simplefb_probe(struct platform_device *pdev)
- if (ret < 0)
- goto error_clocks;
-
- + ret = simplefb_attach_genpds(par, pdev);
- + if (ret < 0)
- + goto error_regulators;
- +
- simplefb_clocks_enable(par, pdev);
- simplefb_regulators_enable(par, pdev);
-
- --
- 2.44.0
- From 7af6e409a0adf6df45a80d23654fd2ea9b23c619 Mon Sep 17 00:00:00 2001
- From: Thierry Reding <[email protected]>
- Date: Fri, 13 Oct 2023 17:51:04 +0200
- Subject: [PATCH] thermal/drivers/max77620: Remove duplicate error message
- The thermal_of_zone_register() function already prints an error message
- when appropriate, so remove the extra one from the MAX77620 thermal
- driver.
- This fixes a spurious error message when no thermal zone was defined
- for the MAX77620 in device tree.
- Reported-by: Nicolas Chauvet <[email protected]>
- Signed-off-by: Thierry Reding <[email protected]>
- Signed-off-by: Daniel Lezcano <[email protected]>
- Link: https://lore.kernel.org/r/[email protected]
- ---
- drivers/thermal/max77620_thermal.c | 8 ++------
- 1 file changed, 2 insertions(+), 6 deletions(-)
- diff --git a/drivers/thermal/max77620_thermal.c b/drivers/thermal/max77620_thermal.c
- index 919b6ee208d8..85a12e98d6dc 100644
- --- a/drivers/thermal/max77620_thermal.c
- +++ b/drivers/thermal/max77620_thermal.c
- @@ -114,12 +114,8 @@ static int max77620_thermal_probe(struct platform_device *pdev)
-
- mtherm->tz_device = devm_thermal_of_zone_register(&pdev->dev, 0,
- mtherm, &max77620_thermal_ops);
- - if (IS_ERR(mtherm->tz_device)) {
- - ret = PTR_ERR(mtherm->tz_device);
- - dev_err(&pdev->dev, "Failed to register thermal zone: %d\n",
- - ret);
- - return ret;
- - }
- + if (IS_ERR(mtherm->tz_device))
- + return PTR_ERR(mtherm->tz_device);
-
- ret = devm_request_threaded_irq(&pdev->dev, mtherm->irq_tjalarm1, NULL,
- max77620_thermal_irq,
- --
- 2.44.0
- From 652292925b6083912c3ffd597811556f2aa5414a Mon Sep 17 00:00:00 2001
- From: Rayyan Ansari <[email protected]>
- Date: Thu, 10 Aug 2023 22:45:41 +0100
- Subject: [PATCH] arm64: tegra: Enable IOMMU for host1x on Tegra132
- Add the iommu property to the host1x node to register it with its
- swgroup.
- Signed-off-by: Rayyan Ansari <[email protected]>
- Signed-off-by: Thierry Reding <[email protected]>
- ---
- arch/arm64/boot/dts/nvidia/tegra132.dtsi | 2 ++
- 1 file changed, 2 insertions(+)
- diff --git a/arch/arm64/boot/dts/nvidia/tegra132.dtsi b/arch/arm64/boot/dts/nvidia/tegra132.dtsi
- index 8b78be8f4f9d..7e24a212c7e4 100644
- --- a/arch/arm64/boot/dts/nvidia/tegra132.dtsi
- +++ b/arch/arm64/boot/dts/nvidia/tegra132.dtsi
- @@ -93,6 +93,8 @@ host1x@50000000 {
- resets = <&tegra_car 28>;
- reset-names = "host1x";
-
- + iommus = <&mc TEGRA_SWGROUP_HC>;
- +
- #address-cells = <2>;
- #size-cells = <2>;
-
- --
- 2.44.0
- From 6539557c68954d2a0038290d596920b597797d47 Mon Sep 17 00:00:00 2001
- From: Thierry Reding <[email protected]>
- Date: Wed, 26 Jul 2023 18:27:38 +0200
- Subject: [PATCH] dt-bindings: arm: tegra: pmc: Improve property descriptions
- Reformat the description of various properties to make them more
- consistent with existing ones. Make use of json-schema's ability to
- provide a description for individual list items to make improve the
- documentation further.
- Reviewed-by: Rob Herring <[email protected]>
- Signed-off-by: Thierry Reding <[email protected]>
- ---
- .../arm/tegra/nvidia,tegra20-pmc.yaml | 212 +++++++++---------
- 1 file changed, 103 insertions(+), 109 deletions(-)
- diff --git a/Documentation/devicetree/bindings/arm/tegra/nvidia,tegra20-pmc.yaml b/Documentation/devicetree/bindings/arm/tegra/nvidia,tegra20-pmc.yaml
- index 89191cfdf619..38fe66142547 100644
- --- a/Documentation/devicetree/bindings/arm/tegra/nvidia,tegra20-pmc.yaml
- +++ b/Documentation/devicetree/bindings/arm/tegra/nvidia,tegra20-pmc.yaml
- @@ -26,12 +26,10 @@ properties:
-
- clock-names:
- items:
- + # Tegra clock of the same name
- - const: pclk
- + # 32 KHz clock input
- - const: clk32k_in
- - description:
- - Must includes entries pclk and clk32k_in.
- - pclk is the Tegra clock of that name and clk32k_in is 32KHz clock
- - input to Tegra.
-
- clocks:
- maxItems: 2
- @@ -41,105 +39,103 @@ properties:
-
- '#clock-cells':
- const: 1
- - description:
- - Tegra PMC has clk_out_1, clk_out_2, and clk_out_3.
- - PMC also has blink control which allows 32Khz clock output to
- - Tegra blink pad.
- - Consumer of PMC clock should specify the desired clock by having
- - the clock ID in its "clocks" phandle cell with pmc clock provider.
- - See include/dt-bindings/soc/tegra-pmc.h for the list of Tegra PMC
- - clock IDs.
- + description: |
- + Tegra PMC has clk_out_1, clk_out_2, and clk_out_3. PMC also has blink
- + control which allows 32Khz clock output to Tegra blink pad.
- +
- + Consumer of PMC clock should specify the desired clock by having the
- + clock ID in its "clocks" phandle cell with PMC clock provider. See
- + include/dt-bindings/soc/tegra-pmc.h for the list of Tegra PMC clock IDs.
-
- '#interrupt-cells':
- const: 2
- - description:
- - Specifies number of cells needed to encode an interrupt source.
- - The value must be 2.
- + description: Specifies number of cells needed to encode an interrupt
- + source.
-
- interrupt-controller: true
-
- nvidia,invert-interrupt:
- $ref: /schemas/types.yaml#/definitions/flag
- - description: Inverts the PMU interrupt signal.
- - The PMU is an external Power Management Unit, whose interrupt output
- - signal is fed into the PMC. This signal is optionally inverted, and
- - then fed into the ARM GIC. The PMC is not involved in the detection
- - or handling of this interrupt signal, merely its inversion.
- + description: Inverts the PMU interrupt signal. The PMU is an external Power
- + Management Unit, whose interrupt output signal is fed into the PMC. This
- + signal is optionally inverted, and then fed into the ARM GIC. The PMC is
- + not involved in the detection or handling of this interrupt signal,
- + merely its inversion.
-
- nvidia,core-power-req-active-high:
- $ref: /schemas/types.yaml#/definitions/flag
- - description: Core power request active-high.
- + description: core power request active-high
-
- nvidia,sys-clock-req-active-high:
- $ref: /schemas/types.yaml#/definitions/flag
- - description: System clock request active-high.
- + description: system clock request active-high
-
- nvidia,combined-power-req:
- $ref: /schemas/types.yaml#/definitions/flag
- - description: combined power request for CPU and Core.
- + description: combined power request for CPU and core
-
- nvidia,cpu-pwr-good-en:
- $ref: /schemas/types.yaml#/definitions/flag
- - description:
- - CPU power good signal from external PMIC to PMC is enabled.
- + description: CPU power good signal from external PMIC to PMC is enabled
-
- nvidia,suspend-mode:
- $ref: /schemas/types.yaml#/definitions/uint32
- - enum: [0, 1, 2]
- - description:
- - The suspend mode that the platform should use.
- - Mode 0 is for LP0, CPU + Core voltage off and DRAM in self-refresh
- - Mode 1 is for LP1, CPU voltage off and DRAM in self-refresh
- - Mode 2 is for LP2, CPU voltage off
- + description: the suspend mode that the platform should use
- + oneOf:
- + - description: LP0, CPU + Core voltage off and DRAM in self-refresh
- + const: 0
- + - description: LP1, CPU voltage off and DRAM in self-refresh
- + const: 1
- + - description: LP2, CPU voltage off
- + const: 2
-
- nvidia,cpu-pwr-good-time:
- $ref: /schemas/types.yaml#/definitions/uint32
- - description: CPU power good time in uSec.
- + description: CPU power good time in microseconds
-
- nvidia,cpu-pwr-off-time:
- $ref: /schemas/types.yaml#/definitions/uint32
- - description: CPU power off time in uSec.
- + description: CPU power off time in microseconds
-
- nvidia,core-pwr-good-time:
- $ref: /schemas/types.yaml#/definitions/uint32-array
- - description:
- - <Oscillator-stable-time Power-stable-time>
- - Core power good time in uSec.
- + description: core power good time in microseconds
- + items:
- + - description: oscillator stable time
- + - description: power stable time
-
- nvidia,core-pwr-off-time:
- $ref: /schemas/types.yaml#/definitions/uint32
- - description: Core power off time in uSec.
- + description: core power off time in microseconds
-
- nvidia,lp0-vec:
- $ref: /schemas/types.yaml#/definitions/uint32-array
- - description:
- - <start length> Starting address and length of LP0 vector.
- - The LP0 vector contains the warm boot code that is executed
- - by AVP when resuming from the LP0 state.
- - The AVP (Audio-Video Processor) is an ARM7 processor and
- - always being the first boot processor when chip is power on
- - or resume from deep sleep mode. When the system is resumed
- - from the deep sleep mode, the warm boot code will restore
- - some PLLs, clocks and then brings up CPU0 for resuming the
- - system.
- + description: |
- + Starting address and length of LP0 vector. The LP0 vector contains the
- + warm boot code that is executed by AVP when resuming from the LP0 state.
- + The AVP (Audio-Video Processor) is an ARM7 processor and always being
- + the first boot processor when chip is power on or resume from deep sleep
- + mode. When the system is resumed from the deep sleep mode, the warm boot
- + code will restore some PLLs, clocks and then brings up CPU0 for resuming
- + the system.
- + items:
- + - description: starting address of LP0 vector
- + - description: length of LP0 vector
-
- core-supply:
- - description:
- - Phandle to voltage regulator connected to the SoC Core power rail.
- + description: phandle to voltage regulator connected to the SoC core power
- + rail
-
- core-domain:
- type: object
- - description: |
- - The vast majority of hardware blocks of Tegra SoC belong to a
- - Core power domain, which has a dedicated voltage rail that powers
- - the blocks.
- -
- + description: The vast majority of hardware blocks of Tegra SoC belong to a
- + core power domain, which has a dedicated voltage rail that powers the
- + blocks.
- properties:
- operating-points-v2:
- - description:
- - Should contain level, voltages and opp-supported-hw property.
- - The supported-hw is a bitfield indicating SoC speedo or process
- - ID mask.
- + description: Should contain level, voltages and opp-supported-hw
- + property. The supported-hw is a bitfield indicating SoC speedo or
- + process ID mask.
-
- "#power-domain-cells":
- const: 0
- @@ -152,37 +148,32 @@ properties:
-
- i2c-thermtrip:
- type: object
- - description:
- - On Tegra30, Tegra114 and Tegra124 if i2c-thermtrip subnode exists,
- - hardware-triggered thermal reset will be enabled.
- -
- + description: On Tegra30, Tegra114 and Tegra124 if i2c-thermtrip subnode
- + exists, hardware-triggered thermal reset will be enabled.
- properties:
- nvidia,i2c-controller-id:
- $ref: /schemas/types.yaml#/definitions/uint32
- - description:
- - ID of I2C controller to send poweroff command to PMU.
- - Valid values are described in section 9.2.148
- - "APBDEV_PMC_SCRATCH53_0" of the Tegra K1 Technical Reference
- - Manual.
- + description: ID of I2C controller to send poweroff command to PMU.
- + Valid values are described in section 9.2.148 "APBDEV_PMC_SCRATCH53_0"
- + of the Tegra K1 Technical Reference Manual.
-
- nvidia,bus-addr:
- $ref: /schemas/types.yaml#/definitions/uint32
- - description: Bus address of the PMU on the I2C bus.
- + description: bus address of the PMU on the I2C bus
-
- nvidia,reg-addr:
- $ref: /schemas/types.yaml#/definitions/uint32
- - description: PMU I2C register address to issue poweroff command.
- + description: PMU I2C register address to issue poweroff command
-
- nvidia,reg-data:
- $ref: /schemas/types.yaml#/definitions/uint32
- - description: Poweroff command to write to PMU.
- + description: power-off command to write to PMU
-
- nvidia,pinmux-id:
- $ref: /schemas/types.yaml#/definitions/uint32
- - description:
- - Pinmux used by the hardware when issuing Poweroff command.
- - Defaults to 0. Valid values are described in section 12.5.2
- - "Pinmux Support" of the Tegra4 Technical Reference Manual.
- + description: Pinmux used by the hardware when issuing power-off command.
- + Defaults to 0. Valid values are described in section 12.5.2 "Pinmux
- + Support" of the Tegra4 Technical Reference Manual.
-
- required:
- - nvidia,i2c-controller-id
- @@ -195,41 +186,44 @@ properties:
- powergates:
- type: object
- description: |
- - This node contains a hierarchy of power domain nodes, which should
- - match the powergates on the Tegra SoC. Each powergate node
- - represents a power-domain on the Tegra SoC that can be power-gated
- - by the Tegra PMC.
- - Hardware blocks belonging to a power domain should contain
- - "power-domains" property that is a phandle pointing to corresponding
- - powergate node.
- - The name of the powergate node should be one of the below. Note that
- - not every powergate is applicable to all Tegra devices and the following
- - list shows which powergates are applicable to which devices.
- - Please refer to Tegra TRM for mode details on the powergate nodes to
- - use for each power-gate block inside Tegra.
- - Name Description Devices Applicable
- - 3d 3D Graphics Tegra20/114/124/210
- - 3d0 3D Graphics 0 Tegra30
- - 3d1 3D Graphics 1 Tegra30
- - aud Audio Tegra210
- - dfd Debug Tegra210
- - dis Display A Tegra114/124/210
- - disb Display B Tegra114/124/210
- - heg 2D Graphics Tegra30/114/124/210
- - iram Internal RAM Tegra124/210
- - mpe MPEG Encode All
- - nvdec NVIDIA Video Decode Engine Tegra210
- - nvjpg NVIDIA JPEG Engine Tegra210
- - pcie PCIE Tegra20/30/124/210
- - sata SATA Tegra30/124/210
- - sor Display interfaces Tegra124/210
- - ve2 Video Encode Engine 2 Tegra210
- - venc Video Encode Engine All
- - vdec Video Decode Engine Tegra20/30/114/124
- - vic Video Imaging Compositor Tegra124/210
- - xusba USB Partition A Tegra114/124/210
- - xusbb USB Partition B Tegra114/124/210
- - xusbc USB Partition C Tegra114/124/210
- + This node contains a hierarchy of power domain nodes, which should match
- + the powergates on the Tegra SoC. Each powergate node represents a power-
- + domain on the Tegra SoC that can be power-gated by the Tegra PMC.
- +
- + Hardware blocks belonging to a power domain should contain "power-domains"
- + property that is a phandle pointing to corresponding powergate node.
- +
- + The name of the powergate node should be one of the below. Note that not
- + every powergate is applicable to all Tegra devices and the following list
- + shows which powergates are applicable to which devices.
- +
- + Please refer to Tegra TRM for mode details on the powergate nodes to use
- + for each power-gate block inside Tegra.
- +
- + Name Description Devices Applicable
- + --------------------------------------------------------------
- + 3d 3D Graphics Tegra20/114/124/210
- + 3d0 3D Graphics 0 Tegra30
- + 3d1 3D Graphics 1 Tegra30
- + aud Audio Tegra210
- + dfd Debug Tegra210
- + dis Display A Tegra114/124/210
- + disb Display B Tegra114/124/210
- + heg 2D Graphics Tegra30/114/124/210
- + iram Internal RAM Tegra124/210
- + mpe MPEG Encode All
- + nvdec NVIDIA Video Decode Engine Tegra210
- + nvjpg NVIDIA JPEG Engine Tegra210
- + pcie PCIE Tegra20/30/124/210
- + sata SATA Tegra30/124/210
- + sor Display interfaces Tegra124/210
- + ve2 Video Encode Engine 2 Tegra210
- + venc Video Encode Engine All
- + vdec Video Decode Engine Tegra20/30/114/124
- + vic Video Imaging Compositor Tegra124/210
- + xusba USB Partition A Tegra114/124/210
- + xusbb USB Partition B Tegra114/124/210
- + xusbc USB Partition C Tegra114/124/210
-
- patternProperties:
- "^[a-z0-9]+$":
- --
- 2.44.0
- From 97b2d1274a657915726c3a579781769aebfac0fe Mon Sep 17 00:00:00 2001
- From: Thierry Reding <[email protected]>
- Date: Wed, 26 Jul 2023 18:27:39 +0200
- Subject: [PATCH] dt-bindings: arm: tegra: pmc: Remove useless boilerplate
- descriptions
- The descriptions for the clocks and resets properties are no longer
- useful in the context of json-schema, so drop them.
- Reviewed-by: Rob Herring <[email protected]>
- Signed-off-by: Thierry Reding <[email protected]>
- ---
- .../bindings/arm/tegra/nvidia,tegra20-pmc.yaml | 13 -------------
- 1 file changed, 13 deletions(-)
- diff --git a/Documentation/devicetree/bindings/arm/tegra/nvidia,tegra20-pmc.yaml b/Documentation/devicetree/bindings/arm/tegra/nvidia,tegra20-pmc.yaml
- index 38fe66142547..0ac258bc7be0 100644
- --- a/Documentation/devicetree/bindings/arm/tegra/nvidia,tegra20-pmc.yaml
- +++ b/Documentation/devicetree/bindings/arm/tegra/nvidia,tegra20-pmc.yaml
- @@ -21,8 +21,6 @@ properties:
-
- reg:
- maxItems: 1
- - description:
- - Offset and length of the register set for the device.
-
- clock-names:
- items:
- @@ -33,9 +31,6 @@ properties:
-
- clocks:
- maxItems: 2
- - description:
- - Must contain an entry for each entry in clock-names.
- - See ../clocks/clocks-bindings.txt for details.
-
- '#clock-cells':
- const: 1
- @@ -234,18 +229,10 @@ properties:
- clocks:
- minItems: 1
- maxItems: 8
- - description:
- - Must contain an entry for each clock required by the PMC
- - for controlling a power-gate.
- - See ../clocks/clock-bindings.txt document for more details.
-
- resets:
- minItems: 1
- maxItems: 8
- - description:
- - Must contain an entry for each reset required by the PMC
- - for controlling a power-gate.
- - See ../reset/reset.txt for more details.
-
- power-domains:
- maxItems: 1
- --
- 2.44.0
- From 834f699bde1c647a300da5271f7b5f791f91830e Mon Sep 17 00:00:00 2001
- From: Thierry Reding <[email protected]>
- Date: Wed, 26 Jul 2023 18:27:40 +0200
- Subject: [PATCH] dt-bindings: arm: tegra: pmc: Move additionalProperties
- For indented subschemas it can be difficult to understand which block an
- additionalProperties property belongs to. Moving it closer to the
- beginning of a block is a good way to clarify this.
- Reviewed-by: Rob Herring <[email protected]>
- Signed-off-by: Thierry Reding <[email protected]>
- ---
- .../bindings/arm/tegra/nvidia,tegra20-pmc.yaml | 10 +++-------
- 1 file changed, 3 insertions(+), 7 deletions(-)
- diff --git a/Documentation/devicetree/bindings/arm/tegra/nvidia,tegra20-pmc.yaml b/Documentation/devicetree/bindings/arm/tegra/nvidia,tegra20-pmc.yaml
- index 0ac258bc7be0..d6f2c5862841 100644
- --- a/Documentation/devicetree/bindings/arm/tegra/nvidia,tegra20-pmc.yaml
- +++ b/Documentation/devicetree/bindings/arm/tegra/nvidia,tegra20-pmc.yaml
- @@ -126,6 +126,7 @@ properties:
- description: The vast majority of hardware blocks of Tegra SoC belong to a
- core power domain, which has a dedicated voltage rail that powers the
- blocks.
- + additionalProperties: false
- properties:
- operating-points-v2:
- description: Should contain level, voltages and opp-supported-hw
- @@ -139,12 +140,11 @@ properties:
- - operating-points-v2
- - "#power-domain-cells"
-
- - additionalProperties: false
- -
- i2c-thermtrip:
- type: object
- description: On Tegra30, Tegra114 and Tegra124 if i2c-thermtrip subnode
- exists, hardware-triggered thermal reset will be enabled.
- + additionalProperties: false
- properties:
- nvidia,i2c-controller-id:
- $ref: /schemas/types.yaml#/definitions/uint32
- @@ -176,10 +176,9 @@ properties:
- - nvidia,reg-addr
- - nvidia,reg-data
-
- - additionalProperties: false
- -
- powergates:
- type: object
- + additionalProperties: false
- description: |
- This node contains a hierarchy of power domain nodes, which should match
- the powergates on the Tegra SoC. Each powergate node represents a power-
- @@ -224,7 +223,6 @@ properties:
- "^[a-z0-9]+$":
- type: object
- additionalProperties: false
- -
- properties:
- clocks:
- minItems: 1
- @@ -246,8 +244,6 @@ properties:
- - resets
- - '#power-domain-cells'
-
- - additionalProperties: false
- -
- patternProperties:
- "^[a-f0-9]+-[a-f0-9]+$":
- type: object
- --
- 2.44.0
- From 26b5a37071c58ee3407509bb5c314a6eb411b1f0 Mon Sep 17 00:00:00 2001
- From: Thierry Reding <[email protected]>
- Date: Wed, 26 Jul 2023 18:27:41 +0200
- Subject: [PATCH] dt-bindings: arm: tegra: pmc: Increase maximum number of
- clocks per powergate
- Some powergate definitions need more than 8 clocks, so bump the number
- up to 10, which is the current maximum in any known device tree file.
- Acked-by: Rob Herring <[email protected]>
- Signed-off-by: Thierry Reding <[email protected]>
- ---
- .../devicetree/bindings/arm/tegra/nvidia,tegra20-pmc.yaml | 2 +-
- 1 file changed, 1 insertion(+), 1 deletion(-)
- diff --git a/Documentation/devicetree/bindings/arm/tegra/nvidia,tegra20-pmc.yaml b/Documentation/devicetree/bindings/arm/tegra/nvidia,tegra20-pmc.yaml
- index d6f2c5862841..a336a75d8b82 100644
- --- a/Documentation/devicetree/bindings/arm/tegra/nvidia,tegra20-pmc.yaml
- +++ b/Documentation/devicetree/bindings/arm/tegra/nvidia,tegra20-pmc.yaml
- @@ -226,7 +226,7 @@ properties:
- properties:
- clocks:
- minItems: 1
- - maxItems: 8
- + maxItems: 10
-
- resets:
- minItems: 1
- --
- 2.44.0
- From 4cf88bea8e6712b62479720c695dab39735a5560 Mon Sep 17 00:00:00 2001
- From: Thierry Reding <[email protected]>
- Date: Wed, 26 Jul 2023 18:27:42 +0200
- Subject: [PATCH] dt-bindings: arm: tegra: pmc: Restructure pad configuration
- node schema
- The pad configuration node schema in its current form can accidentally
- match other properties as well. Restructure the schema to better match
- how the device trees are using these.
- Reviewed-by: Rob Herring <[email protected]>
- Signed-off-by: Thierry Reding <[email protected]>
- ---
- .../arm/tegra/nvidia,tegra20-pmc.yaml | 171 +++++++++++-------
- 1 file changed, 109 insertions(+), 62 deletions(-)
- diff --git a/Documentation/devicetree/bindings/arm/tegra/nvidia,tegra20-pmc.yaml b/Documentation/devicetree/bindings/arm/tegra/nvidia,tegra20-pmc.yaml
- index a336a75d8b82..de1b23167658 100644
- --- a/Documentation/devicetree/bindings/arm/tegra/nvidia,tegra20-pmc.yaml
- +++ b/Documentation/devicetree/bindings/arm/tegra/nvidia,tegra20-pmc.yaml
- @@ -244,69 +244,76 @@ properties:
- - resets
- - '#power-domain-cells'
-
- -patternProperties:
- - "^[a-f0-9]+-[a-f0-9]+$":
- + pinmux:
- type: object
- - description:
- - This is a Pad configuration node. On Tegra SOCs a pad is a set of
- - pins which are configured as a group. The pin grouping is a fixed
- - attribute of the hardware. The PMC can be used to set pad power state
- - and signaling voltage. A pad can be either in active or power down mode.
- - The support for power state and signaling voltage configuration varies
- - depending on the pad in question. 3.3V and 1.8V signaling voltages
- - are supported on pins where software controllable signaling voltage
- - switching is available.
- -
- - The pad configuration state nodes are placed under the pmc node and they
- - are referred to by the pinctrl client properties. For more information
- - see Documentation/devicetree/bindings/pinctrl/pinctrl-bindings.txt.
- - The pad name should be used as the value of the pins property in pin
- - configuration nodes.
- -
- - The following pads are present on Tegra124 and Tegra132
- - audio, bb, cam, comp, csia, csb, cse, dsi, dsib, dsic, dsid, hdmi, hsic,
- - hv, lvds, mipi-bias, nand, pex-bias, pex-clk1, pex-clk2, pex-cntrl,
- - sdmmc1, sdmmc3, sdmmc4, sys_ddc, uart, usb0, usb1, usb2, usb_bias.
- -
- - The following pads are present on Tegra210
- - audio, audio-hv, cam, csia, csib, csic, csid, csie, csif, dbg,
- - debug-nonao, dmic, dp, dsi, dsib, dsic, dsid, emmc, emmc2, gpio, hdmi,
- - hsic, lvds, mipi-bias, pex-bias, pex-clk1, pex-clk2, pex-cntrl, sdmmc1,
- - sdmmc3, spi, spi-hv, uart, usb0, usb1, usb2, usb3, usb-bias.
- -
- - properties:
- - pins:
- - $ref: /schemas/types.yaml#/definitions/string
- - description: Must contain name of the pad(s) to be configured.
- -
- - low-power-enable:
- - $ref: /schemas/types.yaml#/definitions/flag
- - description: Configure the pad into power down mode.
- -
- - low-power-disable:
- - $ref: /schemas/types.yaml#/definitions/flag
- - description: Configure the pad into active mode.
- -
- - power-source:
- - $ref: /schemas/types.yaml#/definitions/uint32
- - description:
- - Must contain either TEGRA_IO_PAD_VOLTAGE_1V8 or
- - TEGRA_IO_PAD_VOLTAGE_3V3 to select between signaling voltages.
- - The values are defined in
- - include/dt-bindings/pinctrl/pinctrl-tegra-io-pad.h.
- - Power state can be configured on all Tegra124 and Tegra132
- - pads. None of the Tegra124 or Tegra132 pads support signaling
- - voltage switching.
- - All of the listed Tegra210 pads except pex-cntrl support power
- - state configuration. Signaling voltage switching is supported
- - on below Tegra210 pads.
- - audio, audio-hv, cam, dbg, dmic, gpio, pex-cntrl, sdmmc1,
- - sdmmc3, spi, spi-hv, and uart.
- -
- - required:
- - - pins
- -
- - additionalProperties: false
- + additionalProperties:
- + type: object
- + description: |
- + This is a pad configuration node. On Tegra SoCs a pad is a set of pins
- + which are configured as a group. The pin grouping is a fixed attribute
- + of the hardware. The PMC can be used to set pad power state and
- + signaling voltage. A pad can be either in active or power down mode.
- + The support for power state and signaling voltage configuration varies
- + depending on the pad in question. 3.3V and 1.8V signaling voltages are
- + supported on pins where software controllable signaling voltage
- + switching is available.
- +
- + The pad configuration state nodes are placed under the pmc node and
- + they are referred to by the pinctrl client properties. For more
- + information see:
- +
- + Documentation/devicetree/bindings/pinctrl/pinctrl-bindings.txt
- +
- + The pad name should be used as the value of the pins property in pin
- + configuration nodes.
- +
- + The following pads are present on Tegra124 and Tegra132:
- +
- + audio, bb, cam, comp, csia, csb, cse, dsi, dsib, dsic, dsid, hdmi,
- + hsic, hv, lvds, mipi-bias, nand, pex-bias, pex-clk1, pex-clk2,
- + pex-cntrl, sdmmc1, sdmmc3, sdmmc4, sys_ddc, uart, usb0, usb1, usb2,
- + usb_bias
- +
- + The following pads are present on Tegra210:
- +
- + audio, audio-hv, cam, csia, csib, csic, csid, csie, csif, dbg,
- + debug-nonao, dmic, dp, dsi, dsib, dsic, dsid, emmc, emmc2, gpio,
- + hdmi, hsic, lvds, mipi-bias, pex-bias, pex-clk1, pex-clk2, pex-cntrl,
- + sdmmc1, sdmmc3, spi, spi-hv, uart, usb0, usb1, usb2, usb3, usb-bias
- + additionalProperties: false
- + properties:
- + pins:
- + $ref: /schemas/types.yaml#/definitions/string-array
- + description: Must contain name of the pad(s) to be configured.
- +
- + low-power-enable:
- + $ref: /schemas/types.yaml#/definitions/flag
- + description: Configure the pad into power down mode.
- +
- + low-power-disable:
- + $ref: /schemas/types.yaml#/definitions/flag
- + description: Configure the pad into active mode.
- +
- + power-source:
- + $ref: /schemas/types.yaml#/definitions/uint32
- + description: |
- + Must contain either TEGRA_IO_PAD_VOLTAGE_1V8 or
- + TEGRA_IO_PAD_VOLTAGE_3V3 to select between signaling voltages. The
- + values are defined in:
- +
- + include/dt-bindings/pinctrl/pinctrl-tegra-io-pad.h
- +
- + Power state can be configured on all Tegra124 and Tegra132 pads.
- + None of the Tegra124 or Tegra132 pads support signaling voltage
- + switching. All of the listed Tegra210 pads except pex-cntrl support
- + power state configuration. Signaling voltage switching is supported
- + on the following Tegra210 pads:
- +
- + audio, audio-hv, cam, dbg, dmic, gpio, pex-cntrl, sdmmc1, sdmmc3,
- + spi, spi-hv, uart
- +
- + required:
- + - pins
-
- required:
- - compatible
- @@ -315,6 +322,46 @@ required:
- - clocks
- - '#clock-cells'
-
- +allOf:
- + - if:
- + properties:
- + compatible:
- + contains:
- + const: nvidia,tegra124-pmc
- + then:
- + properties:
- + pinmux:
- + additionalProperties:
- + type: object
- + properties:
- + pins:
- + items:
- + enum: [ audio, bb, cam, comp, csia, csb, cse, dsi, dsib,
- + dsic, dsid, hdmi, hsic, hv, lvds, mipi-bias, nand,
- + pex-bias, pex-clk1, pex-clk2, pex-cntrl, sdmmc1,
- + sdmmc3, sdmmc4, sys_ddc, uart, usb0, usb1, usb2,
- + usb_bias ]
- +
- + - if:
- + properties:
- + compatible:
- + contains:
- + const: nvidia,tegra210-pmc
- + then:
- + properties:
- + pinmux:
- + additionalProperties:
- + type: object
- + properties:
- + pins:
- + items:
- + enum: [ audio, audio-hv, cam, csia, csib, csic, csid, csie,
- + csif, dbg, debug-nonao, dmic, dp, dsi, dsib, dsic,
- + dsid, emmc, emmc2, gpio, hdmi, hsic, lvds, mipi-bias,
- + pex-bias, pex-clk1, pex-clk2, pex-cntrl, sdmmc1,
- + sdmmc3, spi, spi-hv, uart, usb0, usb1, usb2, usb3,
- + usb-bias ]
- +
- additionalProperties: false
-
- dependencies:
- --
- 2.44.0
- From fb41b6eaf418755926840a60d17a1947f08f8b19 Mon Sep 17 00:00:00 2001
- From: Thierry Reding <[email protected]>
- Date: Wed, 26 Jul 2023 18:27:43 +0200
- Subject: [PATCH] dt-bindings: arm: tegra: pmc: Reformat example
- Reformat the example using 4 spaces for indentation.
- Acked-by: Rob Herring <[email protected]>
- Signed-off-by: Thierry Reding <[email protected]>
- ---
- .../arm/tegra/nvidia,tegra20-pmc.yaml | 77 +++++++++----------
- 1 file changed, 38 insertions(+), 39 deletions(-)
- diff --git a/Documentation/devicetree/bindings/arm/tegra/nvidia,tegra20-pmc.yaml b/Documentation/devicetree/bindings/arm/tegra/nvidia,tegra20-pmc.yaml
- index de1b23167658..a54b562e2a1c 100644
- --- a/Documentation/devicetree/bindings/arm/tegra/nvidia,tegra20-pmc.yaml
- +++ b/Documentation/devicetree/bindings/arm/tegra/nvidia,tegra20-pmc.yaml
- @@ -371,47 +371,46 @@ dependencies:
-
- examples:
- - |
- -
- #include <dt-bindings/clock/tegra210-car.h>
- #include <dt-bindings/pinctrl/pinctrl-tegra-io-pad.h>
- #include <dt-bindings/soc/tegra-pmc.h>
-
- - tegra_pmc: pmc@7000e400 {
- - compatible = "nvidia,tegra210-pmc";
- - reg = <0x7000e400 0x400>;
- - core-supply = <®ulator>;
- - clocks = <&tegra_car TEGRA210_CLK_PCLK>, <&clk32k_in>;
- - clock-names = "pclk", "clk32k_in";
- - #clock-cells = <1>;
- -
- - nvidia,invert-interrupt;
- - nvidia,suspend-mode = <0>;
- - nvidia,cpu-pwr-good-time = <0>;
- - nvidia,cpu-pwr-off-time = <0>;
- - nvidia,core-pwr-good-time = <4587 3876>;
- - nvidia,core-pwr-off-time = <39065>;
- - nvidia,core-power-req-active-high;
- - nvidia,sys-clock-req-active-high;
- -
- - pd_core: core-domain {
- - operating-points-v2 = <&core_opp_table>;
- - #power-domain-cells = <0>;
- - };
- -
- - powergates {
- - pd_audio: aud {
- - clocks = <&tegra_car TEGRA210_CLK_APE>,
- - <&tegra_car TEGRA210_CLK_APB2APE>;
- - resets = <&tegra_car 198>;
- - power-domains = <&pd_core>;
- - #power-domain-cells = <0>;
- - };
- -
- - pd_xusbss: xusba {
- - clocks = <&tegra_car TEGRA210_CLK_XUSB_SS>;
- - resets = <&tegra_car TEGRA210_CLK_XUSB_SS>;
- - power-domains = <&pd_core>;
- - #power-domain-cells = <0>;
- - };
- - };
- + pmc@7000e400 {
- + compatible = "nvidia,tegra210-pmc";
- + reg = <0x7000e400 0x400>;
- + core-supply = <®ulator>;
- + clocks = <&tegra_car TEGRA210_CLK_PCLK>, <&clk32k_in>;
- + clock-names = "pclk", "clk32k_in";
- + #clock-cells = <1>;
- +
- + nvidia,invert-interrupt;
- + nvidia,suspend-mode = <0>;
- + nvidia,cpu-pwr-good-time = <0>;
- + nvidia,cpu-pwr-off-time = <0>;
- + nvidia,core-pwr-good-time = <4587 3876>;
- + nvidia,core-pwr-off-time = <39065>;
- + nvidia,core-power-req-active-high;
- + nvidia,sys-clock-req-active-high;
- +
- + pd_core: core-domain {
- + operating-points-v2 = <&core_opp_table>;
- + #power-domain-cells = <0>;
- + };
- +
- + powergates {
- + pd_audio: aud {
- + clocks = <&tegra_car TEGRA210_CLK_APE>,
- + <&tegra_car TEGRA210_CLK_APB2APE>;
- + resets = <&tegra_car 198>;
- + power-domains = <&pd_core>;
- + #power-domain-cells = <0>;
- + };
- +
- + pd_xusbss: xusba {
- + clocks = <&tegra_car TEGRA210_CLK_XUSB_SS>;
- + resets = <&tegra_car TEGRA210_CLK_XUSB_SS>;
- + power-domains = <&pd_core>;
- + #power-domain-cells = <0>;
- + };
- + };
- };
- --
- 2.44.0
- From 3935ccef7c301603373cf87a19d68e606b8e34ec Mon Sep 17 00:00:00 2001
- From: Thierry Reding <[email protected]>
- Date: Wed, 26 Jul 2023 18:27:44 +0200
- Subject: [PATCH] dt-bindings: arm: tegra: pmc: Relicense and move into
- soc/tegra directory
- Dual-license this binding for consistency with other Tegra bindings and
- move it into the soc/tegra directory.
- Reviewed-by: Rob Herring <[email protected]>
- Signed-off-by: Thierry Reding <[email protected]>
- ---
- .../bindings/{arm => soc}/tegra/nvidia,tegra20-pmc.yaml | 4 ++--
- 1 file changed, 2 insertions(+), 2 deletions(-)
- rename Documentation/devicetree/bindings/{arm => soc}/tegra/nvidia,tegra20-pmc.yaml (99%)
- diff --git a/Documentation/devicetree/bindings/arm/tegra/nvidia,tegra20-pmc.yaml b/Documentation/devicetree/bindings/soc/tegra/nvidia,tegra20-pmc.yaml
- similarity index 99%
- rename from Documentation/devicetree/bindings/arm/tegra/nvidia,tegra20-pmc.yaml
- rename to Documentation/devicetree/bindings/soc/tegra/nvidia,tegra20-pmc.yaml
- index a54b562e2a1c..b86f6f53ca95 100644
- --- a/Documentation/devicetree/bindings/arm/tegra/nvidia,tegra20-pmc.yaml
- +++ b/Documentation/devicetree/bindings/soc/tegra/nvidia,tegra20-pmc.yaml
- @@ -1,7 +1,7 @@
- -# SPDX-License-Identifier: GPL-2.0
- +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
- %YAML 1.2
- ---
- -$id: http://devicetree.org/schemas/arm/tegra/nvidia,tegra20-pmc.yaml#
- +$id: http://devicetree.org/schemas/soc/tegra/nvidia,tegra20-pmc.yaml#
- $schema: http://devicetree.org/meta-schemas/core.yaml#
-
- title: Tegra Power Management Controller (PMC)
- --
- 2.44.0
- From dd7e1d02ac6e219c99752588166011889a8702d9 Mon Sep 17 00:00:00 2001
- From: =?UTF-8?q?Uwe=20Kleine-K=C3=B6nig?= <[email protected]>
- Date: Mon, 25 Sep 2023 11:55:23 +0200
- Subject: [PATCH] soc/tegra: cbb: tegra194-cbb: Convert to platform remove
- callback returning void
- MIME-Version: 1.0
- Content-Type: text/plain; charset=UTF-8
- Content-Transfer-Encoding: 8bit
- The .remove() callback for a platform driver returns an int which makes
- many driver authors wrongly assume it's possible to do error handling by
- returning an error code. However the value returned is ignored (apart
- from emitting a warning) and this typically results in resource leaks.
- To improve here there is a quest to make the remove callback return
- void. In the first step of this quest all drivers are converted to
- .remove_new() which already returns void. Eventually after all drivers
- are converted, .remove_new() will be renamed to .remove().
- Trivially convert this driver from always returning zero in the remove
- callback to the void returning variant.
- Signed-off-by: Uwe Kleine-König <[email protected]>
- Signed-off-by: Thierry Reding <[email protected]>
- ---
- drivers/soc/tegra/cbb/tegra194-cbb.c | 6 ++----
- 1 file changed, 2 insertions(+), 4 deletions(-)
- diff --git a/drivers/soc/tegra/cbb/tegra194-cbb.c b/drivers/soc/tegra/cbb/tegra194-cbb.c
- index cf6886f362d3..9cbc562ae7d3 100644
- --- a/drivers/soc/tegra/cbb/tegra194-cbb.c
- +++ b/drivers/soc/tegra/cbb/tegra194-cbb.c
- @@ -2293,7 +2293,7 @@ static int tegra194_cbb_probe(struct platform_device *pdev)
- return tegra_cbb_register(&cbb->base);
- }
-
- -static int tegra194_cbb_remove(struct platform_device *pdev)
- +static void tegra194_cbb_remove(struct platform_device *pdev)
- {
- struct tegra194_cbb *cbb = platform_get_drvdata(pdev);
- struct tegra_cbb *noc, *tmp;
- @@ -2311,8 +2311,6 @@ static int tegra194_cbb_remove(struct platform_device *pdev)
- }
-
- spin_unlock_irqrestore(&cbb_lock, flags);
- -
- - return 0;
- }
-
- static int __maybe_unused tegra194_cbb_resume_noirq(struct device *dev)
- @@ -2332,7 +2330,7 @@ static const struct dev_pm_ops tegra194_cbb_pm = {
-
- static struct platform_driver tegra194_cbb_driver = {
- .probe = tegra194_cbb_probe,
- - .remove = tegra194_cbb_remove,
- + .remove_new = tegra194_cbb_remove,
- .driver = {
- .name = "tegra194-cbb",
- .of_match_table = of_match_ptr(tegra194_cbb_match),
- --
- 2.44.0
- From 448b1e383a575f0d1f946c462b4d1f89814473e3 Mon Sep 17 00:00:00 2001
- From: Ulf Hansson <[email protected]>
- Date: Thu, 12 Oct 2023 17:35:36 +0200
- Subject: [PATCH] soc/tegra: pmc: Drop the ->opp_to_performance_state()
- callback
- Since commit 7c41cdcd3bbe ("OPP: Simplify the over-designed pstate <->
- level dance"), there is no longer any need for genpd providers to assign
- the ->opp_to_performance_state(), hence let's drop it.
- Cc: Thierry Reding <[email protected]>
- Cc: Jonathan Hunter <[email protected]>
- Cc: [email protected]
- Signed-off-by: Ulf Hansson <[email protected]>
- Signed-off-by: Thierry Reding <[email protected]>
- ---
- drivers/soc/tegra/pmc.c | 8 --------
- 1 file changed, 8 deletions(-)
- diff --git a/drivers/soc/tegra/pmc.c b/drivers/soc/tegra/pmc.c
- index 162f52456f65..f432aa022ace 100644
- --- a/drivers/soc/tegra/pmc.c
- +++ b/drivers/soc/tegra/pmc.c
- @@ -1393,13 +1393,6 @@ tegra_pmc_core_pd_set_performance_state(struct generic_pm_domain *genpd,
- return 0;
- }
-
- -static unsigned int
- -tegra_pmc_core_pd_opp_to_performance_state(struct generic_pm_domain *genpd,
- - struct dev_pm_opp *opp)
- -{
- - return dev_pm_opp_get_level(opp);
- -}
- -
- static int tegra_pmc_core_pd_add(struct tegra_pmc *pmc, struct device_node *np)
- {
- struct generic_pm_domain *genpd;
- @@ -1412,7 +1405,6 @@ static int tegra_pmc_core_pd_add(struct tegra_pmc *pmc, struct device_node *np)
-
- genpd->name = "core";
- genpd->set_performance_state = tegra_pmc_core_pd_set_performance_state;
- - genpd->opp_to_performance_state = tegra_pmc_core_pd_opp_to_performance_state;
-
- err = devm_pm_opp_set_regulators(pmc->dev, rname);
- if (err)
- --
- 2.44.0
- From e0bf68d764454da84578a5e2762f6787f600130e Mon Sep 17 00:00:00 2001
- From: Deming Wang <[email protected]>
- Date: Tue, 12 Sep 2023 08:10:30 -0400
- Subject: [PATCH] firmware: tegra: Fix a typo
- successfully, not 'succesfully'
- Signed-off-by: Deming Wang <[email protected]>
- Signed-off-by: Thierry Reding <[email protected]>
- ---
- include/soc/tegra/bpmp-abi.h | 2 +-
- 1 file changed, 1 insertion(+), 1 deletion(-)
- diff --git a/include/soc/tegra/bpmp-abi.h b/include/soc/tegra/bpmp-abi.h
- index ecefcaec7e66..6b995a8f0f6d 100644
- --- a/include/soc/tegra/bpmp-abi.h
- +++ b/include/soc/tegra/bpmp-abi.h
- @@ -1194,7 +1194,7 @@ struct cmd_clk_is_enabled_request {
- */
- struct cmd_clk_is_enabled_response {
- /**
- - * @brief The state of the clock that has been succesfully
- + * @brief The state of the clock that has been successfully
- * requested with CMD_CLK_ENABLE or CMD_CLK_DISABLE by the
- * master invoking the command earlier.
- *
- --
- 2.44.0
- From 0ac4c434ad6f74ea958ab6b563f88daeac09e4f1 Mon Sep 17 00:00:00 2001
- From: Diogo Ivo <[email protected]>
- Date: Mon, 7 Aug 2023 14:33:03 +0100
- Subject: [PATCH] arm64: tegra: Add DSI/CSI regulator on Smaug
- Add the node for the DSI/CSI regulator in the Pixel C.
- Signed-off-by: Diogo Ivo <[email protected]>
- Signed-off-by: Thierry Reding <[email protected]>
- ---
- arch/arm64/boot/dts/nvidia/tegra210-smaug.dts | 8 ++++++++
- 1 file changed, 8 insertions(+)
- diff --git a/arch/arm64/boot/dts/nvidia/tegra210-smaug.dts b/arch/arm64/boot/dts/nvidia/tegra210-smaug.dts
- index 53805555dd2d..9acf33aae902 100644
- --- a/arch/arm64/boot/dts/nvidia/tegra210-smaug.dts
- +++ b/arch/arm64/boot/dts/nvidia/tegra210-smaug.dts
- @@ -1932,4 +1932,12 @@ usbc_vbus: regulator-usbc-vbus {
- regulator-min-microvolt = <5000000>;
- regulator-max-microvolt = <5000000>;
- };
- +
- + vdd_dsi_csi: regulator-vdd-dsi-csi {
- + compatible = "regulator-fixed";
- + regulator-name = "AVDD_DSI_CSI_1V2";
- + regulator-min-microvolt = <1200000>;
- + regulator-max-microvolt = <1200000>;
- + vin-supply = <&pp1200_avdd>;
- + };
- };
- --
- 2.44.0
- From 1de69533ec2cf33083b3683b521c7ada265c78fd Mon Sep 17 00:00:00 2001
- From: Diogo Ivo <[email protected]>
- Date: Mon, 7 Aug 2023 14:33:04 +0100
- Subject: [PATCH] arm64: tegra: Add backlight node on Smaug
- The Google Pixel C has a TI LP8557 backlight controller, so add a
- DT node for it.
- Signed-off-by: Diogo Ivo <[email protected]>
- Signed-off-by: Thierry Reding <[email protected]>
- ---
- arch/arm64/boot/dts/nvidia/tegra210-smaug.dts | 31 +++++++++++++++++++
- 1 file changed, 31 insertions(+)
- diff --git a/arch/arm64/boot/dts/nvidia/tegra210-smaug.dts b/arch/arm64/boot/dts/nvidia/tegra210-smaug.dts
- index 9acf33aae902..9c8ffbf8ef65 100644
- --- a/arch/arm64/boot/dts/nvidia/tegra210-smaug.dts
- +++ b/arch/arm64/boot/dts/nvidia/tegra210-smaug.dts
- @@ -1651,6 +1651,37 @@ nau8825@1a {
- status = "okay";
- };
-
- + backlight: backlight@2c {
- + compatible = "ti,lp8557";
- + reg = <0x2c>;
- + power-supply = <&pplcd_vdd>;
- + enable-supply = <&pp1800_lcdio>;
- + bl-name = "lp8557-backlight";
- + dev-ctrl = /bits/ 8 <0x01>;
- + init-brt = /bits/ 8 <0x80>;
- +
- + /* Full scale current, 20mA */
- + rom-11h {
- + rom-addr = /bits/ 8 <0x11>;
- + rom-val = /bits/ 8 <0x05>;
- + };
- + /* Frequency = 4.9kHz, magic undocumented val */
- + rom-12h {
- + rom-addr = /bits/ 8 <0x12>;
- + rom-val = /bits/ 8 <0x29>;
- + };
- + /* Boost freq = 1MHz, BComp option = 1 */
- + rom-13h {
- + rom-addr = /bits/ 8 <0x13>;
- + rom-val = /bits/ 8 <0x03>;
- + };
- + /* 4V OV, 6 output LED string enabled */
- + rom-14h {
- + rom-addr = /bits/ 8 <0x14>;
- + rom-val = /bits/ 8 <0xbf>;
- + };
- + };
- +
- audio-codec@2d {
- compatible = "realtek,rt5677";
- reg = <0x2d>;
- --
- 2.44.0
- From ba829ae1312962094bed036a8192f11eacfcec23 Mon Sep 17 00:00:00 2001
- From: Diogo Ivo <[email protected]>
- Date: Mon, 7 Aug 2023 14:33:05 +0100
- Subject: [PATCH] arm64: tegra: Add display panel node on Smaug
- The Google Pixel C has a JDI LPM102A188A display panel, so add a
- DT node for it.
- Signed-off-by: Diogo Ivo <[email protected]>
- Signed-off-by: Thierry Reding <[email protected]>
- ---
- arch/arm64/boot/dts/nvidia/tegra210-smaug.dts | 27 +++++++++++++++++++
- 1 file changed, 27 insertions(+)
- diff --git a/arch/arm64/boot/dts/nvidia/tegra210-smaug.dts b/arch/arm64/boot/dts/nvidia/tegra210-smaug.dts
- index 9c8ffbf8ef65..9ebb7369256e 100644
- --- a/arch/arm64/boot/dts/nvidia/tegra210-smaug.dts
- +++ b/arch/arm64/boot/dts/nvidia/tegra210-smaug.dts
- @@ -31,6 +31,33 @@ memory {
- };
-
- host1x@50000000 {
- + dsia: dsi@54300000 {
- + avdd-dsi-csi-supply = <&vdd_dsi_csi>;
- + status = "okay";
- +
- + link2: panel@0 {
- + compatible = "jdi,lpm102a188a";
- + reg = <0>;
- + };
- + };
- +
- + dsib: dsi@54400000 {
- + avdd-dsi-csi-supply = <&vdd_dsi_csi>;
- + nvidia,ganged-mode = <&dsia>;
- + status = "okay";
- +
- + link1: panel@0 {
- + compatible = "jdi,lpm102a188a";
- + reg = <0>;
- + power-supply = <&pplcd_vdd>;
- + ddi-supply = <&pp1800_lcdio>;
- + enable-gpios = <&gpio TEGRA_GPIO(V, 1) GPIO_ACTIVE_HIGH>;
- + reset-gpios = <&gpio TEGRA_GPIO(V, 2) GPIO_ACTIVE_LOW>;
- + link2 = <&link2>;
- + backlight = <&backlight>;
- + };
- + };
- +
- dpaux: dpaux@545c0000 {
- status = "okay";
- };
- --
- 2.44.0
- From b18513618ead4d6e9abadeaa19735d1a7f1a9fca Mon Sep 17 00:00:00 2001
- From: Thierry Reding <[email protected]>
- Date: Thu, 17 Aug 2023 16:14:03 +0200
- Subject: [PATCH] arm64: tegra: Add missing current-speed for SBSA UART
- The SBSA UART device tree bindings require a current-speed property that
- specifies the baud rate configured by the firmware. Add it on Jetson AGX
- Orin and Jetson Orin Nano/NX.
- Signed-off-by: Thierry Reding <[email protected]>
- ---
- arch/arm64/boot/dts/nvidia/tegra234-p3737-0000+p3701-0000.dts | 1 +
- arch/arm64/boot/dts/nvidia/tegra234-p3768-0000.dtsi | 1 +
- 2 files changed, 2 insertions(+)
- 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
- index bf2ccc8ff93c..81a82933e350 100644
- --- a/arch/arm64/boot/dts/nvidia/tegra234-p3737-0000+p3701-0000.dts
- +++ b/arch/arm64/boot/dts/nvidia/tegra234-p3737-0000+p3701-0000.dts
- @@ -30,6 +30,7 @@ serial@3100000 {
- };
-
- serial@31d0000 {
- + current-speed = <115200>;
- status = "okay";
- };
-
- diff --git a/arch/arm64/boot/dts/nvidia/tegra234-p3768-0000.dtsi b/arch/arm64/boot/dts/nvidia/tegra234-p3768-0000.dtsi
- index 39110c1232e0..5d0298b6c30d 100644
- --- a/arch/arm64/boot/dts/nvidia/tegra234-p3768-0000.dtsi
- +++ b/arch/arm64/boot/dts/nvidia/tegra234-p3768-0000.dtsi
- @@ -29,6 +29,7 @@ eeprom@57 {
- };
-
- serial@31d0000 {
- + current-speed = <115200>;
- status = "okay";
- };
-
- --
- 2.44.0
- From 7aa80cfac4903c7e098a5c46bfd580e652b6cd6f Mon Sep 17 00:00:00 2001
- From: Thierry Reding <[email protected]>
- Date: Thu, 17 Aug 2023 16:14:04 +0200
- Subject: [PATCH] arm64: tegra: Remove duplicate nodes on Jetson Orin NX
- The SBSA UART and TCU as well as the TCU alias and the stdout-path are
- configured via the P3768 carrier board DTS include, so the can be
- removed from the system DTS file.
- Signed-off-by: Thierry Reding <[email protected]>
- ---
- .../dts/nvidia/tegra234-p3768-0000+p3767-0000.dts | 13 -------------
- 1 file changed, 13 deletions(-)
- 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
- index e9460aedd47c..61b0e69d3d20 100644
- --- a/arch/arm64/boot/dts/nvidia/tegra234-p3768-0000+p3767-0000.dts
- +++ b/arch/arm64/boot/dts/nvidia/tegra234-p3768-0000+p3767-0000.dts
- @@ -12,15 +12,10 @@ / {
- model = "NVIDIA Jetson Orin NX Engineering Reference Developer Kit";
-
- aliases {
- - serial0 = &tcu;
- serial1 = &uarta;
- serial2 = &uarte;
- };
-
- - chosen {
- - stdout-path = "serial0:115200n8";
- - };
- -
- bus@0 {
- serial@3100000 {
- compatible = "nvidia,tegra194-hsuart";
- @@ -34,10 +29,6 @@ serial@3140000 {
- status = "okay";
- };
-
- - serial@31d0000 {
- - status = "okay";
- - };
- -
- pwm@32a0000 {
- assigned-clocks = <&bpmp TEGRA234_CLK_PWM3>;
- assigned-clock-parents = <&bpmp TEGRA234_CLK_PLLP_OUT0>;
- @@ -94,10 +85,6 @@ vdd_3v3_pcie: regulator-vdd-3v3-pcie {
- enable-active-high;
- };
-
- - serial {
- - status = "okay";
- - };
- -
- thermal-zones {
- tj-thermal {
- cooling-maps {
- --
- 2.44.0
- From f13f2e024fdc163507e6fe7ceacef20bd67a2c7a Mon Sep 17 00:00:00 2001
- From: Thierry Reding <[email protected]>
- Date: Thu, 17 Aug 2023 16:14:05 +0200
- Subject: [PATCH] arm64: tegra: Use correct format for clocks property
- phandle and clock specifier pairs should be enclosed in angular
- brackets.
- Signed-off-by: Thierry Reding <[email protected]>
- ---
- arch/arm64/boot/dts/nvidia/tegra234.dtsi | 32 ++++++++++++------------
- 1 file changed, 16 insertions(+), 16 deletions(-)
- diff --git a/arch/arm64/boot/dts/nvidia/tegra234.dtsi b/arch/arm64/boot/dts/nvidia/tegra234.dtsi
- index ac69eacf8a6b..1a9866cf1e19 100644
- --- a/arch/arm64/boot/dts/nvidia/tegra234.dtsi
- +++ b/arch/arm64/boot/dts/nvidia/tegra234.dtsi
- @@ -705,8 +705,8 @@ gen1_i2c: i2c@3160000 {
- #address-cells = <1>;
- #size-cells = <0>;
- clock-frequency = <400000>;
- - clocks = <&bpmp TEGRA234_CLK_I2C1
- - &bpmp TEGRA234_CLK_PLLP_OUT0>;
- + clocks = <&bpmp TEGRA234_CLK_I2C1>,
- + <&bpmp TEGRA234_CLK_PLLP_OUT0>;
- assigned-clocks = <&bpmp TEGRA234_CLK_I2C1>;
- assigned-clock-parents = <&bpmp TEGRA234_CLK_PLLP_OUT0>;
- clock-names = "div-clk", "parent";
- @@ -724,8 +724,8 @@ cam_i2c: i2c@3180000 {
- #size-cells = <0>;
- status = "disabled";
- clock-frequency = <400000>;
- - clocks = <&bpmp TEGRA234_CLK_I2C3
- - &bpmp TEGRA234_CLK_PLLP_OUT0>;
- + clocks = <&bpmp TEGRA234_CLK_I2C3>,
- + <&bpmp TEGRA234_CLK_PLLP_OUT0>;
- assigned-clocks = <&bpmp TEGRA234_CLK_I2C3>;
- assigned-clock-parents = <&bpmp TEGRA234_CLK_PLLP_OUT0>;
- clock-names = "div-clk", "parent";
- @@ -743,8 +743,8 @@ dp_aux_ch1_i2c: i2c@3190000 {
- #size-cells = <0>;
- status = "disabled";
- clock-frequency = <100000>;
- - clocks = <&bpmp TEGRA234_CLK_I2C4
- - &bpmp TEGRA234_CLK_PLLP_OUT0>;
- + clocks = <&bpmp TEGRA234_CLK_I2C4>,
- + <&bpmp TEGRA234_CLK_PLLP_OUT0>;
- assigned-clocks = <&bpmp TEGRA234_CLK_I2C4>;
- assigned-clock-parents = <&bpmp TEGRA234_CLK_PLLP_OUT0>;
- clock-names = "div-clk", "parent";
- @@ -762,8 +762,8 @@ dp_aux_ch0_i2c: i2c@31b0000 {
- #size-cells = <0>;
- status = "disabled";
- clock-frequency = <100000>;
- - clocks = <&bpmp TEGRA234_CLK_I2C6
- - &bpmp TEGRA234_CLK_PLLP_OUT0>;
- + clocks = <&bpmp TEGRA234_CLK_I2C6>,
- + <&bpmp TEGRA234_CLK_PLLP_OUT0>;
- assigned-clocks = <&bpmp TEGRA234_CLK_I2C6>;
- assigned-clock-parents = <&bpmp TEGRA234_CLK_PLLP_OUT0>;
- clock-names = "div-clk", "parent";
- @@ -781,8 +781,8 @@ dp_aux_ch2_i2c: i2c@31c0000 {
- #size-cells = <0>;
- status = "disabled";
- clock-frequency = <100000>;
- - clocks = <&bpmp TEGRA234_CLK_I2C7
- - &bpmp TEGRA234_CLK_PLLP_OUT0>;
- + clocks = <&bpmp TEGRA234_CLK_I2C7>,
- + <&bpmp TEGRA234_CLK_PLLP_OUT0>;
- assigned-clocks = <&bpmp TEGRA234_CLK_I2C7>;
- assigned-clock-parents = <&bpmp TEGRA234_CLK_PLLP_OUT0>;
- clock-names = "div-clk", "parent";
- @@ -807,8 +807,8 @@ dp_aux_ch3_i2c: i2c@31e0000 {
- #size-cells = <0>;
- status = "disabled";
- clock-frequency = <100000>;
- - clocks = <&bpmp TEGRA234_CLK_I2C9
- - &bpmp TEGRA234_CLK_PLLP_OUT0>;
- + clocks = <&bpmp TEGRA234_CLK_I2C9>,
- + <&bpmp TEGRA234_CLK_PLLP_OUT0>;
- assigned-clocks = <&bpmp TEGRA234_CLK_I2C9>;
- assigned-clock-parents = <&bpmp TEGRA234_CLK_PLLP_OUT0>;
- clock-names = "div-clk", "parent";
- @@ -1751,8 +1751,8 @@ gen2_i2c: i2c@c240000 {
- #size-cells = <0>;
- status = "disabled";
- clock-frequency = <100000>;
- - clocks = <&bpmp TEGRA234_CLK_I2C2
- - &bpmp TEGRA234_CLK_PLLP_OUT0>;
- + clocks = <&bpmp TEGRA234_CLK_I2C2>,
- + <&bpmp TEGRA234_CLK_PLLP_OUT0>;
- clock-names = "div-clk", "parent";
- assigned-clocks = <&bpmp TEGRA234_CLK_I2C2>;
- assigned-clock-parents = <&bpmp TEGRA234_CLK_PLLP_OUT0>;
- @@ -1770,8 +1770,8 @@ gen8_i2c: i2c@c250000 {
- #size-cells = <0>;
- status = "disabled";
- clock-frequency = <400000>;
- - clocks = <&bpmp TEGRA234_CLK_I2C8
- - &bpmp TEGRA234_CLK_PLLP_OUT0>;
- + clocks = <&bpmp TEGRA234_CLK_I2C8>,
- + <&bpmp TEGRA234_CLK_PLLP_OUT0>;
- clock-names = "div-clk", "parent";
- assigned-clocks = <&bpmp TEGRA234_CLK_I2C8>;
- assigned-clock-parents = <&bpmp TEGRA234_CLK_PLLP_OUT0>;
- --
- 2.44.0
- From ea43b110d36b5d298b95cfa781ca79209d4f291e Mon Sep 17 00:00:00 2001
- From: Thierry Reding <[email protected]>
- Date: Thu, 17 Aug 2023 16:14:06 +0200
- Subject: [PATCH] arm64: tegra: Add dmas and dma-names for Tegra234 UARTE
- Commit 940acdac99b2 ("arm64: tegra: Add UARTE device tree node on
- Tegra234") added the device tree node for the UARTE on Tegra234 but
- didn't include the "dmas" and "dma-names" properties required for this
- device when it's used in high-speed mode.
- Signed-off-by: Thierry Reding <[email protected]>
- ---
- arch/arm64/boot/dts/nvidia/tegra234.dtsi | 2 ++
- 1 file changed, 2 insertions(+)
- diff --git a/arch/arm64/boot/dts/nvidia/tegra234.dtsi b/arch/arm64/boot/dts/nvidia/tegra234.dtsi
- index 1a9866cf1e19..d1fe41cc3e0b 100644
- --- a/arch/arm64/boot/dts/nvidia/tegra234.dtsi
- +++ b/arch/arm64/boot/dts/nvidia/tegra234.dtsi
- @@ -694,6 +694,8 @@ uarte: serial@3140000 {
- interrupts = <GIC_SPI 116 IRQ_TYPE_LEVEL_HIGH>;
- clocks = <&bpmp TEGRA234_CLK_UARTE>;
- resets = <&bpmp TEGRA234_RESET_UARTE>;
- + dmas = <&gpcdma 20>, <&gpcdma 20>;
- + dma-names = "rx", "tx";
- status = "disabled";
- };
-
- --
- 2.44.0
- From 9c5534efd875098bbebde4da8b9a027a54a3c288 Mon Sep 17 00:00:00 2001
- From: Thierry Reding <[email protected]>
- Date: Thu, 17 Aug 2023 16:14:07 +0200
- Subject: [PATCH] arm64: tegra: Mark Tegra234 SPI as compatible with Tegra114
- According to the bindings, both Tegra210 and Tegra114 compatible strings
- need to be specified since the version of this hardware block found in
- Tegra210 is backwards-compatible.
- Signed-off-by: Thierry Reding <[email protected]>
- ---
- arch/arm64/boot/dts/nvidia/tegra234.dtsi | 6 +++---
- 1 file changed, 3 insertions(+), 3 deletions(-)
- diff --git a/arch/arm64/boot/dts/nvidia/tegra234.dtsi b/arch/arm64/boot/dts/nvidia/tegra234.dtsi
- index d1fe41cc3e0b..3f16595d099c 100644
- --- a/arch/arm64/boot/dts/nvidia/tegra234.dtsi
- +++ b/arch/arm64/boot/dts/nvidia/tegra234.dtsi
- @@ -821,7 +821,7 @@ dp_aux_ch3_i2c: i2c@31e0000 {
- };
-
- spi@3210000 {
- - compatible = "nvidia,tegra210-spi";
- + compatible = "nvidia,tegra210-spi", "nvidia,tegra114-spi";
- reg = <0x0 0x03210000 0x0 0x1000>;
- interrupts = <GIC_SPI 36 IRQ_TYPE_LEVEL_HIGH>;
- #address-cells = <1>;
- @@ -840,7 +840,7 @@ spi@3210000 {
- };
-
- spi@3230000 {
- - compatible = "nvidia,tegra210-spi";
- + compatible = "nvidia,tegra210-spi", "nvidia,tegra114-spi";
- reg = <0x0 0x03230000 0x0 0x1000>;
- interrupts = <GIC_SPI 38 IRQ_TYPE_LEVEL_HIGH>;
- #address-cells = <1>;
- @@ -1784,7 +1784,7 @@ gen8_i2c: i2c@c250000 {
- };
-
- spi@c260000 {
- - compatible = "nvidia,tegra210-spi";
- + compatible = "nvidia,tegra210-spi", "nvidia,tegra114-spi";
- reg = <0x0 0x0c260000 0x0 0x1000>;
- interrupts = <GIC_SPI 37 IRQ_TYPE_LEVEL_HIGH>;
- #address-cells = <1>;
- --
- 2.44.0
- From cd76c21e85a6c7fece6ed4b664de08bddc793151 Mon Sep 17 00:00:00 2001
- From: Jon Hunter <[email protected]>
- Date: Fri, 29 Sep 2023 11:36:50 +0100
- Subject: [PATCH] arm64: tegra: Add power-sensors for Tegra234 boards
- Populate the ina219 and ina3221 power-sensors for the various Tegra234
- boards. These sensors are located on the Tegra234 module boards and the
- configuration of some sensors is common across the different Tegra234
- modules. Therefore, add any common sensor configurations to appropriate
- device tree source file so it can be re-used across modules.
- Signed-off-by: Jon Hunter <[email protected]>
- Signed-off-by: Thierry Reding <[email protected]>
- ---
- .../boot/dts/nvidia/tegra234-p3701-0008.dtsi | 33 ++++++++++++
- .../arm64/boot/dts/nvidia/tegra234-p3701.dtsi | 53 +++++++++++++++++++
- .../arm64/boot/dts/nvidia/tegra234-p3767.dtsi | 29 ++++++++++
- 3 files changed, 115 insertions(+)
- diff --git a/arch/arm64/boot/dts/nvidia/tegra234-p3701-0008.dtsi b/arch/arm64/boot/dts/nvidia/tegra234-p3701-0008.dtsi
- index 62c4fdad0b60..553fa4ba1cd4 100644
- --- a/arch/arm64/boot/dts/nvidia/tegra234-p3701-0008.dtsi
- +++ b/arch/arm64/boot/dts/nvidia/tegra234-p3701-0008.dtsi
- @@ -44,6 +44,39 @@ i2c@c240000 {
- status = "okay";
- };
-
- + i2c@c250000 {
- + power-sensor@41 {
- + compatible = "ti,ina3221";
- + reg = <0x41>;
- + #address-cells = <1>;
- + #size-cells = <0>;
- +
- + input@0 {
- + reg = <0x0>;
- + label = "CVB_ATX_12V";
- + shunt-resistor-micro-ohms = <2000>;
- + };
- +
- + input@1 {
- + reg = <0x1>;
- + label = "CVB_ATX_3V3";
- + shunt-resistor-micro-ohms = <2000>;
- + };
- +
- + input@2 {
- + reg = <0x2>;
- + label = "CVB_ATX_5V";
- + shunt-resistor-micro-ohms = <2000>;
- + };
- + };
- +
- + power-sensor@44 {
- + compatible = "ti,ina219";
- + reg = <0x44>;
- + shunt-resistor = <2000>;
- + };
- + };
- +
- rtc@c2a0000 {
- status = "okay";
- };
- diff --git a/arch/arm64/boot/dts/nvidia/tegra234-p3701.dtsi b/arch/arm64/boot/dts/nvidia/tegra234-p3701.dtsi
- index 5e7797df50c2..db6ef711674a 100644
- --- a/arch/arm64/boot/dts/nvidia/tegra234-p3701.dtsi
- +++ b/arch/arm64/boot/dts/nvidia/tegra234-p3701.dtsi
- @@ -1987,5 +1987,58 @@ interrupt-controller@2a40000 {
- status = "okay";
- };
- };
- +
- + i2c@c240000 {
- + status = "okay";
- +
- + power-sensor@40 {
- + compatible = "ti,ina3221";
- + reg = <0x40>;
- + #address-cells = <1>;
- + #size-cells = <0>;
- +
- + input@0 {
- + reg = <0x0>;
- + label = "VDD_GPU_SOC";
- + shunt-resistor-micro-ohms = <2000>;
- + };
- +
- + input@1 {
- + reg = <0x1>;
- + label = "VDD_CPU_CV";
- + shunt-resistor-micro-ohms = <2000>;
- + };
- +
- + input@2 {
- + reg = <0x2>;
- + label = "VIN_SYS_5V0";
- + shunt-resistor-micro-ohms = <2000>;
- + ti,summation-disable;
- + };
- + };
- +
- + power-sensor@41 {
- + compatible = "ti,ina3221";
- + reg = <0x41>;
- + #address-cells = <1>;
- + #size-cells = <0>;
- +
- + input@0 {
- + reg = <0x0>;
- + status = "disabled";
- + };
- +
- + input@1 {
- + reg = <0x1>;
- + label = "VDDQ_VDD2_1V8AO";
- + shunt-resistor-micro-ohms = <2000>;
- + };
- +
- + input@2 {
- + reg = <0x2>;
- + status = "disabled";
- + };
- + };
- + };
- };
- };
- diff --git a/arch/arm64/boot/dts/nvidia/tegra234-p3767.dtsi b/arch/arm64/boot/dts/nvidia/tegra234-p3767.dtsi
- index fe08e131b7b9..59c14ded5e9f 100644
- --- a/arch/arm64/boot/dts/nvidia/tegra234-p3767.dtsi
- +++ b/arch/arm64/boot/dts/nvidia/tegra234-p3767.dtsi
- @@ -55,6 +55,35 @@ padctl@3520000 {
- avdd-usb-supply = <&vdd_3v3_ao>;
- };
-
- + i2c@c240000 {
- + status = "okay";
- +
- + power-sensor@40 {
- + compatible = "ti,ina3221";
- + reg = <0x40>;
- + #address-cells = <1>;
- + #size-cells = <0>;
- +
- + input@0 {
- + reg = <0x0>;
- + label = "VDD_IN";
- + shunt-resistor-micro-ohms = <5000>;
- + };
- +
- + input@1 {
- + reg = <0x1>;
- + label = "VDD_CPU_GPU_CV";
- + shunt-resistor-micro-ohms = <5000>;
- + };
- +
- + input@2 {
- + reg = <0x2>;
- + label = "VDD_SOC";
- + shunt-resistor-micro-ohms = <5000>;
- + };
- + };
- + };
- +
- rtc@c2a0000 {
- status = "okay";
- };
- --
- 2.44.0
- From 695a4755e60e4eb197f56aa10c5844224d320eb9 Mon Sep 17 00:00:00 2001
- From: Christophe JAILLET <[email protected]>
- Date: Sun, 12 Nov 2023 08:04:14 +0100
- Subject: [PATCH] soc/tegra: pmc: Remove some old and deprecated functions and
- constants
- These TEGRA_IO_RAIL_... functions and constants have been deprecated in
- commit 21b499105178 ("soc/tegra: pmc: Add I/O pad voltage support") in
- 2016-11.
- There seems to be no users since kernel 4.16.
- Remove them now.
- Signed-off-by: Christophe JAILLET <[email protected]>
- Signed-off-by: Thierry Reding <[email protected]>
- ---
- drivers/soc/tegra/pmc.c | 24 ------------------------
- include/soc/tegra/pmc.h | 18 ------------------
- 2 files changed, 42 deletions(-)
- diff --git a/drivers/soc/tegra/pmc.c b/drivers/soc/tegra/pmc.c
- index f432aa022ace..6dfcc7f50ece 100644
- --- a/drivers/soc/tegra/pmc.c
- +++ b/drivers/soc/tegra/pmc.c
- @@ -1777,30 +1777,6 @@ static int tegra_io_pad_get_voltage(struct tegra_pmc *pmc, enum tegra_io_pad id)
- return TEGRA_IO_PAD_VOLTAGE_3V3;
- }
-
- -/**
- - * tegra_io_rail_power_on() - enable power to I/O rail
- - * @id: Tegra I/O pad ID for which to enable power
- - *
- - * See also: tegra_io_pad_power_enable()
- - */
- -int tegra_io_rail_power_on(unsigned int id)
- -{
- - return tegra_io_pad_power_enable(id);
- -}
- -EXPORT_SYMBOL(tegra_io_rail_power_on);
- -
- -/**
- - * tegra_io_rail_power_off() - disable power to I/O rail
- - * @id: Tegra I/O pad ID for which to disable power
- - *
- - * See also: tegra_io_pad_power_disable()
- - */
- -int tegra_io_rail_power_off(unsigned int id)
- -{
- - return tegra_io_pad_power_disable(id);
- -}
- -EXPORT_SYMBOL(tegra_io_rail_power_off);
- -
- #ifdef CONFIG_PM_SLEEP
- enum tegra_suspend_mode tegra_pmc_get_suspend_mode(void)
- {
- diff --git a/include/soc/tegra/pmc.h b/include/soc/tegra/pmc.h
- index aadb845d281d..c545875d0ff1 100644
- --- a/include/soc/tegra/pmc.h
- +++ b/include/soc/tegra/pmc.h
- @@ -148,10 +148,6 @@ enum tegra_io_pad {
- TEGRA_IO_PAD_AO_HV,
- };
-
- -/* deprecated, use TEGRA_IO_PAD_{HDMI,LVDS} instead */
- -#define TEGRA_IO_RAIL_HDMI TEGRA_IO_PAD_HDMI
- -#define TEGRA_IO_RAIL_LVDS TEGRA_IO_PAD_LVDS
- -
- #ifdef CONFIG_SOC_TEGRA_PMC
- int tegra_powergate_power_on(unsigned int id);
- int tegra_powergate_power_off(unsigned int id);
- @@ -164,10 +160,6 @@ int tegra_powergate_sequence_power_up(unsigned int id, struct clk *clk,
- int tegra_io_pad_power_enable(enum tegra_io_pad id);
- int tegra_io_pad_power_disable(enum tegra_io_pad id);
-
- -/* deprecated, use tegra_io_pad_power_{enable,disable}() instead */
- -int tegra_io_rail_power_on(unsigned int id);
- -int tegra_io_rail_power_off(unsigned int id);
- -
- void tegra_pmc_set_suspend_mode(enum tegra_suspend_mode mode);
- void tegra_pmc_enter_suspend_mode(enum tegra_suspend_mode mode);
-
- @@ -211,16 +203,6 @@ static inline int tegra_io_pad_get_voltage(enum tegra_io_pad id)
- return -ENOSYS;
- }
-
- -static inline int tegra_io_rail_power_on(unsigned int id)
- -{
- - return -ENOSYS;
- -}
- -
- -static inline int tegra_io_rail_power_off(unsigned int id)
- -{
- - return -ENOSYS;
- -}
- -
- static inline void tegra_pmc_set_suspend_mode(enum tegra_suspend_mode mode)
- {
- }
- --
- 2.44.0
- From f40dfb313467895d3a1ab6183693127e98a0aa19 Mon Sep 17 00:00:00 2001
- From: Kartik <[email protected]>
- Date: Tue, 17 Oct 2023 10:53:15 +0530
- Subject: [PATCH] mm/util: Introduce kmemdup_array()
- Introduce kmemdup_array() API to duplicate `n` number of elements
- from a given array. This internally uses kmemdup to allocate and duplicate
- the `src` array.
- Signed-off-by: Kartik <[email protected]>
- Acked-by: Kees Cook <[email protected]>
- Signed-off-by: Thierry Reding <[email protected]>
- ---
- include/linux/string.h | 1 +
- mm/util.c | 17 +++++++++++++++++
- 2 files changed, 18 insertions(+)
- diff --git a/include/linux/string.h b/include/linux/string.h
- index 5077776e995e..361294697f8c 100644
- --- a/include/linux/string.h
- +++ b/include/linux/string.h
- @@ -219,6 +219,7 @@ extern char *kstrndup(const char *s, size_t len, gfp_t gfp);
- extern void *kmemdup(const void *src, size_t len, gfp_t gfp) __realloc_size(2);
- extern void *kvmemdup(const void *src, size_t len, gfp_t gfp) __realloc_size(2);
- extern char *kmemdup_nul(const char *s, size_t len, gfp_t gfp);
- +extern void *kmemdup_array(const void *src, size_t element_size, size_t count, gfp_t gfp);
-
- extern char **argv_split(gfp_t gfp, const char *str, int *argcp);
- extern void argv_free(char **argv);
- diff --git a/mm/util.c b/mm/util.c
- index be798981acc7..c79e6f174cd9 100644
- --- a/mm/util.c
- +++ b/mm/util.c
- @@ -135,6 +135,23 @@ void *kmemdup(const void *src, size_t len, gfp_t gfp)
- }
- EXPORT_SYMBOL(kmemdup);
-
- +/**
- + * kmemdup_array - duplicate a given array.
- + *
- + * @src: array to duplicate.
- + * @element_size: size of each element of array.
- + * @count: number of elements to duplicate from array.
- + * @gfp: GFP mask to use.
- + *
- + * Return: duplicated array of @src or %NULL in case of error,
- + * result is physically contiguous. Use kfree() to free.
- + */
- +void *kmemdup_array(const void *src, size_t element_size, size_t count, gfp_t gfp)
- +{
- + return kmemdup(src, size_mul(element_size, count), gfp);
- +}
- +EXPORT_SYMBOL(kmemdup_array);
- +
- /**
- * kvmemdup - duplicate region of memory
- *
- --
- 2.44.0
- From 30f2f37b8894149f442a4f6e15c1a63635be4080 Mon Sep 17 00:00:00 2001
- From: Kartik <[email protected]>
- Date: Tue, 17 Oct 2023 10:53:16 +0530
- Subject: [PATCH] soc/tegra: fuse: Use dev_err_probe for probe failures
- Currently, in tegra_fuse_probe() if clock/reset get fails, then the
- driver prints an error if the error is not caused by -EPROBE_DEFER.
- This can be improved by using dev_err_probe() instead.
- So, return dev_err_probe() if clock/reset get fails.
- Signed-off-by: Kartik <[email protected]>
- Signed-off-by: Thierry Reding <[email protected]>
- ---
- drivers/soc/tegra/fuse/fuse-tegra.c | 17 ++++-------------
- 1 file changed, 4 insertions(+), 13 deletions(-)
- diff --git a/drivers/soc/tegra/fuse/fuse-tegra.c b/drivers/soc/tegra/fuse/fuse-tegra.c
- index a2c28f493a75..98805885158e 100644
- --- a/drivers/soc/tegra/fuse/fuse-tegra.c
- +++ b/drivers/soc/tegra/fuse/fuse-tegra.c
- @@ -131,13 +131,8 @@ static int tegra_fuse_probe(struct platform_device *pdev)
- fuse->phys = res->start;
-
- fuse->clk = devm_clk_get(&pdev->dev, "fuse");
- - if (IS_ERR(fuse->clk)) {
- - if (PTR_ERR(fuse->clk) != -EPROBE_DEFER)
- - dev_err(&pdev->dev, "failed to get FUSE clock: %ld",
- - PTR_ERR(fuse->clk));
- -
- - return PTR_ERR(fuse->clk);
- - }
- + if (IS_ERR(fuse->clk))
- + return dev_err_probe(&pdev->dev, PTR_ERR(fuse->clk), "failed to get FUSE clock\n");
-
- platform_set_drvdata(pdev, fuse);
- fuse->dev = &pdev->dev;
- @@ -179,12 +174,8 @@ static int tegra_fuse_probe(struct platform_device *pdev)
- }
-
- fuse->rst = devm_reset_control_get_optional(&pdev->dev, "fuse");
- - if (IS_ERR(fuse->rst)) {
- - err = PTR_ERR(fuse->rst);
- - dev_err(&pdev->dev, "failed to get FUSE reset: %pe\n",
- - fuse->rst);
- - return err;
- - }
- + if (IS_ERR(fuse->rst))
- + return dev_err_probe(&pdev->dev, PTR_ERR(fuse->rst), "failed to get FUSE reset\n");
-
- /*
- * FUSE clock is enabled at a boot time, hence this resume/suspend
- --
- 2.44.0
- From 2f89f2b59621343ca873f7ff6ca2ae9516cf9fae Mon Sep 17 00:00:00 2001
- From: Kartik <[email protected]>
- Date: Tue, 17 Oct 2023 10:53:17 +0530
- Subject: [PATCH] soc/tegra: fuse: Refactor resource mapping
- MIME-Version: 1.0
- Content-Type: text/plain; charset=UTF-8
- Content-Transfer-Encoding: 8bit
- To prepare for adding ACPI support to the tegra-apbmisc driver,
- relocate the code responsible for mapping memory resources from
- the function ‘tegra_init_apbmisc’ to the function
- ‘tegra_init_apbmisc_resources.’ This adjustment will allow the
- code to be shared between ‘tegra_init_apbmisc’ and the upcoming
- ‘tegra_acpi_init_apbmisc’ function.
- Signed-off-by: Kartik <[email protected]>
- Signed-off-by: Thierry Reding <[email protected]>
- ---
- drivers/soc/tegra/fuse/tegra-apbmisc.c | 37 +++++++++++++++-----------
- 1 file changed, 21 insertions(+), 16 deletions(-)
- diff --git a/drivers/soc/tegra/fuse/tegra-apbmisc.c b/drivers/soc/tegra/fuse/tegra-apbmisc.c
- index da970f3dbf35..06c1b3a2c7ec 100644
- --- a/drivers/soc/tegra/fuse/tegra-apbmisc.c
- +++ b/drivers/soc/tegra/fuse/tegra-apbmisc.c
- @@ -160,9 +160,28 @@ void __init tegra_init_revision(void)
- tegra_sku_info.platform = tegra_get_platform();
- }
-
- -void __init tegra_init_apbmisc(void)
- +static void tegra_init_apbmisc_resources(struct resource *apbmisc,
- + struct resource *straps)
- {
- void __iomem *strapping_base;
- +
- + apbmisc_base = ioremap(apbmisc->start, resource_size(apbmisc));
- + if (apbmisc_base)
- + chipid = readl_relaxed(apbmisc_base + 4);
- + else
- + pr_err("failed to map APBMISC registers\n");
- +
- + strapping_base = ioremap(straps->start, resource_size(straps));
- + if (strapping_base) {
- + strapping = readl_relaxed(strapping_base);
- + iounmap(strapping_base);
- + } else {
- + pr_err("failed to map strapping options registers\n");
- + }
- +}
- +
- +void __init tegra_init_apbmisc(void)
- +{
- struct resource apbmisc, straps;
- struct device_node *np;
-
- @@ -219,21 +238,7 @@ void __init tegra_init_apbmisc(void)
- }
- }
-
- - apbmisc_base = ioremap(apbmisc.start, resource_size(&apbmisc));
- - if (!apbmisc_base) {
- - pr_err("failed to map APBMISC registers\n");
- - } else {
- - chipid = readl_relaxed(apbmisc_base + 4);
- - }
- -
- - strapping_base = ioremap(straps.start, resource_size(&straps));
- - if (!strapping_base) {
- - pr_err("failed to map strapping options registers\n");
- - } else {
- - strapping = readl_relaxed(strapping_base);
- - iounmap(strapping_base);
- - }
- -
- + tegra_init_apbmisc_resources(&apbmisc, &straps);
- long_ram_code = of_property_read_bool(np, "nvidia,long-ram-code");
-
- put:
- --
- 2.44.0
- From 27d340f90cfca1f5761248436ead6d13affa481b Mon Sep 17 00:00:00 2001
- From: Kartik <[email protected]>
- Date: Tue, 17 Oct 2023 10:53:18 +0530
- Subject: [PATCH] soc/tegra: fuse: Add tegra_acpi_init_apbmisc()
- In preparation to ACPI support in Tegra fuse driver add function
- tegra_acpi_init_apbmisc() to initialize tegra-apbmisc driver.
- Also, document the reason of calling tegra_init_apbmisc() at early init.
- Note that function tegra_acpi_init_apbmisc() is not placed in the __init
- section, because it will be called during probe.
- Signed-off-by: Kartik <[email protected]>
- Signed-off-by: Thierry Reding <[email protected]>
- ---
- drivers/soc/tegra/fuse/fuse.h | 1 +
- drivers/soc/tegra/fuse/tegra-apbmisc.c | 72 ++++++++++++++++++++++++++
- 2 files changed, 73 insertions(+)
- diff --git a/drivers/soc/tegra/fuse/fuse.h b/drivers/soc/tegra/fuse/fuse.h
- index 90f23be73894..a41e9f85281a 100644
- --- a/drivers/soc/tegra/fuse/fuse.h
- +++ b/drivers/soc/tegra/fuse/fuse.h
- @@ -69,6 +69,7 @@ struct tegra_fuse {
-
- void tegra_init_revision(void);
- void tegra_init_apbmisc(void);
- +void tegra_acpi_init_apbmisc(void);
-
- u32 __init tegra_fuse_read_spare(unsigned int spare);
- u32 __init tegra_fuse_read_early(unsigned int offset);
- diff --git a/drivers/soc/tegra/fuse/tegra-apbmisc.c b/drivers/soc/tegra/fuse/tegra-apbmisc.c
- index 06c1b3a2c7ec..6457f80821bb 100644
- --- a/drivers/soc/tegra/fuse/tegra-apbmisc.c
- +++ b/drivers/soc/tegra/fuse/tegra-apbmisc.c
- @@ -3,9 +3,11 @@
- * Copyright (c) 2014-2023, NVIDIA CORPORATION. All rights reserved.
- */
-
- +#include <linux/acpi.h>
- #include <linux/export.h>
- #include <linux/io.h>
- #include <linux/kernel.h>
- +#include <linux/mod_devicetable.h>
- #include <linux/of.h>
- #include <linux/of_address.h>
-
- @@ -180,6 +182,12 @@ static void tegra_init_apbmisc_resources(struct resource *apbmisc,
- }
- }
-
- +/**
- + * tegra_init_apbmisc - Initializes Tegra APBMISC and Strapping registers.
- + *
- + * This is called during early init as some of the old 32-bit ARM code needs
- + * information from the APBMISC registers very early during boot.
- + */
- void __init tegra_init_apbmisc(void)
- {
- struct resource apbmisc, straps;
- @@ -244,3 +252,67 @@ void __init tegra_init_apbmisc(void)
- put:
- of_node_put(np);
- }
- +
- +#ifdef CONFIG_ACPI
- +static const struct acpi_device_id apbmisc_acpi_match[] = {
- + { "NVDA2010" },
- + { /* sentinel */ }
- +};
- +
- +void tegra_acpi_init_apbmisc(void)
- +{
- + struct resource *resources[2] = { NULL };
- + struct resource_entry *rentry;
- + struct acpi_device *adev = NULL;
- + struct list_head resource_list;
- + int rcount = 0;
- + int ret;
- +
- + adev = acpi_dev_get_first_match_dev(apbmisc_acpi_match[0].id, NULL, -1);
- + if (!adev)
- + return;
- +
- + INIT_LIST_HEAD(&resource_list);
- +
- + ret = acpi_dev_get_memory_resources(adev, &resource_list);
- + if (ret < 0) {
- + pr_err("failed to get APBMISC memory resources");
- + goto out_put_acpi_dev;
- + }
- +
- + /*
- + * Get required memory resources.
- + *
- + * resources[0]: apbmisc.
- + * resources[1]: straps.
- + */
- + resource_list_for_each_entry(rentry, &resource_list) {
- + if (rcount >= ARRAY_SIZE(resources))
- + break;
- +
- + resources[rcount++] = rentry->res;
- + }
- +
- + if (!resources[0]) {
- + pr_err("failed to get APBMISC registers\n");
- + goto out_free_resource_list;
- + }
- +
- + if (!resources[1]) {
- + pr_err("failed to get strapping options registers\n");
- + goto out_free_resource_list;
- + }
- +
- + tegra_init_apbmisc_resources(resources[0], resources[1]);
- +
- +out_free_resource_list:
- + acpi_dev_free_resource_list(&resource_list);
- +
- +out_put_acpi_dev:
- + acpi_dev_put(adev);
- +}
- +#else
- +void tegra_acpi_init_apbmisc(void)
- +{
- +}
- +#endif
- --
- 2.44.0
- From 845ff015be575e5420799944dc9fae79d14045da Mon Sep 17 00:00:00 2001
- From: Kartik <[email protected]>
- Date: Tue, 17 Oct 2023 10:53:19 +0530
- Subject: [PATCH] soc/tegra: fuse: Add function to add lookups
- Add helper function tegra_fuse_add_lookups() to register Tegra fuse
- nvmem lookups. So, this can be shared between tegra_fuse_init() and
- ACPI probe, which is to be introduced later.
- Use kmemdup_array to duplicate fuse->soc->lookups.
- Signed-off-by: Kartik <[email protected]>
- Signed-off-by: Thierry Reding <[email protected]>
- ---
- drivers/soc/tegra/fuse/fuse-tegra.c | 25 +++++++++++++++++--------
- 1 file changed, 17 insertions(+), 8 deletions(-)
- diff --git a/drivers/soc/tegra/fuse/fuse-tegra.c b/drivers/soc/tegra/fuse/fuse-tegra.c
- index 98805885158e..4ebb5597a77b 100644
- --- a/drivers/soc/tegra/fuse/fuse-tegra.c
- +++ b/drivers/soc/tegra/fuse/fuse-tegra.c
- @@ -113,6 +113,18 @@ static void tegra_fuse_restore(void *base)
- fuse->clk = NULL;
- }
-
- +static int tegra_fuse_add_lookups(struct tegra_fuse *fuse)
- +{
- + fuse->lookups = kmemdup_array(fuse->soc->lookups, sizeof(*fuse->lookups),
- + fuse->soc->num_lookups, GFP_KERNEL);
- + if (!fuse->lookups)
- + return -ENOMEM;
- +
- + nvmem_add_cell_lookups(fuse->lookups, fuse->soc->num_lookups);
- +
- + return 0;
- +}
- +
- static int tegra_fuse_probe(struct platform_device *pdev)
- {
- void __iomem *base = fuse->base;
- @@ -398,6 +410,7 @@ static int __init tegra_init_fuse(void)
- const struct of_device_id *match;
- struct device_node *np;
- struct resource regs;
- + int err;
-
- tegra_init_apbmisc();
-
- @@ -495,15 +508,11 @@ static int __init tegra_init_fuse(void)
- pr_debug("Tegra CPU Speedo ID %d, SoC Speedo ID %d\n",
- tegra_sku_info.cpu_speedo_id, tegra_sku_info.soc_speedo_id);
-
- - if (fuse->soc->lookups) {
- - size_t size = sizeof(*fuse->lookups) * fuse->soc->num_lookups;
- -
- - fuse->lookups = kmemdup(fuse->soc->lookups, size, GFP_KERNEL);
- - if (fuse->lookups)
- - nvmem_add_cell_lookups(fuse->lookups, fuse->soc->num_lookups);
- - }
- + err = tegra_fuse_add_lookups(fuse);
- + if (err)
- + pr_err("failed to add FUSE lookups\n");
-
- - return 0;
- + return err;
- }
- early_initcall(tegra_init_fuse);
-
- --
- 2.44.0
- From 1c4b913a7b389937f3b2d69d5bcdef4b6ebada14 Mon Sep 17 00:00:00 2001
- From: Kartik <[email protected]>
- Date: Tue, 17 Oct 2023 10:53:20 +0530
- Subject: [PATCH] soc/tegra: fuse: Add function to print SKU info
- Add helper function tegra_fuse_print_sku_info() to print Tegra SKU
- information. So, it can be shared between tegra_fuse_init() and
- ACPI probe which is to be introduced later.
- Signed-off-by: Kartik <[email protected]>
- Signed-off-by: Thierry Reding <[email protected]>
- ---
- drivers/soc/tegra/fuse/fuse-tegra.c | 17 +++++++++++------
- 1 file changed, 11 insertions(+), 6 deletions(-)
- diff --git a/drivers/soc/tegra/fuse/fuse-tegra.c b/drivers/soc/tegra/fuse/fuse-tegra.c
- index 4ebb5597a77b..7a93c6512f7b 100644
- --- a/drivers/soc/tegra/fuse/fuse-tegra.c
- +++ b/drivers/soc/tegra/fuse/fuse-tegra.c
- @@ -113,6 +113,16 @@ static void tegra_fuse_restore(void *base)
- fuse->clk = NULL;
- }
-
- +static void tegra_fuse_print_sku_info(struct tegra_sku_info *tegra_sku_info)
- +{
- + pr_info("Tegra Revision: %s SKU: %d CPU Process: %d SoC Process: %d\n",
- + tegra_revision_name[tegra_sku_info->revision],
- + tegra_sku_info->sku_id, tegra_sku_info->cpu_process_id,
- + tegra_sku_info->soc_process_id);
- + pr_debug("Tegra CPU Speedo ID %d, SoC Speedo ID %d\n",
- + tegra_sku_info->cpu_speedo_id, tegra_sku_info->soc_speedo_id);
- +}
- +
- static int tegra_fuse_add_lookups(struct tegra_fuse *fuse)
- {
- fuse->lookups = kmemdup_array(fuse->soc->lookups, sizeof(*fuse->lookups),
- @@ -501,12 +511,7 @@ static int __init tegra_init_fuse(void)
-
- fuse->soc->init(fuse);
-
- - pr_info("Tegra Revision: %s SKU: %d CPU Process: %d SoC Process: %d\n",
- - tegra_revision_name[tegra_sku_info.revision],
- - tegra_sku_info.sku_id, tegra_sku_info.cpu_process_id,
- - tegra_sku_info.soc_process_id);
- - pr_debug("Tegra CPU Speedo ID %d, SoC Speedo ID %d\n",
- - tegra_sku_info.cpu_speedo_id, tegra_sku_info.soc_speedo_id);
- + tegra_fuse_print_sku_info(&tegra_sku_info);
-
- err = tegra_fuse_add_lookups(fuse);
- if (err)
- --
- 2.44.0
- From b89bfe274e7a49db3b69108037c2fefc50ebec5b Mon Sep 17 00:00:00 2001
- From: Kartik <[email protected]>
- Date: Tue, 17 Oct 2023 10:53:21 +0530
- Subject: [PATCH] soc/tegra: fuse: Add ACPI support for Tegra194 and Tegra234
- Add ACPI support for Tegra194 & Tegra243 SoC's. This requires
- following modifications to the probe when ACPI boot is used:
- - Initialize soc data.
- - Add nvmem lookups.
- - Register soc device.
- - use devm_clk_get_optional() instead of devm_clk_get() to get
- fuse->clk, as fuse clocks are not required when using ACPI boot.
- Also, drop '__init' keyword for tegra_soc_device_register() as this is also
- used by tegra_fuse_probe() and use dev_err_probe() wherever applicable.
- Signed-off-by: Kartik <[email protected]>
- Signed-off-by: Thierry Reding <[email protected]>
- ---
- drivers/soc/tegra/fuse/fuse-tegra.c | 52 +++++++++++++++++++++++++++--
- 1 file changed, 49 insertions(+), 3 deletions(-)
- diff --git a/drivers/soc/tegra/fuse/fuse-tegra.c b/drivers/soc/tegra/fuse/fuse-tegra.c
- index 7a93c6512f7b..1c758f121f91 100644
- --- a/drivers/soc/tegra/fuse/fuse-tegra.c
- +++ b/drivers/soc/tegra/fuse/fuse-tegra.c
- @@ -3,11 +3,13 @@
- * Copyright (c) 2013-2023, NVIDIA CORPORATION. All rights reserved.
- */
-
- +#include <linux/acpi.h>
- #include <linux/clk.h>
- #include <linux/device.h>
- #include <linux/kobject.h>
- #include <linux/init.h>
- #include <linux/io.h>
- +#include <linux/mod_devicetable.h>
- #include <linux/nvmem-consumer.h>
- #include <linux/nvmem-provider.h>
- #include <linux/of.h>
- @@ -152,7 +154,38 @@ static int tegra_fuse_probe(struct platform_device *pdev)
- return PTR_ERR(fuse->base);
- fuse->phys = res->start;
-
- - fuse->clk = devm_clk_get(&pdev->dev, "fuse");
- + /* Initialize the soc data and lookups if using ACPI boot. */
- + if (is_acpi_node(dev_fwnode(&pdev->dev)) && !fuse->soc) {
- + u8 chip;
- +
- + tegra_acpi_init_apbmisc();
- +
- + chip = tegra_get_chip_id();
- + switch (chip) {
- +#if defined(CONFIG_ARCH_TEGRA_194_SOC)
- + case TEGRA194:
- + fuse->soc = &tegra194_fuse_soc;
- + break;
- +#endif
- +#if defined(CONFIG_ARCH_TEGRA_234_SOC)
- + case TEGRA234:
- + fuse->soc = &tegra234_fuse_soc;
- + break;
- +#endif
- + default:
- + return dev_err_probe(&pdev->dev, -EINVAL, "Unsupported SoC: %02x\n", chip);
- + }
- +
- + fuse->soc->init(fuse);
- + tegra_fuse_print_sku_info(&tegra_sku_info);
- + tegra_soc_device_register();
- +
- + err = tegra_fuse_add_lookups(fuse);
- + if (err)
- + return dev_err_probe(&pdev->dev, err, "failed to add FUSE lookups\n");
- + }
- +
- + fuse->clk = devm_clk_get_optional(&pdev->dev, "fuse");
- if (IS_ERR(fuse->clk))
- return dev_err_probe(&pdev->dev, PTR_ERR(fuse->clk), "failed to get FUSE clock\n");
-
- @@ -275,10 +308,17 @@ static const struct dev_pm_ops tegra_fuse_pm = {
- SET_SYSTEM_SLEEP_PM_OPS(tegra_fuse_suspend, tegra_fuse_resume)
- };
-
- +static const struct acpi_device_id tegra_fuse_acpi_match[] = {
- + { "NVDA200F" },
- + { /* sentinel */ }
- +};
- +MODULE_DEVICE_TABLE(acpi, tegra_fuse_acpi_match);
- +
- static struct platform_driver tegra_fuse_driver = {
- .driver = {
- .name = "tegra-fuse",
- .of_match_table = tegra_fuse_match,
- + .acpi_match_table = tegra_fuse_acpi_match,
- .pm = &tegra_fuse_pm,
- .suppress_bind_attrs = true,
- },
- @@ -300,7 +340,13 @@ u32 __init tegra_fuse_read_early(unsigned int offset)
-
- int tegra_fuse_readl(unsigned long offset, u32 *value)
- {
- - if (!fuse->read || !fuse->clk)
- + /*
- + * Wait for fuse->clk to be initialized if device-tree boot is used.
- + */
- + if (is_of_node(dev_fwnode(fuse->dev)) && !fuse->clk)
- + return -EPROBE_DEFER;
- +
- + if (!fuse->read)
- return -EPROBE_DEFER;
-
- if (IS_ERR(fuse->clk))
- @@ -383,7 +429,7 @@ const struct attribute_group tegra194_soc_attr_group = {
- };
- #endif
-
- -struct device * __init tegra_soc_device_register(void)
- +struct device *tegra_soc_device_register(void)
- {
- struct soc_device_attribute *attr;
- struct soc_device *dev;
- --
- 2.44.0
- From 4009fd6095c6a524606a098c9557d226d31b3bfe Mon Sep 17 00:00:00 2001
- From: Kartik <[email protected]>
- Date: Tue, 17 Oct 2023 10:53:22 +0530
- Subject: [PATCH] soc/tegra: fuse: Add support for Tegra241
- Add support for Tegra241 which use ACPI boot.
- Signed-off-by: Kartik <[email protected]>
- Signed-off-by: Thierry Reding <[email protected]>
- ---
- drivers/soc/tegra/Kconfig | 5 +++++
- drivers/soc/tegra/fuse/fuse-tegra.c | 5 +++++
- drivers/soc/tegra/fuse/fuse-tegra30.c | 20 ++++++++++++++++++++
- drivers/soc/tegra/fuse/fuse.h | 4 ++++
- drivers/soc/tegra/fuse/tegra-apbmisc.c | 1 +
- include/soc/tegra/fuse.h | 1 +
- 6 files changed, 36 insertions(+)
- diff --git a/drivers/soc/tegra/Kconfig b/drivers/soc/tegra/Kconfig
- index 6f3098822969..5f5d9d663fef 100644
- --- a/drivers/soc/tegra/Kconfig
- +++ b/drivers/soc/tegra/Kconfig
- @@ -133,6 +133,11 @@ config ARCH_TEGRA_234_SOC
- help
- Enable support for the NVIDIA Tegra234 SoC.
-
- +config ARCH_TEGRA_241_SOC
- + bool "NVIDIA Tegra241 SoC"
- + help
- + Enable support for the NVIDIA Tegra241 SoC.
- +
- endif
- endif
-
- diff --git a/drivers/soc/tegra/fuse/fuse-tegra.c b/drivers/soc/tegra/fuse/fuse-tegra.c
- index 1c758f121f91..233b8e7bb41b 100644
- --- a/drivers/soc/tegra/fuse/fuse-tegra.c
- +++ b/drivers/soc/tegra/fuse/fuse-tegra.c
- @@ -171,6 +171,11 @@ static int tegra_fuse_probe(struct platform_device *pdev)
- case TEGRA234:
- fuse->soc = &tegra234_fuse_soc;
- break;
- +#endif
- +#if defined(CONFIG_ARCH_TEGRA_241_SOC)
- + case TEGRA241:
- + fuse->soc = &tegra241_fuse_soc;
- + break;
- #endif
- default:
- return dev_err_probe(&pdev->dev, -EINVAL, "Unsupported SoC: %02x\n", chip);
- diff --git a/drivers/soc/tegra/fuse/fuse-tegra30.c b/drivers/soc/tegra/fuse/fuse-tegra30.c
- index e94d46372a63..2070d36c510d 100644
- --- a/drivers/soc/tegra/fuse/fuse-tegra30.c
- +++ b/drivers/soc/tegra/fuse/fuse-tegra30.c
- @@ -678,3 +678,23 @@ const struct tegra_fuse_soc tegra234_fuse_soc = {
- .clk_suspend_on = false,
- };
- #endif
- +
- +#if defined(CONFIG_ARCH_TEGRA_241_SOC)
- +static const struct tegra_fuse_info tegra241_fuse_info = {
- + .read = tegra30_fuse_read,
- + .size = 0x16008,
- + .spare = 0xcf0,
- +};
- +
- +static const struct nvmem_keepout tegra241_fuse_keepouts[] = {
- + { .start = 0xc, .end = 0x1600c }
- +};
- +
- +const struct tegra_fuse_soc tegra241_fuse_soc = {
- + .init = tegra30_fuse_init,
- + .info = &tegra241_fuse_info,
- + .keepouts = tegra241_fuse_keepouts,
- + .num_keepouts = ARRAY_SIZE(tegra241_fuse_keepouts),
- + .soc_attr_group = &tegra194_soc_attr_group,
- +};
- +#endif
- diff --git a/drivers/soc/tegra/fuse/fuse.h b/drivers/soc/tegra/fuse/fuse.h
- index a41e9f85281a..f3b705327c20 100644
- --- a/drivers/soc/tegra/fuse/fuse.h
- +++ b/drivers/soc/tegra/fuse/fuse.h
- @@ -136,4 +136,8 @@ extern const struct tegra_fuse_soc tegra194_fuse_soc;
- extern const struct tegra_fuse_soc tegra234_fuse_soc;
- #endif
-
- +#ifdef CONFIG_ARCH_TEGRA_241_SOC
- +extern const struct tegra_fuse_soc tegra241_fuse_soc;
- +#endif
- +
- #endif
- diff --git a/drivers/soc/tegra/fuse/tegra-apbmisc.c b/drivers/soc/tegra/fuse/tegra-apbmisc.c
- index 6457f80821bb..e2ca5d55fd31 100644
- --- a/drivers/soc/tegra/fuse/tegra-apbmisc.c
- +++ b/drivers/soc/tegra/fuse/tegra-apbmisc.c
- @@ -64,6 +64,7 @@ bool tegra_is_silicon(void)
- switch (tegra_get_chip_id()) {
- case TEGRA194:
- case TEGRA234:
- + case TEGRA241:
- case TEGRA264:
- if (tegra_get_platform() == 0)
- return true;
- diff --git a/include/soc/tegra/fuse.h b/include/soc/tegra/fuse.h
- index 3a513be50243..8f421b9f7585 100644
- --- a/include/soc/tegra/fuse.h
- +++ b/include/soc/tegra/fuse.h
- @@ -17,6 +17,7 @@
- #define TEGRA186 0x18
- #define TEGRA194 0x19
- #define TEGRA234 0x23
- +#define TEGRA241 0x24
- #define TEGRA264 0x26
-
- #define TEGRA_FUSE_SKU_CALIB_0 0xf0
- --
- 2.44.0
- From 9f3808742d74a477f686fe13ac43daa3680233af Mon Sep 17 00:00:00 2001
- From: Kartik <[email protected]>
- Date: Wed, 20 Dec 2023 11:40:13 +0530
- Subject: [PATCH] soc/tegra: fuse: Define tegra194_soc_attr_group for Tegra241
- Tegra241 SoC data uses tegra194_soc_attr_group, which is only defined
- if config CONFIG_ARCH_TEGRA_194_SOC or CONFIG_ARCH_TEGRA_234_SOC or
- both are enabled. This causes a build failure if both of these configs
- are disabled and CONFIG_ARCH_TEGRA_241_SOC is enabled.
- Define tegra194_soc_attr_group if CONFIG_ARCH_TEGRA_241_SOC is enabled.
- Signed-off-by: Kartik <[email protected]>
- Acked-by: Randy Dunlap <[email protected]>
- Tested-by: Randy Dunlap <[email protected]> # build-tested
- Signed-off-by: Thierry Reding <[email protected]>
- ---
- drivers/soc/tegra/fuse/fuse-tegra.c | 3 ++-
- drivers/soc/tegra/fuse/fuse.h | 3 ++-
- 2 files changed, 4 insertions(+), 2 deletions(-)
- diff --git a/drivers/soc/tegra/fuse/fuse-tegra.c b/drivers/soc/tegra/fuse/fuse-tegra.c
- index 233b8e7bb41b..c34efa5bf44c 100644
- --- a/drivers/soc/tegra/fuse/fuse-tegra.c
- +++ b/drivers/soc/tegra/fuse/fuse-tegra.c
- @@ -407,7 +407,8 @@ const struct attribute_group tegra_soc_attr_group = {
- };
-
- #if IS_ENABLED(CONFIG_ARCH_TEGRA_194_SOC) || \
- - IS_ENABLED(CONFIG_ARCH_TEGRA_234_SOC)
- + IS_ENABLED(CONFIG_ARCH_TEGRA_234_SOC) || \
- + IS_ENABLED(CONFIG_ARCH_TEGRA_241_SOC)
- static ssize_t platform_show(struct device *dev, struct device_attribute *attr,
- char *buf)
- {
- diff --git a/drivers/soc/tegra/fuse/fuse.h b/drivers/soc/tegra/fuse/fuse.h
- index f3b705327c20..9fee6ad6ad9e 100644
- --- a/drivers/soc/tegra/fuse/fuse.h
- +++ b/drivers/soc/tegra/fuse/fuse.h
- @@ -124,7 +124,8 @@ extern const struct tegra_fuse_soc tegra186_fuse_soc;
- #endif
-
- #if IS_ENABLED(CONFIG_ARCH_TEGRA_194_SOC) || \
- - IS_ENABLED(CONFIG_ARCH_TEGRA_234_SOC)
- + IS_ENABLED(CONFIG_ARCH_TEGRA_234_SOC) || \
- + IS_ENABLED(CONFIG_ARCH_TEGRA_241_SOC)
- extern const struct attribute_group tegra194_soc_attr_group;
- #endif
-
- --
- 2.44.0
- From 6f4afa855941eec29f95a5facc3af8ceda9fc613 Mon Sep 17 00:00:00 2001
- From: Jon Hunter <[email protected]>
- Date: Fri, 16 Feb 2024 11:57:48 +0000
- Subject: [PATCH] arm64: tegra: Fix Tegra234 MGBE power-domains
- The MGBE power-domains on Tegra234 are mapped to the MGBE controllers as
- follows:
- MGBE0 (0x68000000) --> Power-Domain MGBEB
- MGBE1 (0x69000000) --> Power-Domain MGBEC
- MGBE2 (0x6a000000) --> Power-Domain MGBED
- Update the device-tree nodes for Tegra234 to correct this.
- Fixes: 610cdf3186bc ("arm64: tegra: Add MGBE nodes on Tegra234")
- Signed-off-by: Jon Hunter <[email protected]>
- Signed-off-by: Thierry Reding <[email protected]>
- ---
- arch/arm64/boot/dts/nvidia/tegra234.dtsi | 6 +++---
- 1 file changed, 3 insertions(+), 3 deletions(-)
- diff --git a/arch/arm64/boot/dts/nvidia/tegra234.dtsi b/arch/arm64/boot/dts/nvidia/tegra234.dtsi
- index 3f16595d099c..d1bd328892af 100644
- --- a/arch/arm64/boot/dts/nvidia/tegra234.dtsi
- +++ b/arch/arm64/boot/dts/nvidia/tegra234.dtsi
- @@ -1459,7 +1459,7 @@ ethernet@6800000 {
- <&mc TEGRA234_MEMORY_CLIENT_MGBEAWR &emc>;
- interconnect-names = "dma-mem", "write";
- iommus = <&smmu_niso0 TEGRA234_SID_MGBE>;
- - power-domains = <&bpmp TEGRA234_POWER_DOMAIN_MGBEA>;
- + power-domains = <&bpmp TEGRA234_POWER_DOMAIN_MGBEB>;
- status = "disabled";
- };
-
- @@ -1493,7 +1493,7 @@ ethernet@6900000 {
- <&mc TEGRA234_MEMORY_CLIENT_MGBEBWR &emc>;
- interconnect-names = "dma-mem", "write";
- iommus = <&smmu_niso0 TEGRA234_SID_MGBE_VF1>;
- - power-domains = <&bpmp TEGRA234_POWER_DOMAIN_MGBEB>;
- + power-domains = <&bpmp TEGRA234_POWER_DOMAIN_MGBEC>;
- status = "disabled";
- };
-
- @@ -1527,7 +1527,7 @@ ethernet@6a00000 {
- <&mc TEGRA234_MEMORY_CLIENT_MGBECWR &emc>;
- interconnect-names = "dma-mem", "write";
- iommus = <&smmu_niso0 TEGRA234_SID_MGBE_VF2>;
- - power-domains = <&bpmp TEGRA234_POWER_DOMAIN_MGBEC>;
- + power-domains = <&bpmp TEGRA234_POWER_DOMAIN_MGBED>;
- status = "disabled";
- };
-
- --
- 2.44.0
|