[PATCH v3] usb: net: Add support for the Realtek RTL8152B/RTL8153

Sascha Hauer sha at pengutronix.de
Fri Oct 22 04:31:59 PDT 2021


On Wed, Oct 20, 2021 at 12:45:56PM +0200, Oleksij Rempel wrote:
> +{
> +	u16 ocp_base, ocp_index;
> +
> +	ocp_base = addr & 0xf000;
> +	if (ocp_base != tp->ocp_base) {
> +		ocp_write_word(tp, MCU_TYPE_PLA, PLA_OCP_GPHY_BASE, ocp_base);
> +		tp->ocp_base = ocp_base;
> +	}
> +
> +	ocp_index = (addr & 0x0fff) | 0xb000;
> +	ocp_write_word(tp, MCU_TYPE_PLA, ocp_index, data);
> +}
> +
> +static void r8152_mdio_write(struct r8152 *tp, u32 reg_addr, u32 value)
> +{
> +	ocp_reg_write(tp, OCP_BASE_MII + reg_addr * 2, value);
> +}
> +
> +static int r8152_mdio_read(struct r8152 *tp, u32 reg_addr)
> +{
> +	return ocp_reg_read(tp, OCP_BASE_MII + reg_addr * 2);
> +}
> +
> +void sram_write(struct r8152 *tp, u16 addr, u16 data)
> +{
> +	ocp_reg_write(tp, OCP_SRAM_ADDR, addr);
> +	ocp_reg_write(tp, OCP_SRAM_DATA, data);
> +}

This function name is too generic for a global function. Please rename
to something with r8152 in it. Same for ocp_reg_write(),
generic_ocp_write() and others. Another way would be to put the firmware
into a header file and include that in the driver so that you do not
have to export any functions.

Sascha


-- 
Pengutronix e.K.                           |                             |
Steuerwalder Str. 21                       | http://www.pengutronix.de/  |
31137 Hildesheim, Germany                  | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |



More information about the barebox mailing list