Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

usb: gadget: s3c-hsotg: Allow driver instantiation using device tree

This patch adds OF match table to the driver to allow instantiating it
using device tree.

Signed-off-by: Tomasz Figa <t.figa@samsung.com>
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>

authored by

Tomasz Figa and committed by
Felipe Balbi
c50f056c 22a5aa17

+50
+40
Documentation/devicetree/bindings/usb/samsung-hsotg.txt
··· 1 + Samsung High Speed USB OTG controller 2 + ----------------------------- 3 + 4 + The Samsung HSOTG IP can be found on Samsung SoCs, from S3C6400 onwards. 5 + It gives functionality of OTG-compliant USB 2.0 host and device with 6 + support for USB 2.0 high-speed (480Mbps) and full-speed (12 Mbps) 7 + operation. 8 + 9 + Currently only device mode is supported. 10 + 11 + Binding details 12 + ----- 13 + 14 + Required properties: 15 + - compatible: "samsung,s3c6400-hsotg" should be used for all currently 16 + supported SoC, 17 + - interrupt-parent: phandle for the interrupt controller to which the 18 + interrupt signal of the HSOTG block is routed, 19 + - interrupts: specifier of interrupt signal of interrupt controller, 20 + according to bindings of interrupt controller, 21 + - clocks: contains an array of clock specifiers: 22 + - first entry: OTG clock 23 + - clock-names: contains array of clock names: 24 + - first entry: must be "otg" 25 + - vusb_d-supply: phandle to voltage regulator of digital section, 26 + - vusb_a-supply: phandle to voltage regulator of analog section. 27 + 28 + Example 29 + ----- 30 + 31 + hsotg@12480000 { 32 + compatible = "samsung,s3c6400-hsotg"; 33 + reg = <0x12480000 0x20000>; 34 + interrupts = <0 71 0>; 35 + clocks = <&clock 305>; 36 + clock-names = "otg"; 37 + vusb_d-supply = <&vusb_reg>; 38 + vusb_a-supply = <&vusbdac_reg>; 39 + }; 40 +
+10
drivers/usb/gadget/s3c-hsotg.c
··· 29 29 #include <linux/slab.h> 30 30 #include <linux/clk.h> 31 31 #include <linux/regulator/consumer.h> 32 + #include <linux/of_platform.h> 32 33 33 34 #include <linux/usb/ch9.h> 34 35 #include <linux/usb/gadget.h> ··· 3649 3648 #define s3c_hsotg_resume NULL 3650 3649 #endif 3651 3650 3651 + #ifdef CONFIG_OF 3652 + static const struct of_device_id s3c_hsotg_of_ids[] = { 3653 + { .compatible = "samsung,s3c6400-hsotg", }, 3654 + { /* sentinel */ } 3655 + }; 3656 + MODULE_DEVICE_TABLE(of, s3c_hsotg_of_ids); 3657 + #endif 3658 + 3652 3659 static struct platform_driver s3c_hsotg_driver = { 3653 3660 .driver = { 3654 3661 .name = "s3c-hsotg", 3655 3662 .owner = THIS_MODULE, 3663 + .of_match_table = of_match_ptr(s3c_hsotg_of_ids), 3656 3664 }, 3657 3665 .probe = s3c_hsotg_probe, 3658 3666 .remove = s3c_hsotg_remove,