]> rtime.felk.cvut.cz Git - sojka/nv-tegra/linux-3.10.git/commitdiff
misc: tegra-baseband: remove EHCI info from board file
authorMark Kuo <mkuo@nvidia.com>
Tue, 5 Aug 2014 08:44:23 +0000 (16:44 +0800)
committerSuresh Mangipudi <smangipudi@nvidia.com>
Thu, 7 Aug 2014 06:40:41 +0000 (23:40 -0700)
This is a WAR after EHCI moves to DT. We shall try to work out a
solution to load/unload EHCI from DT in modem driver. This change only
moves the statically defined tegra_ehci_device and platform data from
board file to modem driver to dynamically load/unload EHCI.

Bug 1522530

Change-Id: I4c1a291dab93157f27e88bde8dbdf3a5dd5b76e2
Signed-off-by: Mark Kuo <mkuo@nvidia.com>
Reviewed-on: http://git-master/r/452872
Reviewed-by: Suresh Mangipudi <smangipudi@nvidia.com>
Tested-by: Suresh Mangipudi <smangipudi@nvidia.com>
Reviewed-by: Venkat Moganty <vmoganty@nvidia.com>
arch/arm/mach-tegra/board-ardbeg.c
arch/arm64/mach-tegra/board-t210ref.c
drivers/misc/tegra-baseband/tegra_usb_modem_power.c

index 553dd12951db5e8b2dff4388e58a90a9d896d49b..f81ae137051f1ad7f2295ca941f5646a3eeeab2d 100644 (file)
@@ -749,24 +749,6 @@ static void ardbeg_xusb_init(void)
 }
 #endif
 
