diff --git a/debian/config/armhf/config.omap b/debian/config/armhf/config.omap index 3c55cf316..7587f0b14 100644 --- a/debian/config/armhf/config.omap +++ b/debian/config/armhf/config.omap @@ -226,6 +226,11 @@ CONFIG_TIDSPBRIDGE_RECOVERY=y ## CONFIG_USB=y +## +## file: drivers/usb/phy/Kconfig +## +CONFIG_OMAP_USB2=y + ## ## file: drivers/usb/gadget/Kconfig ## @@ -253,6 +258,7 @@ CONFIG_USB_OHCI_HCD_OMAP3=y CONFIG_USB_MUSB_HDRC=y ## choice: Platform Glue Layer CONFIG_USB_MUSB_OMAP2PLUS=y +CONFIG_USB_INVENTRA_DMA=y ## end choice ## diff --git a/debian/patches/bugfix/arm/0001-usb-otg-Fix-build-errors-if-USB_MUSB_OMAP2PLUS-is-se.patch b/debian/patches/bugfix/arm/0001-usb-otg-Fix-build-errors-if-USB_MUSB_OMAP2PLUS-is-se.patch new file mode 100644 index 000000000..3e5864856 --- /dev/null +++ b/debian/patches/bugfix/arm/0001-usb-otg-Fix-build-errors-if-USB_MUSB_OMAP2PLUS-is-se.patch @@ -0,0 +1,58 @@ +From f6bc8c29383456b89ac1b6f1aa768d195670fb53 Mon Sep 17 00:00:00 2001 +From: Roger Quadros +Date: Mon, 29 Oct 2012 16:44:46 +0200 +Subject: [PATCH] usb: otg: Fix build errors if USB_MUSB_OMAP2PLUS is selected + as module + +TWL4030_USB & TWL6030_USB must depend on USB_MUSB_OMAP2PLUS in Kconfig else +we get build errors with + +CONFIG_USB_MUSB_HDRC=m +CONFIG_USB_MUSB_OMAP2PLUS=m +CONFIG_TWL4030_USB=y +CONFIG_TWL6030_USB=y + +LD init/built-in.o +drivers/built-in.o: In function `twl4030_usb_irq': +drivers/usb/otg/twl4030-usb.c:518: undefined reference to `omap_musb_mailbox' +drivers/built-in.o: In function `twl4030_usb_phy_init': +drivers/usb/otg/twl4030-usb.c:540: undefined reference to `omap_musb_mailbox' + +drivers/built-in.o: In function `twl6030_usb_irq': +drivers/usb/otg/twl6030-usb.c:230: undefined reference to `omap_musb_mailbox' +drivers/usb/otg/twl6030-usb.c:225: undefined reference to `omap_musb_mailbox' +drivers/built-in.o: In function `twl6030_usbotg_irq': +drivers/usb/otg/twl6030-usb.c:259: undefined reference to `omap_musb_mailbox' + +CC: Peter Meerwald +Signed-off-by: Roger Quadros +Signed-off-by: Felipe Balbi +--- + drivers/usb/otg/Kconfig | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/drivers/usb/otg/Kconfig b/drivers/usb/otg/Kconfig +index d8c8a42..6223062 100644 +--- a/drivers/usb/otg/Kconfig ++++ b/drivers/usb/otg/Kconfig +@@ -58,7 +58,7 @@ config USB_ULPI_VIEWPORT + + config TWL4030_USB + tristate "TWL4030 USB Transceiver Driver" +- depends on TWL4030_CORE && REGULATOR_TWL4030 ++ depends on TWL4030_CORE && REGULATOR_TWL4030 && USB_MUSB_OMAP2PLUS + select USB_OTG_UTILS + help + Enable this to support the USB OTG transceiver on TWL4030 +@@ -68,7 +68,7 @@ config TWL4030_USB + + config TWL6030_USB + tristate "TWL6030 USB Transceiver Driver" +- depends on TWL4030_CORE && OMAP_USB2 ++ depends on TWL4030_CORE && OMAP_USB2 && USB_MUSB_OMAP2PLUS + select USB_OTG_UTILS + help + Enable this to support the USB OTG transceiver on TWL6030 +-- +1.7.9.5 + diff --git a/debian/patches/bugfix/arm/0001-usb-otg-make-twl6030_usb-as-a-comparator-driver-to-o.patch b/debian/patches/bugfix/arm/0001-usb-otg-make-twl6030_usb-as-a-comparator-driver-to-o.patch new file mode 100644 index 000000000..1480b298c --- /dev/null +++ b/debian/patches/bugfix/arm/0001-usb-otg-make-twl6030_usb-as-a-comparator-driver-to-o.patch @@ -0,0 +1,256 @@ +From 0e98de67bacba812b1b465b90a3f940d24401c27 Mon Sep 17 00:00:00 2001 +From: Kishon Vijay Abraham I +Date: Thu, 6 Sep 2012 20:27:07 +0530 +Subject: [PATCH] usb: otg: make twl6030_usb as a comparator driver to + omap_usb2 + +All the PHY configuration other than VBUS, ID GND and OTG SRP are removed +from twl6030. The phy configurations are taken care by the dedicated +usb2 phy driver. So twl6030 is made as comparator driver for VBUS and +ID detection. + +Signed-off-by: Kishon Vijay Abraham I +Signed-off-by: Felipe Balbi +--- + drivers/usb/otg/Kconfig | 2 +- + drivers/usb/otg/twl6030-usb.c | 118 +++++++---------------------------------- + 2 files changed, 19 insertions(+), 101 deletions(-) + +diff --git a/drivers/usb/otg/Kconfig b/drivers/usb/otg/Kconfig +index 13fd1ddf..d8c8a42 100644 +--- a/drivers/usb/otg/Kconfig ++++ b/drivers/usb/otg/Kconfig +@@ -68,7 +68,7 @@ config TWL4030_USB + + config TWL6030_USB + tristate "TWL6030 USB Transceiver Driver" +- depends on TWL4030_CORE ++ depends on TWL4030_CORE && OMAP_USB2 + select USB_OTG_UTILS + help + Enable this to support the USB OTG transceiver on TWL6030 +diff --git a/drivers/usb/otg/twl6030-usb.c b/drivers/usb/otg/twl6030-usb.c +index 6907d8d..32525bb 100644 +--- a/drivers/usb/otg/twl6030-usb.c ++++ b/drivers/usb/otg/twl6030-usb.c +@@ -25,8 +25,9 @@ + #include + #include + #include +-#include + #include ++#include ++#include + #include + #include + #include +@@ -87,7 +88,7 @@ + #define VBUS_DET BIT(2) + + struct twl6030_usb { +- struct usb_phy phy; ++ struct phy_companion comparator; + struct device *dev; + + /* for vbus reporting with irqs disabled */ +@@ -107,7 +108,7 @@ struct twl6030_usb { + unsigned long features; + }; + +-#define phy_to_twl(x) container_of((x), struct twl6030_usb, phy) ++#define comparator_to_twl(x) container_of((x), struct twl6030_usb, comparator) + + /*-------------------------------------------------------------------------*/ + +@@ -137,50 +138,9 @@ static inline u8 twl6030_readb(struct twl6030_usb *twl, u8 module, u8 address) + return ret; + } + +-static int twl6030_phy_init(struct usb_phy *x) ++static int twl6030_start_srp(struct phy_companion *comparator) + { +- struct twl6030_usb *twl; +- struct device *dev; +- struct twl4030_usb_data *pdata; +- +- twl = phy_to_twl(x); +- dev = twl->dev; +- pdata = dev->platform_data; +- +- if (twl->linkstat == OMAP_MUSB_ID_GROUND) +- pdata->phy_power(twl->dev, 1, 1); +- else +- pdata->phy_power(twl->dev, 0, 1); +- +- return 0; +-} +- +-static void twl6030_phy_shutdown(struct usb_phy *x) +-{ +- struct twl6030_usb *twl; +- struct device *dev; +- struct twl4030_usb_data *pdata; +- +- twl = phy_to_twl(x); +- dev = twl->dev; +- pdata = dev->platform_data; +- pdata->phy_power(twl->dev, 0, 0); +-} +- +-static int twl6030_phy_suspend(struct usb_phy *x, int suspend) +-{ +- struct twl6030_usb *twl = phy_to_twl(x); +- struct device *dev = twl->dev; +- struct twl4030_usb_data *pdata = dev->platform_data; +- +- pdata->phy_suspend(dev, suspend); +- +- return 0; +-} +- +-static int twl6030_start_srp(struct usb_otg *otg) +-{ +- struct twl6030_usb *twl = phy_to_twl(otg->phy); ++ struct twl6030_usb *twl = comparator_to_twl(comparator); + + twl6030_writeb(twl, TWL_MODULE_USB, 0x24, USB_VBUS_CTRL_SET); + twl6030_writeb(twl, TWL_MODULE_USB, 0x84, USB_VBUS_CTRL_SET); +@@ -313,23 +273,8 @@ static irqreturn_t twl6030_usbotg_irq(int irq, void *_twl) + return IRQ_HANDLED; + } + +-static int twl6030_set_peripheral(struct usb_otg *otg, +- struct usb_gadget *gadget) ++static int twl6030_enable_irq(struct twl6030_usb *twl) + { +- if (!otg) +- return -ENODEV; +- +- otg->gadget = gadget; +- if (!gadget) +- otg->phy->state = OTG_STATE_UNDEFINED; +- +- return 0; +-} +- +-static int twl6030_enable_irq(struct usb_phy *x) +-{ +- struct twl6030_usb *twl = phy_to_twl(x); +- + twl6030_writeb(twl, TWL_MODULE_USB, 0x1, USB_ID_INT_EN_HI_SET); + twl6030_interrupt_unmask(0x05, REG_INT_MSK_LINE_C); + twl6030_interrupt_unmask(0x05, REG_INT_MSK_STS_C); +@@ -362,9 +307,9 @@ static void otg_set_vbus_work(struct work_struct *data) + CHARGERUSB_CTRL1); + } + +-static int twl6030_set_vbus(struct usb_otg *otg, bool enabled) ++static int twl6030_set_vbus(struct phy_companion *comparator, bool enabled) + { +- struct twl6030_usb *twl = phy_to_twl(otg->phy); ++ struct twl6030_usb *twl = comparator_to_twl(comparator); + + twl->vbus_enable = enabled; + schedule_work(&twl->set_vbus_work); +@@ -372,23 +317,12 @@ static int twl6030_set_vbus(struct usb_otg *otg, bool enabled) + return 0; + } + +-static int twl6030_set_host(struct usb_otg *otg, struct usb_bus *host) +-{ +- if (!otg) +- return -ENODEV; +- +- otg->host = host; +- if (!host) +- otg->phy->state = OTG_STATE_UNDEFINED; +- return 0; +-} +- + static int __devinit twl6030_usb_probe(struct platform_device *pdev) + { ++ u32 ret; + struct twl6030_usb *twl; + int status, err; + struct twl4030_usb_data *pdata; +- struct usb_otg *otg; + struct device *dev = &pdev->dev; + pdata = dev->platform_data; + +@@ -396,28 +330,20 @@ static int __devinit twl6030_usb_probe(struct platform_device *pdev) + if (!twl) + return -ENOMEM; + +- otg = devm_kzalloc(dev, sizeof *otg, GFP_KERNEL); +- if (!otg) +- return -ENOMEM; +- + twl->dev = &pdev->dev; + twl->irq1 = platform_get_irq(pdev, 0); + twl->irq2 = platform_get_irq(pdev, 1); + twl->features = pdata->features; + twl->linkstat = OMAP_MUSB_UNKNOWN; + +- twl->phy.dev = twl->dev; +- twl->phy.label = "twl6030"; +- twl->phy.otg = otg; +- twl->phy.init = twl6030_phy_init; +- twl->phy.shutdown = twl6030_phy_shutdown; +- twl->phy.set_suspend = twl6030_phy_suspend; ++ twl->comparator.set_vbus = twl6030_set_vbus; ++ twl->comparator.start_srp = twl6030_start_srp; + +- otg->phy = &twl->phy; +- otg->set_host = twl6030_set_host; +- otg->set_peripheral = twl6030_set_peripheral; +- otg->set_vbus = twl6030_set_vbus; +- otg->start_srp = twl6030_start_srp; ++ ret = omap_usb2_set_comparator(&twl->comparator); ++ if (ret == -ENODEV) { ++ dev_info(&pdev->dev, "phy not ready, deferring probe"); ++ return -EPROBE_DEFER; ++ } + + /* init spinlock for workqueue */ + spin_lock_init(&twl->lock); +@@ -427,7 +353,6 @@ static int __devinit twl6030_usb_probe(struct platform_device *pdev) + dev_err(&pdev->dev, "ldo init failed\n"); + return err; + } +- usb_add_phy(&twl->phy, USB_PHY_TYPE_USB2); + + platform_set_drvdata(pdev, twl); + if (device_create_file(&pdev->dev, &dev_attr_vbus)) +@@ -458,9 +383,7 @@ static int __devinit twl6030_usb_probe(struct platform_device *pdev) + } + + twl->asleep = 0; +- pdata->phy_init(dev); +- twl6030_phy_suspend(&twl->phy, 0); +- twl6030_enable_irq(&twl->phy); ++ twl6030_enable_irq(twl); + dev_info(&pdev->dev, "Initialized TWL6030 USB module\n"); + + return 0; +@@ -470,10 +393,6 @@ static int __exit twl6030_usb_remove(struct platform_device *pdev) + { + struct twl6030_usb *twl = platform_get_drvdata(pdev); + +- struct twl4030_usb_data *pdata; +- struct device *dev = &pdev->dev; +- pdata = dev->platform_data; +- + twl6030_interrupt_mask(TWL6030_USBOTG_INT_MASK, + REG_INT_MSK_LINE_C); + twl6030_interrupt_mask(TWL6030_USBOTG_INT_MASK, +@@ -481,7 +400,6 @@ static int __exit twl6030_usb_remove(struct platform_device *pdev) + free_irq(twl->irq1, twl); + free_irq(twl->irq2, twl); + regulator_put(twl->usb3v3); +- pdata->phy_exit(twl->dev); + device_remove_file(twl->dev, &dev_attr_vbus); + cancel_work_sync(&twl->set_vbus_work); + +-- +1.7.9.5 + diff --git a/debian/patches/bugfix/arm/0001-usb-phy-add-a-new-driver-for-omap-usb2-phy.patch b/debian/patches/bugfix/arm/0001-usb-phy-add-a-new-driver-for-omap-usb2-phy.patch new file mode 100644 index 000000000..b8b9aa613 --- /dev/null +++ b/debian/patches/bugfix/arm/0001-usb-phy-add-a-new-driver-for-omap-usb2-phy.patch @@ -0,0 +1,449 @@ +From 657b306a7bdfca4ae1514b533a0e7c3c6d26dbc6 Mon Sep 17 00:00:00 2001 +From: Kishon Vijay Abraham I +Date: Thu, 6 Sep 2012 20:27:06 +0530 +Subject: [PATCH] usb: phy: add a new driver for omap usb2 phy + +All phy related programming like enabling/disabling the clocks, powering +on/off the phy is taken care of by this driver. It is also used for OTG +related functionality like srp. + +This also includes device tree support for usb2 phy driver and +the documentation with device tree binding information is updated. + +Currently writing to control module register is taken care in this +driver which will be removed once the control module driver is in place. + +Cc: Felipe Balbi +Signed-off-by: Kishon Vijay Abraham I +Signed-off-by: Felipe Balbi +--- + Documentation/devicetree/bindings/usb/usb-phy.txt | 17 ++ + drivers/usb/phy/Kconfig | 9 + + drivers/usb/phy/Makefile | 1 + + drivers/usb/phy/omap-usb2.c | 271 +++++++++++++++++++++ + include/linux/usb/omap_usb.h | 46 ++++ + include/linux/usb/phy_companion.h | 34 +++ + 6 files changed, 378 insertions(+) + create mode 100644 Documentation/devicetree/bindings/usb/usb-phy.txt + create mode 100644 drivers/usb/phy/omap-usb2.c + create mode 100644 include/linux/usb/omap_usb.h + create mode 100644 include/linux/usb/phy_companion.h + +Index: experimental/Documentation/devicetree/bindings/usb/usb-phy.txt +=================================================================== +--- /dev/null 1970-01-01 00:00:00.000000000 +0000 ++++ experimental/Documentation/devicetree/bindings/usb/usb-phy.txt 2012-12-05 11:46:39.767567050 +0100 +@@ -0,0 +1,17 @@ ++USB PHY ++ ++OMAP USB2 PHY ++ ++Required properties: ++ - compatible: Should be "ti,omap-usb2" ++ - reg : Address and length of the register set for the device. Also ++add the address of control module dev conf register until a driver for ++control module is added ++ ++This is usually a subnode of ocp2scp to which it is connected. ++ ++usb2phy@4a0ad080 { ++ compatible = "ti,omap-usb2"; ++ reg = <0x4a0ad080 0x58>, ++ <0x4a002300 0x4>; ++}; +Index: experimental/drivers/usb/phy/Kconfig +=================================================================== +--- experimental.orig/drivers/usb/phy/Kconfig 2012-12-03 20:39:49.000000000 +0100 ++++ experimental/drivers/usb/phy/Kconfig 2012-12-05 11:46:39.775567051 +0100 +@@ -4,6 +4,15 @@ + comment "USB Physical Layer drivers" + depends on USB || USB_GADGET + ++config OMAP_USB2 ++ tristate "OMAP USB2 PHY Driver" ++ select USB_OTG_UTILS ++ help ++ Enable this to support the transceiver that is part of SOC. This ++ driver takes care of all the PHY functionality apart from comparator. ++ The USB OTG controller communicates with the comparator using this ++ driver. ++ + config USB_ISP1301 + tristate "NXP ISP1301 USB transceiver support" + depends on USB || USB_GADGET +Index: experimental/drivers/usb/phy/Makefile +=================================================================== +--- experimental.orig/drivers/usb/phy/Makefile 2012-12-03 20:39:49.000000000 +0100 ++++ experimental/drivers/usb/phy/Makefile 2012-12-05 11:46:39.807567048 +0100 +@@ -4,4 +4,5 @@ + + ccflags-$(CONFIG_USB_DEBUG) := -DDEBUG + ++obj-$(CONFIG_OMAP_USB2) += omap-usb2.o + obj-$(CONFIG_USB_ISP1301) += isp1301.o +Index: experimental/drivers/usb/phy/omap-usb2.c +=================================================================== +--- /dev/null 1970-01-01 00:00:00.000000000 +0000 ++++ experimental/drivers/usb/phy/omap-usb2.c 2012-12-05 11:46:39.819567049 +0100 +@@ -0,0 +1,271 @@ ++/* ++ * omap-usb2.c - USB PHY, talking to musb controller in OMAP. ++ * ++ * Copyright (C) 2012 Texas Instruments Incorporated - http://www.ti.com ++ * This program is free software; you can redistribute it and/or modify ++ * it under the terms of the GNU General Public License as published by ++ * the Free Software Foundation; either version 2 of the License, or ++ * (at your option) any later version. ++ * ++ * Author: Kishon Vijay Abraham I ++ * ++ * This program is distributed in the hope that it will be useful, ++ * but WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++ * GNU General Public License for more details. ++ * ++ */ ++ ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++ ++/** ++ * omap_usb2_set_comparator - links the comparator present in the sytem with ++ * this phy ++ * @comparator - the companion phy(comparator) for this phy ++ * ++ * The phy companion driver should call this API passing the phy_companion ++ * filled with set_vbus and start_srp to be used by usb phy. ++ * ++ * For use by phy companion driver ++ */ ++int omap_usb2_set_comparator(struct phy_companion *comparator) ++{ ++ struct omap_usb *phy; ++ struct usb_phy *x = usb_get_phy(USB_PHY_TYPE_USB2); ++ ++ if (IS_ERR(x)) ++ return -ENODEV; ++ ++ phy = phy_to_omapusb(x); ++ phy->comparator = comparator; ++ return 0; ++} ++EXPORT_SYMBOL_GPL(omap_usb2_set_comparator); ++ ++/** ++ * omap_usb_phy_power - power on/off the phy using control module reg ++ * @phy: struct omap_usb * ++ * @on: 0 or 1, based on powering on or off the PHY ++ * ++ * XXX: Remove this function once control module driver gets merged ++ */ ++static void omap_usb_phy_power(struct omap_usb *phy, int on) ++{ ++ u32 val; ++ ++ if (on) { ++ val = readl(phy->control_dev); ++ if (val & PHY_PD) { ++ writel(~PHY_PD, phy->control_dev); ++ /* XXX: add proper documentation for this delay */ ++ mdelay(200); ++ } ++ } else { ++ writel(PHY_PD, phy->control_dev); ++ } ++} ++ ++static int omap_usb_set_vbus(struct usb_otg *otg, bool enabled) ++{ ++ struct omap_usb *phy = phy_to_omapusb(otg->phy); ++ ++ if (!phy->comparator) ++ return -ENODEV; ++ ++ return phy->comparator->set_vbus(phy->comparator, enabled); ++} ++ ++static int omap_usb_start_srp(struct usb_otg *otg) ++{ ++ struct omap_usb *phy = phy_to_omapusb(otg->phy); ++ ++ if (!phy->comparator) ++ return -ENODEV; ++ ++ return phy->comparator->start_srp(phy->comparator); ++} ++ ++static int omap_usb_set_host(struct usb_otg *otg, struct usb_bus *host) ++{ ++ struct usb_phy *phy = otg->phy; ++ ++ otg->host = host; ++ if (!host) ++ phy->state = OTG_STATE_UNDEFINED; ++ ++ return 0; ++} ++ ++static int omap_usb_set_peripheral(struct usb_otg *otg, ++ struct usb_gadget *gadget) ++{ ++ struct usb_phy *phy = otg->phy; ++ ++ otg->gadget = gadget; ++ if (!gadget) ++ phy->state = OTG_STATE_UNDEFINED; ++ ++ return 0; ++} ++ ++static int omap_usb2_suspend(struct usb_phy *x, int suspend) ++{ ++ u32 ret; ++ struct omap_usb *phy = phy_to_omapusb(x); ++ ++ if (suspend && !phy->is_suspended) { ++ omap_usb_phy_power(phy, 0); ++ pm_runtime_put_sync(phy->dev); ++ phy->is_suspended = 1; ++ } else if (!suspend && phy->is_suspended) { ++ ret = pm_runtime_get_sync(phy->dev); ++ if (ret < 0) { ++ dev_err(phy->dev, "get_sync failed with err %d\n", ++ ret); ++ return ret; ++ } ++ omap_usb_phy_power(phy, 1); ++ phy->is_suspended = 0; ++ } ++ ++ return 0; ++} ++ ++static int __devinit omap_usb2_probe(struct platform_device *pdev) ++{ ++ struct omap_usb *phy; ++ struct usb_otg *otg; ++ struct resource *res; ++ ++ phy = devm_kzalloc(&pdev->dev, sizeof(*phy), GFP_KERNEL); ++ if (!phy) { ++ dev_err(&pdev->dev, "unable to allocate memory for USB2 PHY\n"); ++ return -ENOMEM; ++ } ++ ++ otg = devm_kzalloc(&pdev->dev, sizeof(*otg), GFP_KERNEL); ++ if (!otg) { ++ dev_err(&pdev->dev, "unable to allocate memory for USB OTG\n"); ++ return -ENOMEM; ++ } ++ ++ phy->dev = &pdev->dev; ++ ++ phy->phy.dev = phy->dev; ++ phy->phy.label = "omap-usb2"; ++ phy->phy.set_suspend = omap_usb2_suspend; ++ phy->phy.otg = otg; ++ ++ res = platform_get_resource(pdev, IORESOURCE_MEM, 1); ++ ++ phy->control_dev = devm_request_and_ioremap(&pdev->dev, res); ++ if (phy->control_dev == NULL) { ++ dev_err(&pdev->dev, "Failed to obtain io memory\n"); ++ return -ENXIO; ++ } ++ ++ phy->is_suspended = 1; ++ omap_usb_phy_power(phy, 0); ++ ++ otg->set_host = omap_usb_set_host; ++ otg->set_peripheral = omap_usb_set_peripheral; ++ otg->set_vbus = omap_usb_set_vbus; ++ otg->start_srp = omap_usb_start_srp; ++ otg->phy = &phy->phy; ++ ++ phy->wkupclk = devm_clk_get(phy->dev, "usb_phy_cm_clk32k"); ++ if (IS_ERR(phy->wkupclk)) { ++ dev_err(&pdev->dev, "unable to get usb_phy_cm_clk32k\n"); ++ return PTR_ERR(phy->wkupclk); ++ } ++ clk_prepare(phy->wkupclk); ++ ++ usb_add_phy(&phy->phy, USB_PHY_TYPE_USB2); ++ ++ platform_set_drvdata(pdev, phy); ++ ++ pm_runtime_enable(phy->dev); ++ ++ return 0; ++} ++ ++static int __devexit omap_usb2_remove(struct platform_device *pdev) ++{ ++ struct omap_usb *phy = platform_get_drvdata(pdev); ++ ++ clk_unprepare(phy->wkupclk); ++ usb_remove_phy(&phy->phy); ++ ++ return 0; ++} ++ ++#ifdef CONFIG_PM_RUNTIME ++ ++static int omap_usb2_runtime_suspend(struct device *dev) ++{ ++ struct platform_device *pdev = to_platform_device(dev); ++ struct omap_usb *phy = platform_get_drvdata(pdev); ++ ++ clk_disable(phy->wkupclk); ++ ++ return 0; ++} ++ ++static int omap_usb2_runtime_resume(struct device *dev) ++{ ++ u32 ret = 0; ++ struct platform_device *pdev = to_platform_device(dev); ++ struct omap_usb *phy = platform_get_drvdata(pdev); ++ ++ ret = clk_enable(phy->wkupclk); ++ if (ret < 0) ++ dev_err(phy->dev, "Failed to enable wkupclk %d\n", ret); ++ ++ return ret; ++} ++ ++static const struct dev_pm_ops omap_usb2_pm_ops = { ++ SET_RUNTIME_PM_OPS(omap_usb2_runtime_suspend, omap_usb2_runtime_resume, ++ NULL) ++}; ++ ++#define DEV_PM_OPS (&omap_usb2_pm_ops) ++#else ++#define DEV_PM_OPS NULL ++#endif ++ ++#ifdef CONFIG_OF ++static const struct of_device_id omap_usb2_id_table[] = { ++ { .compatible = "ti,omap-usb2" }, ++ {} ++}; ++MODULE_DEVICE_TABLE(of, omap_usb2_id_table); ++#endif ++ ++static struct platform_driver omap_usb2_driver = { ++ .probe = omap_usb2_probe, ++ .remove = __devexit_p(omap_usb2_remove), ++ .driver = { ++ .name = "omap-usb2", ++ .owner = THIS_MODULE, ++ .pm = DEV_PM_OPS, ++ .of_match_table = of_match_ptr(omap_usb2_id_table), ++ }, ++}; ++ ++module_platform_driver(omap_usb2_driver); ++ ++MODULE_ALIAS("platform: omap_usb2"); ++MODULE_AUTHOR("Texas Instruments Inc."); ++MODULE_DESCRIPTION("OMAP USB2 phy driver"); ++MODULE_LICENSE("GPL v2"); +Index: experimental/include/linux/usb/omap_usb.h +=================================================================== +--- /dev/null 1970-01-01 00:00:00.000000000 +0000 ++++ experimental/include/linux/usb/omap_usb.h 2012-12-05 11:46:39.827567048 +0100 +@@ -0,0 +1,46 @@ ++/* ++ * omap_usb.h -- omap usb2 phy header file ++ * ++ * Copyright (C) 2012 Texas Instruments Incorporated - http://www.ti.com ++ * This program is free software; you can redistribute it and/or modify ++ * it under the terms of the GNU General Public License as published by ++ * the Free Software Foundation; either version 2 of the License, or ++ * (at your option) any later version. ++ * ++ * Author: Kishon Vijay Abraham I ++ * ++ * This program is distributed in the hope that it will be useful, ++ * but WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++ * GNU General Public License for more details. ++ * ++ */ ++ ++#ifndef __DRIVERS_OMAP_USB2_H ++#define __DRIVERS_OMAP_USB2_H ++ ++#include ++ ++struct omap_usb { ++ struct usb_phy phy; ++ struct phy_companion *comparator; ++ struct device *dev; ++ u32 __iomem *control_dev; ++ struct clk *wkupclk; ++ u8 is_suspended:1; ++}; ++ ++#define PHY_PD 0x1 ++ ++#define phy_to_omapusb(x) container_of((x), struct omap_usb, phy) ++ ++#if defined(CONFIG_OMAP_USB2) || defined(CONFIG_OMAP_USB2_MODULE) ++extern int omap_usb2_set_comparator(struct phy_companion *comparator); ++#else ++static inline int omap_usb2_set_comparator(struct phy_companion *comparator) ++{ ++ return -ENODEV; ++} ++#endif ++ ++#endif /* __DRIVERS_OMAP_USB_H */ +Index: experimental/include/linux/usb/phy_companion.h +=================================================================== +--- /dev/null 1970-01-01 00:00:00.000000000 +0000 ++++ experimental/include/linux/usb/phy_companion.h 2012-12-05 11:46:39.839567047 +0100 +@@ -0,0 +1,34 @@ ++/* ++ * phy-companion.h -- phy companion to indicate the comparator part of PHY ++ * ++ * Copyright (C) 2012 Texas Instruments Incorporated - http://www.ti.com ++ * This program is free software; you can redistribute it and/or modify ++ * it under the terms of the GNU General Public License as published by ++ * the Free Software Foundation; either version 2 of the License, or ++ * (at your option) any later version. ++ * ++ * Author: Kishon Vijay Abraham I ++ * ++ * This program is distributed in the hope that it will be useful, ++ * but WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++ * GNU General Public License for more details. ++ * ++ */ ++ ++#ifndef __DRIVERS_PHY_COMPANION_H ++#define __DRIVERS_PHY_COMPANION_H ++ ++#include ++ ++/* phy_companion to take care of VBUS, ID and srp capabilities */ ++struct phy_companion { ++ ++ /* effective for A-peripheral, ignored for B devices */ ++ int (*set_vbus)(struct phy_companion *x, bool enabled); ++ ++ /* for B devices only: start session with A-Host */ ++ int (*start_srp)(struct phy_companion *x); ++}; ++ ++#endif /* __DRIVERS_PHY_COMPANION_H */ diff --git a/debian/patches/bugfix/arm/omap-musb-choice.patch b/debian/patches/bugfix/arm/omap-musb-choice.patch new file mode 100644 index 000000000..3e67b9396 --- /dev/null +++ b/debian/patches/bugfix/arm/omap-musb-choice.patch @@ -0,0 +1,33 @@ +drivers/usb/musb/Kconfig: remove the 'Glue Layer' choice. + +In the config.omap configuration, we're setting CONFIG_USB_MUSB_OMAP2PLUS +to 'y' but after running the script to create our configuration file, it's +set to 'm', even if 'y' is valid. This result in an invalid configuration +and build failure (missing omap_musb_mailbox symbol in our kernel binary). + +Removing the choice entry make things work. + +Signed-off-by: Arnaud Patard +Index: linux/drivers/usb/musb/Kconfig +=================================================================== +--- linux.orig/drivers/usb/musb/Kconfig 2012-12-03 20:39:49.000000000 +0100 ++++ linux/drivers/usb/musb/Kconfig 2012-12-05 15:06:20.000000000 +0100 +@@ -33,9 +33,6 @@ config USB_MUSB_HDRC + + if USB_MUSB_HDRC + +-choice +- prompt "Platform Glue Layer" +- + config USB_MUSB_DAVINCI + tristate "DaVinci" + depends on ARCH_DAVINCI_DMx +@@ -67,8 +64,6 @@ config USB_MUSB_UX500 + tristate "U8500 and U5500" + depends on (ARCH_U8500 && AB8500_USB) + +-endchoice +- + choice + prompt 'MUSB DMA mode' + default USB_UX500_DMA if USB_MUSB_UX500 diff --git a/debian/patches/series b/debian/patches/series index 0033ca94c..8f5b3910a 100644 --- a/debian/patches/series +++ b/debian/patches/series @@ -51,4 +51,7 @@ debian/fs-enable-link-security-restrictions-by-default.patch bugfix/all/hid-add-apple-wireless-keyboard-2011-ansi-to-special-driver-list.patch bugfix/arm/ARM-7492-1-add-strstr-declaration-for-decompressors.patch bugfix/arm/lis3l02dq-fix-building-without-irq-to-gpio.patch - +bugfix/arm/0001-usb-phy-add-a-new-driver-for-omap-usb2-phy.patch +bugfix/arm/0001-usb-otg-make-twl6030_usb-as-a-comparator-driver-to-o.patch +bugfix/arm/0001-usb-otg-Fix-build-errors-if-USB_MUSB_OMAP2PLUS-is-se.patch +bugfix/arm/omap-musb-choice.patch