#
…

2021-04-11

00:02hspak has quit [Ping timeout: 252 seconds]
00:32jeffmiw_ has quit [Remote host closed the connection]
01:03troseman has joined #asahi
01:27zkrx has quit [Ping timeout: 240 seconds]
01:30odmir has quit [Remote host closed the connection]
01:31odmir has joined #asahi
01:33hspak has joined #asahi
01:36odmir has quit [Ping timeout: 268 seconds]
01:42zkrx has joined #asahi
02:03odmir has joined #asahi
02:34odmir has quit [Remote host closed the connection]
02:34odmir has joined #asahi
02:51bdju has quit [Read error: Connection reset by peer]
02:51bdju has joined #asahi
02:57phiologe has quit [Ping timeout: 250 seconds]
02:57phiologe has joined #asahi
03:08marvin24 has quit [Ping timeout: 245 seconds]
03:09marvin24 has joined #asahi
03:50troseman has quit [Ping timeout: 260 seconds]
04:09TheJollyRoger has quit [Remote host closed the connection]
04:10TheJollyRoger has joined #asahi
04:25odmir has quit [Remote host closed the connection]
04:26odmir has joined #asahi
04:30odmir has quit [Ping timeout: 240 seconds]
04:33jeffmiw_ has joined #asahi
04:37jeffmiw_ has quit [Ping timeout: 240 seconds]
05:26tomtastic has quit [Ping timeout: 240 seconds]
05:28tomtastic has joined #asahi
06:39VinDuv has joined #asahi
06:54mxw39 has quit [Quit: Konversation terminated!]
07:53ephe_meral1 has joined #asahi
09:00h_ro[m] has quit [Quit: Idle for 30+ days]
09:37angelXwind has quit [Ping timeout: 240 seconds]
09:39jeffmiw_ has joined #asahi
09:41luca020400 has quit [Quit: WeeChat 3.1]
09:42luca020400 has joined #asahi
09:47akemin_dayo has joined #asahi
09:48jeffmiw_ has quit []
10:05Necrosporus has quit [Ping timeout: 240 seconds]
10:34vimal has quit [Quit: Leaving]
10:42vimal has joined #asahi
10:45Necrosporus has joined #asahi
10:49vimal has quit [Remote host closed the connection]
10:51vimal has joined #asahi
10:55vimal has quit [Client Quit]
11:16klaus has joined #asahi
11:43raster has joined #asahi
12:16inglor has quit [Quit: https://quassel-irc.org - Chat comfortably. Anywhere.]
12:17inglor has joined #asahi
13:20svenmarcan: https://github.com/svenpeter42/linux/commits/apple-clk here's what i have for the gate clocks. i'll send it to the lists later if that's fine with you
13:22marcansven: isn't this ioremapping a whole page for every 32-bit clock index? this seems sub-optimal
13:23marcanshouldn't it be one clock controller node with clock IDs corresponding to register indices? or perhaps one clock controller with subclock nodes that have reg offsets relative to the parent?
13:24svenyeah, i thought about that
13:24svenfor the first one i'd then have to hardcode child/parent relationships in the driver itself
13:24svenand i haven't found any other driver doing the second thing
13:25marcanis any other soc doing what you do here?
13:29marcansven: look at assigned-clock-parents and assigned-clocks
13:30marcanI think that can specify parent relationships within a single clock controller
13:30sventhere's a general gpio gate clock driver but that's based on the gpio subssytem. the closest one is renesas,r7s72100-mstp-clocks i think
13:31marcansven: look at freescale/imx8mq.dtsi
13:32marcanthat sets up parents within a single clock controller
13:32marcanas well as some default rates
13:32marcanyou should be able to do the same thing, and just have one single clock controller instance
13:33svenoh, i thought assigned-clocks was just for the consumers
13:33marcanlooks like it works everywhere
13:33marcanwhich makes sense if you think about it
13:33svenright.. so essentially pretend that the controller is a consumer of itself and do it there
13:33marcanwhich it *is*
13:33svenmakes sense
13:34svengood thing i kept my original code where it was just a single controller ;)
13:34svenwell, two actually because they seem to have two. but same thing
13:53klaus__ has joined #asahi
14:01klaus___ has joined #asahi
14:03klaus__ has quit [Quit: Lost terminal]
14:15kettenis_assigned-clock-parents is to initially set the muxes when there are multiple parent clocks to choose from
14:17kettenis_the benfit of the "one node per clock" strategy is that you don't have to define clock IDs and can make the clock hierarchy explicit in the device tree instead of coding it in the clock driver
14:18kettenis_but the "one node per clock module" model seems to be preferred by the Linux maintainers these days
14:18zopieux has quit [Quit: zopieux]
14:19kettenis_btw, just pushed a draft pull request for the PCIe initialization code for m1n1
14:19choozy has joined #asahi
14:19klaus has quit [Disconnected by services]
14:20klaus___ is now known as kluas
14:20kluas is now known as klaus
14:21zopieux has joined #asahi
14:26choozy has quit [Quit: https://quassel-irc.org - Chat comfortably. Anywhere.]
14:27kettenis_in the "one node per clock" model you can probably avoid ioremapping the same page multiple times by using a regmap
14:35zopieux has quit [Ping timeout: 258 seconds]
14:37zopieux has joined #asahi
14:38svenyeah, assigned-clock-parents won't work
14:39svenif i want a single clock controller node i think i either have to hardcode the parents in the driver or invent some new dt property
14:48glibc has left #asahi [#asahi]
14:49taziden has quit [Ping timeout: 246 seconds]
14:56marcansven: what kettenis_ said, use a regmap and child nodes
14:56marcanyou still want one device bound to the overall clock controller, but you can have subnodes for the actual clocks
14:56marcanoption #2 above
14:56svensure, it's just that no other soc seems to do that afaict
14:57marcanmaybe ask robher? :)
14:57sventhey seem to all use clock-indices together with hardcoded parents in the driver
14:57svenheh, now that would be too easy :-P
14:57marcanheh, ugly
14:58marcanbut we're doing things right here (see: how I fixed the arm timer to suck less after several SoCs were already using dirty hacks to work around it)
14:58marcanso if we have to define a new binding or use a new style, we do :p
14:58kettenis_sunxi went from a node-per-clock to a single clock node a few years ago
14:58kettenis_I never understood why
15:00kettenis_anyway, to create a regmap you needs a "syscon" compatible node
15:00ephe_meral1 has quit [Ping timeout: 250 seconds]
15:01kettenis_if you want the clock nodes to be children of that, it also needs a "simple-mfd" compatible
15:06marcansince the regmap is on real mmio, apparently another way to do it is as a bus
15:07marcansee: arch/arm/boot/dts/omap5-l4.dtsi
15:07marcanand omap54xx-clocks.dtsi
15:09kettenis_don't think that is a sensible example to follow
15:09kettenis_my understanding omap is done that way since there actually is a bus that can be powered on and off
15:26taziden has joined #asahi
15:41vimal has joined #asahi
16:27odmir has joined #asahi
16:31odmir has quit [Ping timeout: 240 seconds]
17:02tmlind has joined #asahi
17:05tmlindmarcan: the "new" clkctrl clocks for omaps use a clockdomain controller + reg offset + gate/mux/divider bit offset, no need to look at any of the old omap54xx-clocks.dtsi stuff for most part
17:06tmlindkettenis: there's a ti specific wrapper ip for each device target on the interconnect that needs to be configured for pm, well the hierarchy also brings genpd stuff for free then
17:07tmlindbut yeah i'd recommend one dts node for a clock controller, then have the binding map the clock instances from that base with offset and optional bits if needed
17:11tmlindthen it's worth checking if each clock controller instance might have some clock domain specific bit for pm for example?
17:12tmlindin any case, don't use any artificial indexing with dts for the instances, makes things hard if you find an extra clock somewhere in between later on :)
17:14marcantmlind: the question is how to declare the hierarchy in the dts
17:15marcansubnodes of the clock controller? something else?
17:22odmir_ has joined #asahi
17:43tmlindhmm so which hieararchy are you talking about? should not be needed for clocks?
17:46tmlindto me it sounded like you just want #clock-cells = <1>, or <2> if you also need to map bits in a single clock register
17:48raster has quit [Quit: Gettin' stinky!]
17:48tmlindand assigned-clock-parents works just fine for a single node for a clock controller no problem
17:54svento enable access to e.g. the uart mmio region we need to ungate a clock called uart0. but that clock itself is a child of uart_p which is a child of sio which is a child of sio_busif in apple's device tree. if any of the parents are disabled you can't enable the uart0 clock
17:54svenand the question is how and where to encode that toplogy. afaict most drivers just hardcode it in some .c file
17:57choozy has joined #asahi
17:58tmlindyeah so those are on some device that's always powered, probably best to keep it out of the hierarchy, or probe those parts of the hierarchy first
17:59svenno, they are not on any other device afaict.
18:00tmlindwell on some interconnect inside the soc i mean :)
18:00svenoh, sure
18:00svenbut how do we represent that?
18:01tmlindwell you could just have the clock controller as a top level node, along what's done for gic etc
18:06tmlindwell aic in this case, not gic :)
18:09sveni'm not sure i understand
18:10plainbits has joined #asahi
18:10svenlet me look at some gic bindings though :)
18:11tmlindhmm so is the clock gate register stuffed somewhre within the uart address space? or is the uart clock gate in some clock controller device with a bunch of clocks?
18:11sventhe second one
18:11svenit's in some clock controller device with a bunch of clocks
18:12marcantmlind: it's not about the clock controller itself, it's about encoding the hierarchy of clocks it controls
18:12marcani.e. dependencies
18:13tmlindyeah ok.. so is the clock controller really a child of the uart or am i missing something?
18:14sventhe clock controller is separate. but the clocks which are children of that controller have a hierarchy
18:14svenand the uart needs one of these clocks
18:15tmlindok makes more sense now thanks :)
18:15svenso the uart node just gets a clocks = <&clk-controller 25>; or something like that. but that clock with the id 25 needs clock 13 which in turn needs clock 7
18:16tmlindwell you can do the clock tree hierarchy in the clock controller driver, no need to stuff it into dts
18:16marcanbut then that makes the driver less generic
18:16marcanAIUI this clock stuff is uniform enough it ought to work for quite a few apple SoCs
18:16marcanbut obviously they will have different hierarchies
18:17marcanif we start hardcoding the tree in the driver, that means the driver becomes soc-specific
18:18tmlindyeah that's where all the drivers are heading though to avoid custom bindings with the logic being the driver needs to understand the hardware :)
18:18tmlindsure if you can make something generic with minimal bindings, even better
18:18kettenis_I don't see the logic there though ;)
18:21tmlindso are you thinking to just process the apple dtb for clocks, then have driver use that?
18:21tmlindafter translating to the standard dts format i mean
18:25marcanwe're not processing the apple dtb, we're writing our own devicetrees
18:25marcanbut I would much rather have drivers generic enough that they can work with multiple SoC generations if the register interface and such is the same, so we only need new devicetrees where possible
18:26tmlindsure that would be ideal if you can do that with mostly standard bindings :)
18:26marcanthe plan is to write some tooling to parse and convert apple devicetrees as a human-guided operation for bringing up new boards and SoCs, but it wouldn't be structured as a straight conversion
18:27marcanmore like a pile of python scripts that can, say, automatically fill in IRQ numbers and clocks and such, but without restricting how our bindings look
18:27tmlindyeah sure. so you're thinking the whole clock hierarchy is there too already in the apple dtb?
18:31tmlindok, it's been few months since i looked that that stuff
18:32sventheir nodes have a "clock-gates" property which indexes into a binary array that's passes as "devices" of the "arm-io/pmgr" node
18:32svenand that "devices" property contains the whole hierarchy
18:32svenit's a little weird :)
18:32solarkraft has quit [Ping timeout: 240 seconds]
18:33marcanapple really likes to put blobs in DT properties
18:33marcanwith random packed structures
18:33tmlindwell you could use that to automatically generate the clock controller driver clocks and just expose the top level dts node :)
18:34marcanuse that from where?
18:34tmlindparse from the apple dtb if it has the necessary data
18:34marcanand do what with the data? :)
18:34marcanlinux doesn't touch the adt
18:34tmlindset up the clock controller driver clock instances for regs and bits
18:35marcanm1n1 is the bridge between adt and fdt, linux doesn't get to see the adt (by design)
18:35tmlindheh i mean one-time parse with some script to produce the driver internal data
18:35tmlindnot parsed in the kernel
18:36marcanah, and then embed it in the driver?
18:36marcanbut then we're back to the driver being soc-specific
18:36tmlindyeah that's where linux has been heading good or bad.. see wc -l for drivers/clk and drivers/pinctrl for example
18:37tmlindwell after find for .c files that is
18:37marcanI mean... I don't particularly care about "where linux has been heading" (especially when it's vendor people writing the code) and more about "where linux should head" :-)
18:37marcanif there's a good reason for doing it this way, fine
18:37marcanbut I'd like to hear the reason :)
18:38tmlindwell one issue is dealing with the sprawling amount of custom bindings, so the binding should be ideally generic, like interrupts-extended for example
18:39tmlindthen some folks do not like the idea of a driver doing something purely based on devicetree data
18:39kettenis_I suppose the reasoning is that since the device tree is bundled with the kernel it doens't matter whether you add the data in the device tree or in the driver
18:39kettenis_but that doesn't apply here
18:39marcanwell, ultimately custom bindings for any given block are pretty much necessary depending on what needs to be expressed, but at least here we were trying to look at ways of expressing this using established patterns
18:39marcanlike regmap stuff and such
18:40tmlindyeah try to leave out custom bindings, that will save many merge cycles on mailing list discussions :)
18:40marcanI mean, DTs may live in the kernel tree but they aren't bundled inside the kernel
18:41marcanand doing this in the DT might mean the difference between a random Ubuntu release booting on newer Macs with just a m1n1 update, and needing to wait a year for a kernel bump
18:41tmlindpersonally, i do not like the ongoing static data bloat in drivers/clk and drivers/pinctrl, and ideally we'd have devicetree provide the necessary data for the booted processor
18:44tmlindsounds like expressing a clock hierarchy in a dts file in a generic way could be few years of mailing list discussions though :)
18:45kettenis_the generic clock bindings already provide a way to express the hierarchy
18:45tmlindoh, do you have some example to look at?
18:45kettenis_the only thing that's needed is a compatible for the apple-specific clock layout
18:46kettenis_register layout I mean
18:47tmlindhmm so what is the meaning of the apple-specific clock layout then?
18:49ephe_meral1 has joined #asahi
18:49kettenis_you still need a small driver to actually set the right bits in the 32-bit clock register
18:50tmlindthe clk24 there or something else?
18:51kettenis_compatible = "apple,pmgr-clk-gate";
18:51kettenis_the nodes that have that
18:51tmlindyeah ok like pcie_ref_clk
18:51kettenis_this is how Corellium did things in their "proof-of-concept"
18:52tmlindtyping from it :)
18:52kettenis_as far as we can tell apple has been using the same 32-bit register layout for several enerations of iphones now
18:52kettenis_generatons even
18:53kettenis_i can't type, but you get the point
18:53tmlindso with the apple-specific clock layout, what's the info, like parent and rate?
18:53kettenis_the only thing that seems to vary is the number of registers (i.e. the number of clocks) and the hierarchy
18:54kettenis_so we think it is reasonable to assume this is likelyto stay the same in future SoCs
18:54sventhese clocks are only used to enable access to mmio regions essentially. there are additional clocks that actually have a rate associated with them, which we mostly ignore for now
18:55sven("clock-ids" in the ADT which maps to clock-frequencies in the arm-io node)
18:55marcanthey're clock gates
18:55sven(i think these "clock-ids" clocks are actually mux clocks pre-configured by iboot. but that's an educated guess)
18:56marcankeep in mind there's a power manager core too, I don't know how much of this is real registers and how much is somehow backed by that thing
18:57tmlindhmm right
18:58kettenis_you communicate with the "SMC" through a mailbox interface
18:58sventhere are also many more regs in the pmgr node. who knows what's hidden there as well
19:00tmlindso is there any grouping of these clocks by the controller in the apple dtb?
19:04vimal has quit [Remote host closed the connection]
19:05kettenis_not sure what you mean by this, but the 32-bit clock gate registers are part of a few (two?) larger blocks of mmio space
19:05svenyeah, they are part of two larger blocks
19:05sventhere's also some "power domain" stuff but i haven't looked into that yet
19:06kettenis_the way corellium implements this you end up mapping a full page for each 32-bit register
19:06marcanthat's what sven did in the patch above
19:06kettenis_hence the suggestion to use a regmap
19:06marcanwhich I complained about
19:07vimal has joined #asahi
19:10tmlindso there might be something like a clock controller device, then a bunch of gate or mux registers
19:20sventhe mux registers are in a different mmio block fwiw
19:31odmir_ has quit [Remote host closed the connection]
19:31vimal has quit [Remote host closed the connection]
19:32odmir has joined #asahi
19:35plainbits has quit [Quit: Textual IRC Client: www.textualapp.com]
19:36odmir has quit [Ping timeout: 240 seconds]
19:48vimal has joined #asahi
19:49choozy has quit [Quit: https://quassel-irc.org - Chat comfortably. Anywhere.]
20:02odmir has joined #asahi
20:07VinDuv has quit [Quit: Leaving.]
20:22radex1 has quit [Quit: WeeChat 3.0]
20:24jeffmiw has quit [Ping timeout: 240 seconds]
20:26artemist has quit [Ping timeout: 276 seconds]
20:27raster has joined #asahi
20:33artemist has joined #asahi
20:36odmir has quit [Ping timeout: 260 seconds]
20:58flying_sausages has quit [Quit: You just lost the game. Peace Out.]
20:59odmir has joined #asahi
21:07jabashque has quit [Quit: Connection closed for inactivity]
21:16raster has quit [Quit: Gettin' stinky!]
21:22ephe_meral1 has quit [Ping timeout: 258 seconds]
21:32odmir has quit [Ping timeout: 240 seconds]
21:43ephe_meral1 has joined #asahi
21:44odmir has joined #asahi
22:00yrlf has quit [Quit: The Lounge - https://thelounge.chat]
22:01yrlf has joined #asahi
22:05ephe_meral1 has quit [Ping timeout: 240 seconds]
22:06klaus has quit [Ping timeout: 268 seconds]
22:18odmir has quit [Ping timeout: 268 seconds]
22:19klaus has joined #asahi
22:26klaus has quit [Ping timeout: 252 seconds]
22:29odmir has joined #asahi
22:35WhyNotHugoDoes wifi work on the M1? Would existing wifi drivers work if Apple stuck to the same components?
22:53klaus has joined #asahi
22:54troseman has joined #asahi
23:02odmir has quit [Ping timeout: 240 seconds]
23:02troseman_ has joined #asahi
23:02klaus has quit [Ping timeout: 265 seconds]
23:03odmir has joined #asahi
23:03ShizWhyNotHugo: the M1 didn't invent their own wifi chip
23:03Shizit's just broadcom
23:05troseman has quit [Ping timeout: 240 seconds]
23:21klaus has joined #asahi
23:26klaus has quit [Ping timeout: 260 seconds]
23:40klaus has joined #asahi
23:48klaus has quit [Ping timeout: 240 seconds]
…