Port-arm archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: FDT syscon driver



We're only really concerned with mainline dts files. Ignore anything you see in the vendor tree.

Check out the binding docs for this device if you haven't already:

https://www.kernel.org/doc/Documentation/devicetree/bindings/net/meson-dwmac.txt

There are no syscons defined, instead they give you the second address range in the reg property:

- reg:	The first register range should be the one of the DWMAC
	controller. The second range is is for the Amlogic specific
	configuration (for example the PRG_ETHERNET register range
	on Meson8b and newer)

Since fdtbus_get_reg takes an index parameter, you can look this up and map it yourself. The binding spec matches what I see in the dts:

https://nxr.netbsd.org/xref/src/sys/external/gpl2/dts/dist/arch/arm64/boot/dts/amlogic/meson-gx.dtsi#444

Is there another register range you need to access?

Cheers,
Jared


On Sun, 1 Jul 2018, Robert Swindells wrote:


Jared McNeill <jmcneill%invisible.ca@localhost> wrote:
On Sun, 1 Jul 2018, Robert Swindells wrote:

Jared McNeill <jmcneill%invisible.ca@localhost> wrote:
How to access it is dictated by the binding spec for your device. You need
some way to find the phandle. Two methods I have encountered:

[snip]

The Odroid C2 doesn't use either of them, there are no cross references
and the devices are at the same level in the tree.

Can you point me to an example?

The ethernet controller has two registers within the page at 0xc8834000

		periphs@c8834000 {
			compatible = "simple-bus";
			reg = <0x00000000 0xc8834000 0x00000000 0x00002000>;
			#address-cells = <0x00000002>;
			#size-cells = <0x00000002>;
			ranges = <0x00000000 0x00000000 0x00000000 0xc8834000 0x00000000 0x00002000>;


		ethernet@c9410000 {
			compatible = "amlogic,meson-gx-dwmac", "amlogic,meson-gx
bb-dwmac", "snps,dwmac";
			reg = <0x00000000 0xc9410000 0x00000000 0x00010000 0x00000000 0xc8834540 0x00000000 0x00000004>;
			interrupts = <0x00000000 0x00000008 0x00000001>;
			interrupt-names = "macirq";
			status = "okay";
			clocks = <0x0000000c 0x00000024 0x0000000c 0x00000004 0x0000000c 0x0000000f>;
			clock-names = "stmmaceth", "clkin0", "clkin1";
			pinctrl-0 = <0x00000018>;
			pinctrl-names = "default";
			phy-handle = <0x00000019>;
			phy-mode = "rgmii";
			snps,reset-gpio = <0x0000001a 0x0000000e 0x00000000>;
			snps,reset-delays-us = <0x00000000 0x00002710 0x000f4240>;
			snps,reset-active-low;
			amlogic,tx-delay-ns = <0x00000002>;

There are other things within the same page:

			rng {
				compatible = "amlogic,meson-rng";
				reg = <0x00000000 0x00000000 0x00000000 0x00000004>;
				clocks = <0x0000000c 0x00000019>;
				clock-names = "core";
			};
			pinctrl@4b0 {
				compatible = "amlogic,meson-gxbb-periphs-pinctrl";
                               ...

The device tree from Hardkernel's kernel is different again to the
mainline one:

	gpiomem {
		compatible = "amlogic,meson-gpiomem";
		reg = <0x0 0xc8834000 0x0 0x1000>;
		status = "okay";
	};

	ethmac: ethernet@0xc9410000{
		compatible = "amlogic, gxbb-rgmii-dwmac";
		reg = <0x0 0xc9410000 0x0 0x10000
		0x0 0xc8834540 0x0 0x8>;
		interrupts = <0 8 1>;
		phy-mode= "rgmii";
		pinctrl-names = "eth_pins";
		pinctrl-0 = <&eth_pins>;
		rst_pin-gpios = <&gpio GPIOZ_14 0>;
		mc_val = <0x1621>;
		resets = <&clock GCLK_IDX_ETHERNET>;
		reset-names = "ethpower";
		interrupt-names = "macirq";
		clocks = <&clock CLK_81>;
		clock-names = "ethclk81";
		 max-frame-size = <3582>;



Home | Main Index | Thread Index | Old Index