Hi Simon,
2015-12-28 23:20 GMT+09:00 Simon Glass <[email protected]>: >> index 371784a..1efbaf2 100644 >> --- a/include/clk.h >> +++ b/include/clk.h >> @@ -49,6 +49,16 @@ struct clk_ops { >> * @return new clock rate in Hz, or -ve error code >> */ >> ulong (*set_periph_rate)(struct udevice *dev, int periph, ulong >> rate); >> + >> + /** >> + * get_id() - Get peripheral ID >> + * >> + * @dev: clock provider >> + * @args_count: number of arguments >> + * @args: arguments. The meaning is driver specific. >> + * @return peripheral ID, or -ve error code >> + */ >> + int (*get_id)(struct udevice *dev, int args_count, uint32_t *args); > > What are the arguments for? Who will use them? I wonder if the simple > case you have is the only useful case for now? > > I think it would be better for the device tree parsing to happen > within the uclass rather than requiring the caller to understand how > it works. Here, we must obtain the arguments after the phandle and > pass them to this function. My intention was to make the interface as generic as possible. It is true that most of drivers have '#clock-cells = <1>', but I found some have '#clock-cells = <2>'. Under linux/Documentation: devicetree/bindings/clock/qoriq-clock.txt:When the clockgen node is a clock provider, #clock-cells = <2>. devicetree/bindings/clock/qoriq-clock.txt: #clock-cells = <2>; devicetree/bindings/clock/renesas,cpg-mssr.txt: #clock-cells = <2>; devicetree/bindings/clock/st,stm32-rcc.txt: #clock-cells = <2> devicetree/bindings/clock/ux500.txt: #clock-cells = <2>; devicetree/bindings/clock/ux500.txt: #clock-cells = <2>; So, my idea was to cover the simple case with clk_get_id_simple(), but still allow such rare-case drivers to have their own .get_id() callback. However, U-Boot might never be hit by such a case, and your simple one meets our demand well enough. -- Best Regards Masahiro Yamada _______________________________________________ U-Boot mailing list [email protected] http://lists.denx.de/mailman/listinfo/u-boot

