[PATCH 1/3 v3] usb: tegra20-ehci: Add devicetree support.

Olof Johansson olof at lixom.net
Thu Jul 21 13:41:05 EST 2011


Hi,

On Wed, Jul 20, 2011 at 8:23 PM,  <achew at nvidia.com> wrote:

> diff --git a/drivers/usb/host/ehci-tegra.c b/drivers/usb/host/ehci-tegra.c
> index 02b2bfd..67c16e5 100644
> --- a/drivers/usb/host/ehci-tegra.c
> +++ b/drivers/usb/host/ehci-tegra.c
> @@ -21,10 +21,32 @@
>  #include <linux/platform_data/tegra_usb.h>
>  #include <linux/irq.h>
>  #include <linux/usb/otg.h>
> +#include <linux/of.h>
> +#include <linux/of_address.h>
> +#include <linux/of_irq.h>
> +#include <linux/of_platform.h>
> +
>  #include <mach/usb_phy.h>
>
>  #define TEGRA_USB_DMA_ALIGN 32
>
> +static u64 tegra_ehci_dmamask = DMA_BIT_MASK(TEGRA_USB_DMA_ALIGN);
> +
> +static struct tegra_utmip_config utmi_default = {

__initdata, no need to keep this around after setup.

You're also going to get a warning if you build without CONFIG_OF due
to a local static variable that is not referenced, I think.

> +       .hssync_start_delay = 9,
> +       .idle_wait_delay = 17,
> +       .elastic_limit = 16,
> +       .term_range_adj = 6,
> +       .xcvr_setup = 9,
> +       .xcvr_lsfslew = 2,
> +       .xcvr_lsrslew = 2,
> +};
> +
> +static struct tegra_ulpi_config ulpi_default = {

Same here.

> +       .reset_gpio = 169,
> +       .clk = "cdev2",
> +};
> +
>  struct tegra_ehci_hcd {
>        struct ehci_hcd *ehci;
>        struct tegra_usb_phy *phy;
> @@ -574,9 +596,155 @@ static const struct hc_driver tegra_ehci_hc_driver = {
>        .port_handed_over       = ehci_port_handed_over,
>  };
>
> +#if defined(CONFIG_OF)
> +static int tegra_ehci_parse_dt_node_utmi(struct device_node *dn,
> +                                        struct platform_device *pdev,
> +                                        struct tegra_ehci_platform_data *pdata)
> +{
> +       struct device *dev = &pdev->dev;
> +       struct tegra_utmip_config *phy_config;
> +       u32 val;
> +
> +       phy_config = devm_kzalloc(dev, sizeof(struct tegra_utmip_config),
> +                                 GFP_KERNEL);
> +       if (!phy_config)
> +               return -ENOMEM;
> +
> +       /* Copy default values. */
> +       memcpy(phy_config, &utmi_default, sizeof(struct tegra_utmip_config));

Nit: Doing *phy_config = utmi_default;   here would do type checking
for you. But it's not a big deal.



-Olof


More information about the devicetree-discuss mailing list