-static struct tegra_usb_platform_data tegra_ehci2_hsic_baseband_pdata = {
-       .port_otg = false,
-       .has_hostpc = true,
-       .unaligned_dma_buf_supported = true,
-       .phy_intf = TEGRA_USB_PHY_INTF_HSIC,
-       .op_mode = TEGRA_USB_OPMODE_HOST,
-       .u_data.host = {
-               .hot_plug = false,
-               .remote_wakeup_supported = true,
-               .power_off_on_suspend = true,
-       },
-};
-
-static struct tegra_usb_modem_power_platform_data baseband_pdata = {
-       .tegra_ehci_device = &tegra_ehci2_device,
-       .tegra_ehci_pdata = &tegra_ehci2_hsic_baseband_pdata,
-};
-
 static void ardbeg_modem_init(void)
 {
 #if !defined(CONFIG_ARM64)
@@ -866,8 +848,7 @@ static struct of_dev_auxdata ardbeg_auxdata_lookup[] __initdata = {
 #ifdef CONFIG_TEGRA_CEC_SUPPORT
        OF_DEV_AUXDATA("nvidia,tegra124-cec", 0x70015000, "tegra_cec", NULL),
 #endif
-       OF_DEV_AUXDATA("nvidia,icera-i500", 0, "tegra_usb_modem_power",
-               &baseband_pdata),
+       OF_DEV_AUXDATA("nvidia,icera-i500", 0, "tegra_usb_modem_power", NULL),
        OF_DEV_AUXDATA("nvidia,ptm", 0x7081c000, "ptm", NULL),
        OF_DEV_AUXDATA("nvidia,tegra30-hda", 0x70030000, "tegra30-hda", NULL),
        {}
index fc10912a15e082c852ff2bf67b0c2101c081e8dc..a67825198873e35997a29ec6104cc36836c9ef48 100644 (file)
@@ -178,19 +178,6 @@ static struct platform_device *t210ref_devices[] __initdata = {
 #endif
 };
 
-static struct tegra_usb_platform_data tegra_ehci2_hsic_baseband_pdata = {
-       .port_otg = false,
-       .has_hostpc = true,
-       .unaligned_dma_buf_supported = true,
-       .phy_intf = TEGRA_USB_PHY_INTF_HSIC,
-       .op_mode = TEGRA_USB_OPMODE_HOST,
-       .u_data.host = {
-               .hot_plug = false,
-               .remote_wakeup_supported = true,
-               .power_off_on_suspend = true,
-       },
-};
-
 static void t210ref_usb_init(void)
 {
        int usb_port_owner_info = tegra_get_usb_port_owner_info();
@@ -236,11 +223,6 @@ static void t210ref_xusb_init(void)
 }
 #endif
 
-static struct tegra_usb_modem_power_platform_data baseband_pdata = {
-       .tegra_ehci_device = &tegra_ehci2_device,
-       .tegra_ehci_pdata = &tegra_ehci2_hsic_baseband_pdata,
-};
-
 #ifdef CONFIG_USE_OF
 #if defined(CONFIG_ARCH_TEGRA_21x_SOC)
 struct of_dev_auxdata t210ref_auxdata_lookup[] __initdata = {
@@ -424,8 +406,7 @@ static struct of_dev_auxdata t210ref_auxdata_lookup[] __initdata = {
        OF_DEV_AUXDATA("nvidia,tegra-bluedroid_pm", 0, "bluedroid_pm",
                        NULL),
        OF_DEV_AUXDATA("pwm-backlight", 0, "pwm-backlight", NULL),
-       OF_DEV_AUXDATA("nvidia,icera-i500", 0, "tegra_usb_modem_power",
-               &baseband_pdata),
+       OF_DEV_AUXDATA("nvidia,icera-i500", 0, "tegra_usb_modem_power", NULL),
        OF_DEV_AUXDATA("raydium,rm_ts_spidev", 0, "rm_ts_spidev", NULL),
        OF_DEV_AUXDATA("nvidia,tegra30-hda", 0x70030000, "tegra30-hda", NULL),
        {}
index 50bc462c33a249df7827860f51fda8fa2b5c581b..03a5f906563a41ed0147e41b31891aafae195034 100644 (file)
@@ -37,6 +37,8 @@
 #include <linux/sysedp.h>
 #include <mach/gpio-tegra.h>
 #include <linux/platform_data/tegra_usb_modem_power.h>
+#include <linux/dma-mapping.h>
+#include "../../../arch/arm/mach-tegra/iomap.h"
 
 #define BOOST_CPU_FREQ_MIN     1200000
 #define BOOST_CPU_FREQ_TIMEOUT 5000
 #define DEFAULT_AUTOSUSPEND            2000
 #define DEFAULT_SHORT_AUTOSUSPEND      50
 
+static u64 tegra_ehci_dmamask = DMA_BIT_MASK(64);
+
+static struct resource tegra_usb2_resources[] = {
+       [0] = {
+               .start  = TEGRA_USB2_BASE,
+               .end    = TEGRA_USB2_BASE + TEGRA_USB2_SIZE - 1,
+               .flags  = IORESOURCE_MEM,
+       },
+       [1] = {
+               .start  = INT_USB2,
+               .end    = INT_USB2,
+               .flags  = IORESOURCE_IRQ,
+       },
+};
+
+static struct platform_device tegra_ehci2_device = {
+       .name   = "tegra-ehci",
+       .id     = 1,
+       .dev    = {
+               .dma_mask       = &tegra_ehci_dmamask,
+               .coherent_dma_mask = DMA_BIT_MASK(64),
+       },
+       .resource = tegra_usb2_resources,
+       .num_resources = ARRAY_SIZE(tegra_usb2_resources),
+};
+
+static struct tegra_usb_platform_data tegra_ehci2_hsic_baseband_pdata = {
+       .port_otg = false,
+       .has_hostpc = true,
+       .unaligned_dma_buf_supported = true,
+       .phy_intf = TEGRA_USB_PHY_INTF_HSIC,
+       .op_mode = TEGRA_USB_OPMODE_HOST,
+       .u_data.host = {
+               .hot_plug = false,
+               .remote_wakeup_supported = true,
+               .power_off_on_suspend = true,
+       },
+};
+
 struct tegra_usb_modem {
        struct tegra_usb_modem_power_platform_data *pdata;
        struct platform_device *pdev;
@@ -484,7 +525,7 @@ static struct platform_device *tegra_usb_host_register(
        pdev->dev.coherent_dma_mask = hc_device->dev.coherent_dma_mask;
 
        val = platform_device_add_data(pdev, modem->pdata->tegra_ehci_pdata,
-                                      sizeof(struct tegra_usb_platform_data));
+                                       sizeof(struct tegra_usb_platform_data));
        if (val)
                goto error;
 
@@ -557,6 +598,10 @@ static int mdm_init(struct tegra_usb_modem *modem, struct platform_device *pdev)
        modem->pdata = pdata;
        modem->pdev = pdev;
 
+       /* WAR to load statically defined ehci device/pdata */
+       pdata->tegra_ehci_device = &tegra_ehci2_device;
+       pdata->tegra_ehci_pdata = &tegra_ehci2_hsic_baseband_pdata;
+
        pdata->autosuspend_delay = DEFAULT_AUTOSUSPEND;
        pdata->short_autosuspend_delay = DEFAULT_SHORT_AUTOSUSPEND;
 
@@ -715,6 +760,18 @@ static int tegra_usb_modem_parse_dt(struct platform_device *pdev,
 
        dev_dbg(&pdev->dev, "read platform data from DT\n");
 
+       /* allocate platform data if necessary */
+       if (!pdata) {
+               pdata = devm_kzalloc(&pdev->dev,
+                       sizeof(struct tegra_usb_modem_power_platform_data),
+                       GFP_KERNEL);
+               if (!pdata) {
+                       dev_warn(&pdev->dev, "failed to allocate memory\n");
+                       return -ENOMEM;
+               }
+               pdev->dev.platform_data = pdata;
+       }
+
        /* regulator */
        pdata->regulator_name = of_get_property(node, "nvidia,regulator", NULL);
 
@@ -784,17 +841,12 @@ static int tegra_usb_modem_probe(struct platform_device *pdev)
        struct tegra_usb_modem *modem;
        int ret = 0;
 
-       if (!pdata) {
-               dev_dbg(&pdev->dev, "platform_data not available\n");
-               return -EINVAL;
-       }
-
        /* initialize from device tree */
        if (pdev->dev.of_node) {
                ret = tegra_usb_modem_parse_dt(pdev, pdata);
                if (ret) {
                        dev_err(&pdev->dev, "device tree parsing error\n");
-                       return -EINVAL;
+                       return ret;
                }
        }