-
Notifications
You must be signed in to change notification settings - Fork 5.2k
pinctrl: add bcm2708 driver #635
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
This driver is a verbatim copy of the pinctrl-bcm2835 driver, except for: * changed 2835 to 2708 * gpio_chip and IRQ part are removed * Probing function is changed. Because armctrl sets up the gpio irqs, we use the bcm2708_gpio driver. This hack is used to be able to support both DT and non-DT builds. Binding document: brcm,bcm2835-gpio.txt It's not possible to set trigger type and level flags for IRQs in the DT. Signed-off-by: Noralf Tronnes <notro@tronnes.org>
Test Pin states
Add patch diff --git a/arch/arm/boot/dts/bcm2708-rpi-b.dts b/arch/arm/boot/dts/bcm2708-rpi-b.dts
index e319c8e..28e9713 100644
--- a/arch/arm/boot/dts/bcm2708-rpi-b.dts
+++ b/arch/arm/boot/dts/bcm2708-rpi-b.dts
@@ -6,3 +6,37 @@
compatible = "brcm,bcm2708";
model = "Raspberry Pi";
};
+
+&gpio {
+ pinctrl-names = "default";
+ pinctrl-0 = <&pullup_test &function_test>;
+
+/*
+- brcm,pull: Integer, representing the pull-down/up to apply to the pin(s):
+ 0: none
+ 1: down
+ 2: up
+*/
+ pullup_test: test1 {
+ brcm,pins = <17>;
+ brcm,function = <0>;
+ brcm,pull = <2>;
+ };
+
+/*
+- brcm,function: Integer, containing the function to mux to the pin(s):
+ 0: GPIO in
+ 1: GPIO out
+ 2: alt5
+ 3: alt4
+ 4: alt0
+ 5: alt1
+ 6: alt2
+ 7: alt3
+*/
+ function_test: test0 {
+ brcm,pins = <18 27 22 23 24 25>;
+ brcm,function = <2 3 7 0 1 1>;
+ };
+
+}; Pin states
Kernel debug messages: https://gist.github.com/notro/3c9258688f2fd8ad280d |
Seems you're right: Ranges (Address Translation) |
Interesting. I wonder if we could handle BCM2708_NOL2CACHE: through this mechanism. It's something configured by the GPU, and the kernel config option needs to match the GPU option (disable_l2cache in config.txt) for boot to work, so it would be cleaner if firmware populated the "bus" offset and a single kernel image could be used for both modes. |
This is the formal specification: 2.3.8 ranges (page26) |
This looks wrong (upstream) For info: and when BCM2708_NOL2CACHE is enabled: I'm not sure where the physical to bus mapping is described in the upstream world. |
It doesn't affect functionality since it's the reg property that carries the address. The norm is to put the address in the name. Clearly a misspelling here.
What's this?
What do you mean? It's decribed in the ranges property on the soc bus isn't it? |
I see now that I use 'axi' instead of 'soc' as it's done upstream. I belive this was because the VC bootloader adds some info to the axi tree (mac address etc.). |
When the ARM accesses physical address 0, it goes through a mapping to a bus address which results in 0x40000000 (when L2 enabled) or 0xC0000000 (when disabled). This is handled through BUS_OFFSET here: I'm trying to work out where this mapping happens in device tree world. It seems a ranges node would make sense, but I don't see that in the 2835 device tree. |
If you would prefer VC bootloader to fill in different nodes to fit in with upstream better, then let me know what the changes should be. |
Is IOMMU the part responsible for such bus mapping? I guess one should find references to this in DMA related drivers like: bcm2835-i2s.c has this:
|
Yes, it's best changing axi to soc since this is part of an upstreaming effort. I'll make a PR later. |
The physical->bus mapping is a kind of mmu, but not a standard arm one. |
pinctrl: add bcm2708 driver
rust: avoid the need of crate attributes in kernel modules
This driver is a verbatim copy of the pinctrl-bcm2835 driver, except for:
Because armctrl sets up the gpio irqs, we use the bcm2708_gpio driver.
This hack is used to be able to support both DT and non-DT builds.
Binding document: brcm,bcm2835-gpio.txt
It's not possible to set trigger type and level flags for IRQs in the DT.
Signed-off-by: Noralf Tronnes notro@tronnes.org