+Board Fixups + + Sometimes the specific interaction between the platform and the PHY requires + special handling. For instance, to change where the PHY's clock input is, + or to add a delay to account for latency issues in the data path. In order + to support such contingencies, the PHY Layer allows platform code to register + fixups to be run when the PHY is brought up (or subsequently reset). + + When the PHY Layer brings up a PHY it checks to see if there are any fixups + registered for it, matching based on UID (contained in the PHY device's phy_id + field) and the bus identifier (contained in phydev->dev.bus_id). Both must + match, however two constants, PHY_ANY_ID and PHY_ANY_UID, are provided as + wildcards for the bus ID and UID, respectively. + + When a match is found, the PHY layer will invoke the run function associated + with the fixup. This function is passed a pointer to the phy_device of + interest. It should therefore only operate on that PHY. + + The platform code can either register the fixup using phy_register_fixup(): + + int phy_register_fixup(const char *phy_id, + u32 phy_uid, u32 phy_uid_mask, + int (*run)(struct phy_device *)); + + Or using one of the two stubs, phy_register_fixup_for_uid() and + phy_register_fixup_for_id(): + + int phy_register_fixup_for_uid(u32 phy_uid, u32 phy_uid_mask, + int (*run)(struct phy_device *)); + int phy_register_fixup_for_id(const char *phy_id, + int (*run)(struct phy_device *)); + + The stubs set one of the two matching criteria, and set the other one to + match anything. +
2017年7月28日 星期五
phy_scan_fixups()
Source: http://lists.openwall.net/netdev/2008/04/09/53
2017年7月17日 星期一
Linux module parameters.
Source: http://nano-chicken.blogspot.tw/2011/01/linux-modules11module-parameters.html
Linux Module允許使用者在insmod時帶入相關的parameters,這些parameters必須被宣告成golbal,並且使用 module_param()宣告資料型態與權限,目前支援的資料型態有byte, short, ushort, int, uint, long, ulong, charp, bool等等。也可以使用module_param_array(name, type, num, perm)宣告成陣列。perm(權限)會決定/sys/module/顯示該參數的權限。
Linux Module允許使用者在insmod時帶入相關的parameters,這些parameters必須被宣告成golbal,並且使用 module_param()宣告資料型態與權限,目前支援的資料型態有byte, short, ushort, int, uint, long, ulong, charp, bool等等。也可以使用module_param_array(name, type, num, perm)宣告成陣列。perm(權限)會決定/sys/module/顯示該參數的權限。
#include#include MODULE_LICENSE("GPL"); static unsigned char b_byte = 1; module_param(b_byte, byte, S_IRUGO|S_IWUSR); static short int b_short = 2; module_param(b_short, short, S_IRUGO|S_IWUSR); static unsigned short int b_ushort = 3; module_param(b_ushort, ushort, S_IRUGO|S_IWUSR); static int b_int = 6; module_param(b_int, int, S_IRUGO|S_IWUSR); static unsigned int b_uint = 5; module_param(b_uint, uint, S_IRUGO|S_IWUSR); static long b_long = 6; module_param(b_long, long, S_IRUGO|S_IWUSR); static unsigned long b_ulong = 7; module_param(b_ulong, ulong, S_IRUGO|S_IWUSR); static char *b_charp = "brook"; module_param(b_charp, charp, S_IRUGO|S_IWUSR); static int b_bool = 1; module_param(b_bool, bool, S_IRUGO|S_IWUSR); static int __init init_modules(void) { printk("b_byte: %d\n", b_byte); printk("b_short: %d\n", b_short); printk("b_ushort: %u\n", b_ushort); printk("b_int: %d\n", b_int); printk("b_uint: %u\n", b_uint); printk("b_long: %ld\n", b_long); printk("b_ulong: %lu\n", b_ulong); printk("b_charp: %s\n", b_charp); printk("b_bool: %d\n", b_bool); return 0; } static void __exit exit_modules(void) { } module_init(init_modules); module_exit(exit_modules);
2017年7月7日 星期五
Linux Programming Trouble Shooting
Q001. Why is a kernel object (.o, .ko) not generated after compilation ?
A001. Check CONFIG_x, KConfig, and Makefile
A001. Check CONFIG_x, KConfig, and Makefile
訂閱:
文章 (Atom)