BCM5325 switch (SPI) on BCM6358

Hi

I'm trying to get the BCM5325 switch working on a Thomson TG784 (BCM6358). MDIO is not connected, only SPI. I see that the "swconfig" tool should support it over SPI (source), but I cannot find any information how to set it up.

What I have done so far is install these packages and hoped for the best:
kmod-libphy
kmod-mii
kmod-swconfig
kmod-switch-bcm53xx
kmod-spi-dev

During boot I get line "Failed to connect to the switch. Use the "list" command to see which switches are available." four times.
When running "swconfig list", I get absolutely no response (appears to execute "successfully" with no printable output).

Do I need to include some details describing the switch when building OpenWRT? It would make sense that it needs to know what Chip Select to use. Can anyone lead me to some docoumentation or hints?

Hi @denry12, broadcom switches connected via SPI are supported, however they only had been tested under BCM6368 SoCs.

You need to define a low speed spi node in your dts board file. Example:

Here the board is using the Slave Select 1. For using the slave select 2 then define
switch@2
and
reg = <2>;
instead

and also define your switch model:
compatible = "brcm,bcm5325";

You also need to know which ports are conected externally, and wich one is connected to the CPU (likely number 5).

Not sure if your device has enough flash/RAM to run at least Openwrt 18.06, otherwise you will need to patch the board data (board_bcm963xx.c) at kernel level in older versions.

Regards

Thank you for the thorough response!
I managed to get swconfig to talk to the switch over SPI (CS0, for the record), but this is where I am stuck again.

I agree that the switch port connected to CPU is likely 5. It is certainly via MII on this board.

When polling through ports 0-5 with following command:
swconfig dev switch0 port 5 show
only port 5 is "up". The LEDs flickering near the ports seem to indicate that the switch thinks otherwise (granted, this was same before swconfig found the switch).

I believe I am past OpenWRT 18.06, the splash screen reports "OpenWrt SNAPSHOT, r15225-bfc433efd4"

Some segments from relevant files (in case someone can find something obviously wrong):

DTS:

&lsspi {
	switch@0 {
		compatible = "brcm,bcm5325";
		reg = <0>;
		spi-max-frequency = <781000>;
		lede,alias = "eth1";
		ports {
			#address-cells = <1>;
			#size-cells = <0>;

			lan@0 {
				reg = <0>;
				label = "lan4";
			};

			lan@1 {
				reg = <1>;
				label = "lan3";
			};

			lan@2 {
				reg = <2>;
				label = "lan2";
			};

			lan@3 {
				reg = <3>;
				label = "lan1";
			};

			cpu@5 {
				reg = <5>;
				label = "cpu";
				fixed-link {
					speed = <100>;
					full-duplex;
				};
			};
		};
	};
};

board_bcm963xx.c:

static struct board_info __initdata board_tg784 = {
	.name				= "TG784",
	.expected_cpu_id		= 0x6358,

	.has_pci			= 1,
	.use_fallback_sprom		= 1,
	.has_ohci0			= 1,
	.has_ehci0			= 1,
	.num_usbh_ports			= 1,

	.has_enet0			= 1,
	.has_enet1			= 1,
	.enet0 = {
		.has_phy		= 1,
		.use_internal_phy	= 1,
	},
	.enet1 = {
		.has_phy		= 1,
		.phy_id			= 0,
		.force_speed_100        = 1,
		.force_duplex_full      = 1,
	},

	.fallback_sprom = {
		.type 			= SPROM_BCM4322,
		.pci_bus		= 0,
		.pci_dev		= 1,
	},
};

Hi Ppl, I'm new on this.
I have follow the instruction TG784 from https://openwrt.org/toh/thomson/tg784 but i'm get stuk after upload https://archive.openwrt.org/chaos_calmer/15.05/brcm63xx/generic/openwrt-15.05-brcm63xx-generic-HomeHub2A-squashfs-cfe.bin.
no internet connection to open openwrt.

Can someone help?

Thanks in advance

Hi @Srei, as you may guess the switch isn't working in this board. Probably only the WAN port will work since it doesn't belong to the BCM5325 switch.

@denry12 the switch has the reset pin connected to a GPIO, isn it?. In other boards this reset pin is connected to a chip which its only purpose is performing a reset with the correct timings, like the MAX809. This is used to leave the ethernet switch into a known working state:

MAX809-FUN

Then you may need to emulate this behavior via software to leave the BCM5325 chip in a good state before the comunication via SPI.

It can be done in the bootloader. Probably this sequence should be enough

GPIOx output LOW -> wait 200 ms -> GPIOx output HIGH -> wait 100 ms -> configure the switch

Of course, in any case leaving this GPIO floating (not configured as output) isn't recommended for a correct operation.

Not sure if the sequence can be done via kernel in an easy way. Or even if it could be done via userspace and then unload and load again the b53 drivers and configure the network.

Hi @denry12 thanks for the reply.
Ok sow i need to go in that direction, CFE boot and emulate a reset to prevent code-execution errors during power-on.

I bealive that i need to change the boardparms.c in GPIO_15
in this moment i have defined as High and i bealive that is the only way to have connectivity to upload firmware by CFE.

  BP_GPIO_15_AH,                       /* usGpioPhyReset */

can you exemplify how i change for this values?
GPIOx output LOW -> wait 200 ms -> GPIOx output HIGH -> wait 100 ms -> configure the switch

Thanks in advance