Re: [PATCH 3/6] net: mdio-mux: Add MDIO mux driver for NSP SoC

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

 




> +#define NSP_MDIO_EXT_BUS_START_ADDR		16
> +#define NSP_MDIO_EXT_SELECT_BIT			BIT(9)
> +
> +static int mdio_mux_nsp_switch_fn(int current_child, int desired_child,
> +				  void *priv)
> +{
> +	struct nsp_mdiomux_desc *md = priv;
> +	u32 data, bus_id;
> +
> +	/* select internal or external bus */
> +	data = readl(md->mgmt_ctrl);
> +	if (desired_child == NSP_MDIO_EXT_BUS_START_ADDR)
> +		data |= NSP_MDIO_EXT_SELECT_BIT;
> +	else
> +		data &= ~NSP_MDIO_EXT_SELECT_BIT;
> +	writel(data, md->mgmt_ctrl);
> +
> +	/* select bus number */
> +	if (md->bus_ctrl) {
> +		bus_id = desired_child & (NSP_MDIO_EXT_BUS_START_ADDR - 1);
> +		writel(bus_id, md->bus_ctrl);
> +	}
> +
> +	return 0;

So address 16 is external. What happens which you try to access
address 16 internally? Does the chip raise an abort? Reads just give
0xffff?

I'm wondering if it would be better to implement this as two nested
muxes. One mux doing internal/external, and the other doing the bus.
If you do that, you can use the existing mdio-mux-mmioreg.c and don't
need any new code at all.

     Andrew
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Device Tree Compilter]     [Device Tree Spec]     [Linux Driver Backports]     [Video for Linux]     [Linux USB Devel]     [Linux PCI Devel]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [XFree86]     [Yosemite Backpacking]
  Powered by Linux