lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <ce6ee5a6-12c9-94ae-630e-549fc67a00d9@gmail.com>
Date:   Mon, 6 Feb 2017 11:17:32 -0800
From:   Florian Fainelli <f.fainelli@...il.com>
To:     Andrew Lunn <andrew@...n.ch>
Cc:     netdev@...r.kernel.org, Jason Cooper <jason@...edaemon.net>,
        Sebastian Hesselbarth <sebastian.hesselbarth@...il.com>,
        Gregory Clement <gregory.clement@...e-electrons.com>,
        Russell King <linux@...linux.org.uk>,
        Vivien Didelot <vivien.didelot@...oirfairelinux.com>,
        "David S. Miller" <davem@...emloft.net>,
        "moderated list:ARM/Marvell Dove/MV78xx0/Orion SOC support" 
        <linux-arm-kernel@...ts.infradead.org>,
        open list <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH net-next v5 3/4] net: phy: Allow pre-declaration of MDIO
 devices

On 02/06/2017 06:04 AM, Andrew Lunn wrote:
>> +/**
>> + * mdio_register_board_info - register MDIO devices for a given board
>> + * @info: array of devices descriptors
>> + * @n: number of descriptors provided
>> + * Context: can sleep
>> + *
>> + * The board info passed can be marked with __initdata but be pointers
>> + * such as platform_data etc. are copied as-is
>> + */
>> +int mdiobus_register_board_info(const struct mdio_board_info *info,
>> +				unsigned int n)
>> +{
>> +	struct mdio_board_entry *be;
>> +	unsigned int i;
>> +
>> +	be = kcalloc(n, sizeof(*be), GFP_KERNEL);
>> +	if (!be)
>> +		return -ENOMEM;
>> +
>> +	for (i = 0; i < n; i++, be++, info++) {
>> +		memcpy(&be->board_info, info, sizeof(*info));
>> +		mutex_lock(&mdio_board_lock);
>> +		list_add_tail(&be->list, &mdio_board_list);
>> +		mutex_unlock(&mdio_board_lock);
>> +	}
>> +
>> +	return 0;
> 
> Hi Florian
> 
> I've recently been playing with a hot-pluggable SPI bus controller. It
> is a USB device, hence can come and go. On the SPI bus i have an
> SRAM. On order to instantiate the MTD device, i need SPI board info. I
> cannot add the board info until after the SPI bus master appears,
> since i need to know its ID to fill in the board info. At the moment,
> i have udev script which when the SPI bus master appears loads a
> little kernel module which registers the board info.
> 
> Such a scheme will not work here. You need to iterate the list of MDIO
> devices at the end of mdiobus_register_board_info() to see if the just
> registered board info applies to any existing MDIO bus.

I was thinking when mdio_device_register() is called, see if there is a
matching board info for it, and if so, assign its platform_data
accordingly. In the case where mdiobus_register_with_board

> 
> I don't think we yet have any hardware which would do this. But there
> have been patches to one of the USB-Ethernet dongles to allow it run
> without a PHY. My guess is, to allow an SFP module. But it is not too
> big a step for somebody to make a USB attached Ethernet switch.
> 
> Maybe consider adding this functionality? Also an unregister call?

Sure, makes sense.
-- 
Florian

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