History

net: mdio: mdio-bcm-unimac: Manage clock around I/O accesses

Up until now we have managed not to have the mdio-bcm-unimac manage its clock except during probe and suspend/resume. This works most of the time, except where it does not. With a fully modular build, we can get into a situation whereby the GENET driver is fully registered, and so is the mdio-bcm-unimac driver, however the Ethernet PHY driver is not yet, because it depends on a resource that is not yet available (e.g.: GPIO provider). In that state, the network device is not usable yet, and so to conserve power, the GENET driver will have turned off its "main" clock which feeds its MDIO controller. When the PHY driver finally probes however, we make an access to the PHY registers to e.g.: disable interrupts, and this causes a bus error within the MDIO controller space because the MDIO controller clock(s) are turned off. To remedy that, we manage the clock around all of the I/O accesses to the hardware which are done exclusively during read, write and clock divider configuration. This ensures that the register space is accessible, and this also ensures that there are not unnecessarily elevated reference counts keeping the clocks active when the network device is administratively turned off. It would be the case with the previous way of managing the clock.

Florian Fainelli committed 2 years ago

Commit ee975351 parent 78b88ef2 files · +53 −43Browse files

Showing the changes to include/linux/platform_data (1 of 2 files). Show all

Unified · Split

include/linux/platform_data/mdio-bcm-unimac.h+3−0
@@ -1,11 +1,14 @@
11 #ifndef __MDIO_BCM_UNIMAC_PDATA_H
22 #define __MDIO_BCM_UNIMAC_PDATA_H
33
4+struct clk;
5+
46 struct unimac_mdio_pdata {
57 u32 phy_mask;
68 int (*wait_func)(void *data);
79 void *wait_func_data;
810 const char *bus_name;
11+ struct clk *clk;
912 };
1013
1114 #define UNIMAC_MDIO_DRV_NAME "unimac-mdio"

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t