LCOV - code coverage report
Current view: top level - drivers/usb/phy - of.c (source / functions) Hit Total Coverage
Test: Real Lines: 0 6 0.0 %
Date: 2020-10-17 15:46:16 Functions: 0 1 0.0 %
Legend: Neither, QEMU, Real, Both Branches: 0 0 -

           Branch data     Line data    Source code
       1                 :            : // SPDX-License-Identifier: GPL-2.0+
       2                 :            : /*
       3                 :            :  * USB of helper code
       4                 :            :  */
       5                 :            : 
       6                 :            : #include <linux/kernel.h>
       7                 :            : #include <linux/module.h>
       8                 :            : #include <linux/of.h>
       9                 :            : #include <linux/usb/of.h>
      10                 :            : #include <linux/usb/otg.h>
      11                 :            : 
      12                 :            : static const char *const usbphy_modes[] = {
      13                 :            :         [USBPHY_INTERFACE_MODE_UNKNOWN] = "",
      14                 :            :         [USBPHY_INTERFACE_MODE_UTMI]    = "utmi",
      15                 :            :         [USBPHY_INTERFACE_MODE_UTMIW]   = "utmi_wide",
      16                 :            :         [USBPHY_INTERFACE_MODE_ULPI]    = "ulpi",
      17                 :            :         [USBPHY_INTERFACE_MODE_SERIAL]  = "serial",
      18                 :            :         [USBPHY_INTERFACE_MODE_HSIC]    = "hsic",
      19                 :            : };
      20                 :            : 
      21                 :            : /**
      22                 :            :  * of_usb_get_phy_mode - Get phy mode for given device_node
      23                 :            :  * @np: Pointer to the given device_node
      24                 :            :  *
      25                 :            :  * The function gets phy interface string from property 'phy_type',
      26                 :            :  * and returns the corresponding enum usb_phy_interface
      27                 :            :  */
      28                 :          0 : enum usb_phy_interface of_usb_get_phy_mode(struct device_node *np)
      29                 :            : {
      30                 :            :         const char *phy_type;
      31                 :            :         int err, i;
      32                 :            : 
      33                 :          0 :         err = of_property_read_string(np, "phy_type", &phy_type);
      34                 :          0 :         if (err < 0)
      35                 :            :                 return USBPHY_INTERFACE_MODE_UNKNOWN;
      36                 :            : 
      37                 :          0 :         for (i = 0; i < ARRAY_SIZE(usbphy_modes); i++)
      38                 :          0 :                 if (!strcmp(phy_type, usbphy_modes[i]))
      39                 :          0 :                         return i;
      40                 :            : 
      41                 :            :         return USBPHY_INTERFACE_MODE_UNKNOWN;
      42                 :            : }
      43                 :            : EXPORT_SYMBOL_GPL(of_usb_get_phy_mode);
    

Generated by: LCOV version 1.14