Hi Andre, On 3 April 2020 11:04:17 PM IST, "André Przywara" <andre.przywara@xxxxxxx> wrote: >On 03/04/2020 11:29, André Przywara wrote: > >(repost with CC: Actions Semi mailing list) > >> On 03/04/2020 11:02, Amit Tomer wrote: >> >> Hi, >> >>> While booting mainline Kernel on Cubieboard7-lite(based on S700), >see >>> the following logs >>> that suggests S700 pin controller is not probed well. >>> >>> [ 0.257415] pinctrl-s700 e01b0000.pinctrl: can't request region >for >>> resource [mem 0xe01b0000-0xe01b0fff] >>> [ 0.266902] pinctrl-s700: probe of e01b0000.pinctrl failed with >error -16 >>> >>> Register range defined for pin controller seems to be huge and >causing >>> this failure. >>> >>> reg = <0x0 0xe01b0000 0x0 0x1000>; >> >> To summarise the discussion I had with Amit over IRC: >> >> The "sps" power domain controller is overlapping with the pinctrl: >> sps: power-controller@e01b0100 { >> compatible = "actions,s700-sps"; >> reg = <0x0 0xe01b0100 0x0 0x100>; >> #power-domain-cells = <1>; >> }; >> pinctrl: pinctrl@e01b0000 { >> compatible = "actions,s700-pinctrl"; >> reg = <0x0 0xe01b0000 0x0 0x1000>; >> ... >> >> This is not the case on the S900, where most of the S700 support >seemed >> to be lifted from. >> >> Looking at the datasheet there is also other IP sharing the MMIO >region >> with the GPIO/pinctrl: >> GPIO/MFP Controller (include PWM, SPS, RMU, AVS) >> >> Seems to be a pretty nasty hardware design, at least when it comes to >> mapping this to the Linux: >> - The PWM controller uses register offsets 0x50-0x60, and 0x78 - 0x80 >> - The SPS controller uses offsets 0x100 - 0x108 >> - The pinctrl uses 0x00 - 0x50, 0x60-0x78, 0x80-0x8c and 0x200 - >0x254 >> >> So at least the PWM sits in the middle of the pinctrl, in two chunks. >> >> What is the typical solution for those kind of problems? One device >> exporting a regmap? Or using a MFD? > > >Thought a bit about it, what about this: > >- We amend the pinctrl binding to also deal with *two* reg regions: the >first for the actual pinctrl/GPIO part (0x0 - 0x100), the second for >the >interrupt part (starting at 0x200). It seems like we don't use the >interrupt functionality at the moment, so that should not break >anything. >- The pinctrl driver exports a regmap for the PWM registers. >- The (to-be-written) PWM driver and binding contain a reference to the >pinctrl node, which is then used in the PWM driver to retrieve the >regmap. >This should cover the three devices: >pinctrl: pinctrl@e01b0000 { > compatible = "actions,s700-pinctrl"; > reg = <0x0 0xe01b0000 0x0 0x100>, > <0x0 0xe01b0200 0x0 0x100>; >... >sps: power-controller@e01b0100 { > compatible = "actions,s700-sps"; > reg = <0x0 0xe01b0100 0x0 0x100>; >.... >pwm: pwm@e01b0050 { > compatible = "TBD"; > reg = <0x0 0xe01b0050 0x0 0x10>, > <0x0 0xe01b0078 0x0 0x08>; > regmap = <&pinctrl>; >... >The PWM driver would need to deal with a failing >devm_platform_ioremap_resource(), reverting to using the regmap then. >Or >maybe never try this in the first place, to avoid breaking the pinctrl >driver when being probed first. > >This would allow to keep the pinctrl and sps drivers as they are, even >allowing the new (fixed) DT to work with existing kernels. > >Does that sound feasible? Or is there a better solution? This looks to me a hack. I did miss to spot the sps and gpio/pinctrl conflict for S700 before, sorry for that. But for me, implementing gpio/pinctrl block as MFD seems to be a proper solution. S900 shares PWM with it, so definitely it can benefit from doing so. Andreas, what do you think? Thanks, Mani > >Cheers, >Andre > >>> Complete logs are below >>> >>> Starting kernel ... >>> >>> [ 0.000000] Booting Linux on physical CPU 0x0000000000 >[0x410fd034] >>> [ 0.000000] Linux version 5.6.0-02330-g458ef2a-dirty >>> (amit@amit-ThinkPad-X230) (gcc version 7.3.1 20180425 >>> [linaro-7.3-2018.05 revision >d29120a424ecfbc167ef90065c0eeb7f91977701] >>> (Linaro GCC 7.3-2018.05)) #12 SMP PREEMPT Fri Apr 3 14:19:08 IST >2020 >>> [ 0.000000] Machine model: CubieBoard7 >>> [ 0.000000] earlycon: owl0 at MMIO 0x00000000e0126000 (options >'') >>> [ 0.000000] printk: bootconsole [owl0] enabled >>> [ 0.000000] efi: UEFI not found. >>> [ 0.000000] cma: Reserved 32 MiB at 0x000000003e000000 >>> [ 0.000000] NUMA: No NUMA configuration found >>> [ 0.000000] NUMA: Faking a node at [mem >>> 0x0000000000000000-0x000000003fffffff] >>> [ 0.000000] NUMA: NODE_DATA [mem 0x3ddfc100-0x3ddfdfff] >>> [ 0.000000] Zone ranges: >>> [ 0.000000] DMA [mem >0x0000000000000000-0x000000003fffffff] >>> [ 0.000000] DMA32 empty >>> [ 0.000000] Normal empty >>> [ 0.000000] Movable zone start for each node >>> [ 0.000000] Early memory node ranges >>> [ 0.000000] node 0: [mem >0x0000000000000000-0x000000001effffff] >>> [ 0.000000] node 0: [mem >0x0000000020000000-0x000000003fffffff] >>> [ 0.000000] Initmem setup node 0 [mem >0x0000000000000000-0x000000003fffffff] >>> [ 0.000000] psci: probing for conduit method from DT. >>> [ 0.000000] psci: PSCIv0.2 detected in firmware. >>> [ 0.000000] psci: Using standard PSCI v0.2 function IDs >>> [ 0.000000] psci: Trusted OS migration not required >>> [ 0.000000] percpu: Embedded 23 pages/cpu s53272 r8192 d32744 >u94208 >>> [ 0.000000] Detected VIPT I-cache on CPU0 >>> [ 0.000000] CPU features: detected: ARM erratum 845719 >>> [ 0.000000] Built 1 zonelists, mobility grouping on. Total >pages: 253952 >>> [ 0.000000] Policy zone: DMA >>> [ 0.000000] Kernel command line: console=ttyOWL,115200 >>> earlycon=owl,0xe0126000 root=/dev/mmcblk0p2 >>> [ 0.000000] Dentry cache hash table entries: 131072 (order: 8, >>> 1048576 bytes, linear) >>> [ 0.000000] Inode-cache hash table entries: 65536 (order: 7, >524288 >>> bytes, linear) >>> [ 0.000000] mem auto-init: stack:off, heap alloc:off, heap >free:off >>> [ 0.000000] Memory: 951668K/1032192K available (12604K kernel >code, >>> 1948K rwdata, 6964K rodata, 5312K init, 462K bss, 47756K reserved, >>> 32768K cma-reserved) >>> [ 0.000000] SLUB: HWalign=64, Order=0-3, MinObjects=0, CPUs=4, >Nodes=1 >>> [ 0.000000] rcu: Preemptible hierarchical RCU implementation. >>> [ 0.000000] rcu: RCU event tracing is enabled. >>> [ 0.000000] rcu: RCU restricting CPUs from NR_CPUS=256 to >nr_cpu_ids=4. >>> [ 0.000000] Tasks RCU enabled. >>> [ 0.000000] rcu: RCU calculated value of scheduler-enlistment >delay >>> is 25 jiffies. >>> [ 0.000000] rcu: Adjusting geometry for rcu_fanout_leaf=16, >nr_cpu_ids=4 >>> [ 0.000000] NR_IRQS: 64, nr_irqs: 64, preallocated irqs: 0 >>> [ 0.000000] GIC: Using split EOI/Deactivate mode >>> [ 0.000000] random: get_random_bytes called from >>> start_kernel+0x2a8/0x444 with crng_init=0 >>> [ 0.000000] arch_timer: cp15 timer(s) running at 24.00MHz (phys). >>> [ 0.000000] clocksource: arch_sys_counter: mask: 0xffffffffffffff >>> max_cycles: 0x588fe9dc0, max_idle_ns: 440795202592 ns >>> [ 0.000000] sched_clock: 56 bits at 24MHz, resolution 41ns, wraps >>> every 4398046511097ns >>> [ 0.008163] sched_clock: 32 bits at 24MHz, resolution 41ns, wraps >>> every 89478484971ns >>> [ 0.015969] clocksource: timer: mask: 0xffffffff max_cycles: >>> 0xffffffff, max_idle_ns: 79635851949 ns >>> [ 0.025300] Console: colour dummy device 80x25 >>> [ 0.029821] Calibrating delay loop (skipped), value calculated >>> using timer frequency.. 48.00 BogoMIPS (lpj=96000) >>> [ 0.040069] pid_max: default: 32768 minimum: 301 >>> [ 0.044785] LSM: Security Framework initializing >>> [ 0.049465] Mount-cache hash table entries: 2048 (order: 2, 16384 >>> bytes, linear) >>> [ 0.056857] Mountpoint-cache hash table entries: 2048 (order: 2, >>> 16384 bytes, linear) >>> [ 0.066496] rcu: Hierarchical SRCU implementation. >>> [ 0.072035] EFI services will not be available. >>> [ 0.076832] smp: Bringing up secondary CPUs ... >>> [ 0.082027] Detected VIPT I-cache on CPU1 >>> [ 0.082093] CPU1: Booted secondary processor 0x0000000001 >[0x410fd034] >>> [ 0.082792] Detected VIPT I-cache on CPU2 >>> [ 0.082834] CPU2: Booted secondary processor 0x0000000002 >[0x410fd034] >>> [ 0.083500] Detected VIPT I-cache on CPU3 >>> [ 0.083540] CPU3: Booted secondary processor 0x0000000003 >[0x410fd034] >>> [ 0.083627] smp: Brought up 1 node, 4 CPUs >>> [ 0.119242] SMP: Total of 4 processors activated. >>> [ 0.123938] CPU features: detected: 32-bit EL0 Support >>> [ 0.129087] CPU features: detected: CRC32 instructions >>> [ 0.143064] CPU: All CPU(s) started at EL2 >>> [ 0.147207] alternatives: patching kernel code >>> [ 0.153187] devtmpfs: initialized >>> [ 0.158590] KASLR disabled due to lack of seed >>> [ 0.163472] clocksource: jiffies: mask: 0xffffffff max_cycles: >>> 0xffffffff, max_idle_ns: 7645041785100000 ns >>> [ 0.173211] futex hash table entries: 1024 (order: 4, 65536 >bytes, linear) >>> [ 0.181589] pinctrl core: initialized pinctrl subsystem >>> [ 0.188064] thermal_sys: Registered thermal governor 'step_wise' >>> [ 0.188068] thermal_sys: Registered thermal governor >'power_allocator' >>> [ 0.194183] DMI not present or invalid. >>> [ 0.205285] NET: Registered protocol family 16 >>> [ 0.211593] DMA: preallocated 256 KiB pool for atomic allocations >>> [ 0.217696] audit: initializing netlink subsys (disabled) >>> [ 0.223266] audit: type=2000 audit(0.144:1): state=initialized >>> audit_enabled=0 res=1 >>> [ 0.231024] cpuidle: using governor menu >>> [ 0.235203] hw-breakpoint: found 6 breakpoint and 4 watchpoint >registers. >>> [ 0.242077] ASID allocator initialised with 65536 entries >>> [ 0.248650] Serial: AMBA PL011 UART driver >>> [ 0.257415] pinctrl-s700 e01b0000.pinctrl: can't request region >for >>> resource [mem 0xe01b0000-0xe01b0fff] >>> [ 0.266902] pinctrl-s700: probe of e01b0000.pinctrl failed with >error -16 >>> >> -- Sent from my Android device with K-9 Mail. Please excuse my brevity. _______________________________________________ linux-actions mailing list linux-actions@xxxxxxxxxxxxxxxxxxx http://lists.infradead.org/mailman/listinfo/linux-actions