From 248b64be48e15e45ec5d9c33c2c6a79f1a3ae6c2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michael=20B=C3=BCsch?= Date: Wed, 9 Mar 2011 18:26:03 +0000 Subject: [PATCH] omap24xx: Split up tahvo usb fixes SVN-Revision: 25979 --- .../590-cbus-tahvo-usb-fixes.patch | 160 ------------------ .../590-cbus-tahvo-usb-ptr-fix.patch | 71 ++++++++ .../595-cbus-tahvo-usb-leak.patch | 22 +++ .../596-cbus-tahvo-usb-clk.patch | 78 +++++++++ .../597-cbus-tahvo-usb-platform.patch | 36 ++++ 5 files changed, 207 insertions(+), 160 deletions(-) delete mode 100644 target/linux/omap24xx/patches-2.6.38/590-cbus-tahvo-usb-fixes.patch create mode 100644 target/linux/omap24xx/patches-2.6.38/590-cbus-tahvo-usb-ptr-fix.patch create mode 100644 target/linux/omap24xx/patches-2.6.38/595-cbus-tahvo-usb-leak.patch create mode 100644 target/linux/omap24xx/patches-2.6.38/596-cbus-tahvo-usb-clk.patch create mode 100644 target/linux/omap24xx/patches-2.6.38/597-cbus-tahvo-usb-platform.patch diff --git a/target/linux/omap24xx/patches-2.6.38/590-cbus-tahvo-usb-fixes.patch b/target/linux/omap24xx/patches-2.6.38/590-cbus-tahvo-usb-fixes.patch deleted file mode 100644 index 2f0ab6fb2a..0000000000 --- a/target/linux/omap24xx/patches-2.6.38/590-cbus-tahvo-usb-fixes.patch +++ /dev/null @@ -1,160 +0,0 @@ -Index: linux-2.6.38-rc7/drivers/cbus/tahvo-usb.c -=================================================================== ---- linux-2.6.38-rc7.orig/drivers/cbus/tahvo-usb.c 2011-03-06 23:00:14.411191087 +0100 -+++ linux-2.6.38-rc7/drivers/cbus/tahvo-usb.c 2011-03-06 23:43:26.524751556 +0100 -@@ -98,8 +98,9 @@ struct tahvo_usb { - #ifdef CONFIG_USB_OTG - int tahvo_mode; - #endif -+ struct clk *ick; - }; --static struct platform_device tahvo_usb_device; -+static struct tahvo_usb *tahvo_usb_device; - - /* - * --------------------------------------------------------------------------- -@@ -114,8 +115,7 @@ static struct platform_device *tahvo_otg - - static irqreturn_t omap_otg_irq(int irq, void *arg) - { -- struct platform_device *otg_dev = arg; -- struct tahvo_usb *tu = platform_get_drvdata(otg_dev); -+ struct tahvo_usb *tu = arg; - u16 otg_irq; - - otg_irq = omap_readw(OTG_IRQ_SRC); -@@ -201,12 +201,12 @@ static int __init omap_otg_probe(struct - - return request_irq(tahvo_otg_dev->resource[1].start, - omap_otg_irq, IRQF_DISABLED, DRIVER_NAME, -- &tahvo_usb_device); -+ tahvo_usb_device); - } - - static int __exit omap_otg_remove(struct platform_device *pdev) - { -- free_irq(tahvo_otg_dev->resource[1].start, &tahvo_usb_device); -+ free_irq(tahvo_otg_dev->resource[1].start, tahvo_usb_device); - tahvo_otg_dev = NULL; - - return 0; -@@ -659,6 +659,7 @@ static int __init tahvo_usb_probe(struct - tu = kzalloc(sizeof(*tu), GFP_KERNEL); - if (!tu) - return -ENOMEM; -+ tahvo_usb_device = tu; - - tu->pt_dev = container_of(dev, struct platform_device, dev); - #ifdef CONFIG_USB_OTG -@@ -673,6 +674,14 @@ static int __init tahvo_usb_probe(struct - INIT_WORK(&tu->irq_work, tahvo_usb_irq_work); - mutex_init(&tu->serialize); - -+ tu->ick = clk_get(NULL, "usb_l4_ick"); -+ if (IS_ERR(tu->ick)) { -+ printk(KERN_ERR "Failed to get usb_l4_ick\n"); -+ ret = PTR_ERR(tu->ick); -+ goto err_free_tu; -+ } -+ clk_enable(tu->ick); -+ - /* Set initial state, so that we generate kevents only on - * state changes */ - tu->vbus_state = tahvo_read_reg(TAHVO_REG_IDSR) & 0x01; -@@ -680,10 +689,9 @@ static int __init tahvo_usb_probe(struct - /* We cannot enable interrupt until omap_udc is initialized */ - ret = tahvo_request_irq(TAHVO_INT_VBUSON, tahvo_usb_vbus_interrupt, - (unsigned long) tu, "vbus_interrupt"); -- if (ret != 0) { -- kfree(tu); -+ if (ret) { - printk(KERN_ERR "Could not register Tahvo interrupt for VBUS\n"); -- return ret; -+ goto err_release_clk; - } - - /* Attributes */ -@@ -708,9 +716,7 @@ static int __init tahvo_usb_probe(struct - ret = otg_set_transceiver(&tu->otg); - if (ret < 0) { - printk(KERN_ERR "Cannot register USB transceiver\n"); -- kfree(tu); -- tahvo_free_irq(TAHVO_INT_VBUSON); -- return ret; -+ goto err_free_irq; - } - - dev_set_drvdata(dev, tu); -@@ -719,10 +725,23 @@ static int __init tahvo_usb_probe(struct - * may not be generated in addition to this. */ - schedule_work(&tu->irq_work); - return 0; -+ -+err_free_irq: -+ tahvo_free_irq(TAHVO_INT_VBUSON); -+err_release_clk: -+ clk_disable(tu->ick); -+ clk_put(tu->ick); -+err_free_tu: -+ kfree(tu); -+ tahvo_usb_device = NULL; -+ -+ return ret; - } - - static int __exit tahvo_usb_remove(struct platform_device *pdev) - { -+ struct tahvo_usb *tu = platform_get_drvdata(pdev); -+ - dev_dbg(&pdev->dev, "remove\n"); - - tahvo_free_irq(TAHVO_INT_VBUSON); -@@ -732,6 +751,12 @@ static int __exit tahvo_usb_remove(struc - #ifdef CONFIG_USB_OTG - device_remove_file(&pdev->dev, &dev_attr_otg_mode); - #endif -+ clk_disable(tu->ick); -+ clk_put(tu->ick); -+ -+ kfree(tu); -+ tahvo_usb_device = NULL; -+ - return 0; - } - -Index: linux-2.6.38-rc7/arch/arm/mach-omap2/board-n8x0.c -=================================================================== ---- linux-2.6.38-rc7.orig/arch/arm/mach-omap2/board-n8x0.c 2011-03-06 23:00:14.388188076 +0100 -+++ linux-2.6.38-rc7/arch/arm/mach-omap2/board-n8x0.c 2011-03-06 23:06:50.508033149 +0100 -@@ -40,6 +40,7 @@ - #include - #include - #include -+#include - - #include "mux.h" - -@@ -395,6 +396,14 @@ static struct musb_hdrc_platform_data tu - .config = &musb_config, - }; - -+static struct omap_usb_config n8x0_omap_usb_config __initdata = { -+ .otg = 1, -+ .register_host = 1, -+ .register_dev = 1, -+ .hmc_mode = 16, -+ .pins[0] = 6, -+}; -+ - static void __init n8x0_usb_init(void) - { - int ret = 0; -@@ -417,6 +426,8 @@ static void __init n8x0_usb_init(void) - if (ret != 0) - goto err; - -+ omap2_usbfs_init(&n8x0_omap_usb_config); -+ - printk(announce); - - return; diff --git a/target/linux/omap24xx/patches-2.6.38/590-cbus-tahvo-usb-ptr-fix.patch b/target/linux/omap24xx/patches-2.6.38/590-cbus-tahvo-usb-ptr-fix.patch new file mode 100644 index 0000000000..3453900b20 --- /dev/null +++ b/target/linux/omap24xx/patches-2.6.38/590-cbus-tahvo-usb-ptr-fix.patch @@ -0,0 +1,71 @@ +Index: linux-2.6.38-rc7/drivers/cbus/tahvo-usb.c +=================================================================== +--- linux-2.6.38-rc7.orig/drivers/cbus/tahvo-usb.c 2011-03-09 18:47:41.147540155 +0100 ++++ linux-2.6.38-rc7/drivers/cbus/tahvo-usb.c 2011-03-09 18:50:59.658485748 +0100 +@@ -99,7 +99,7 @@ struct tahvo_usb { + int tahvo_mode; + #endif + }; +-static struct platform_device tahvo_usb_device; ++static struct tahvo_usb *tahvo_usb_device; + + /* + * --------------------------------------------------------------------------- +@@ -114,8 +114,7 @@ static struct platform_device *tahvo_otg + + static irqreturn_t omap_otg_irq(int irq, void *arg) + { +- struct platform_device *otg_dev = arg; +- struct tahvo_usb *tu = platform_get_drvdata(otg_dev); ++ struct tahvo_usb *tu = arg; + u16 otg_irq; + + otg_irq = omap_readw(OTG_IRQ_SRC); +@@ -201,12 +200,12 @@ static int __init omap_otg_probe(struct + + return request_irq(tahvo_otg_dev->resource[1].start, + omap_otg_irq, IRQF_DISABLED, DRIVER_NAME, +- &tahvo_usb_device); ++ tahvo_usb_device); + } + + static int __exit omap_otg_remove(struct platform_device *pdev) + { +- free_irq(tahvo_otg_dev->resource[1].start, &tahvo_usb_device); ++ free_irq(tahvo_otg_dev->resource[1].start, tahvo_usb_device); + tahvo_otg_dev = NULL; + + return 0; +@@ -659,6 +658,7 @@ static int __init tahvo_usb_probe(struct + tu = kzalloc(sizeof(*tu), GFP_KERNEL); + if (!tu) + return -ENOMEM; ++ tahvo_usb_device = tu; + + tu->pt_dev = container_of(dev, struct platform_device, dev); + #ifdef CONFIG_USB_OTG +@@ -682,6 +682,7 @@ static int __init tahvo_usb_probe(struct + (unsigned long) tu, "vbus_interrupt"); + if (ret != 0) { + kfree(tu); ++ tahvo_usb_device = NULL; + printk(KERN_ERR "Could not register Tahvo interrupt for VBUS\n"); + return ret; + } +@@ -708,6 +709,7 @@ static int __init tahvo_usb_probe(struct + ret = otg_set_transceiver(&tu->otg); + if (ret < 0) { + printk(KERN_ERR "Cannot register USB transceiver\n"); ++ tahvo_usb_device = NULL; + kfree(tu); + tahvo_free_irq(TAHVO_INT_VBUSON); + return ret; +@@ -732,6 +734,8 @@ static int __exit tahvo_usb_remove(struc + #ifdef CONFIG_USB_OTG + device_remove_file(&pdev->dev, &dev_attr_otg_mode); + #endif ++ tahvo_usb_device = NULL; ++ + return 0; + } + diff --git a/target/linux/omap24xx/patches-2.6.38/595-cbus-tahvo-usb-leak.patch b/target/linux/omap24xx/patches-2.6.38/595-cbus-tahvo-usb-leak.patch new file mode 100644 index 0000000000..001b912fbc --- /dev/null +++ b/target/linux/omap24xx/patches-2.6.38/595-cbus-tahvo-usb-leak.patch @@ -0,0 +1,22 @@ +Index: linux-2.6.38-rc7/drivers/cbus/tahvo-usb.c +=================================================================== +--- linux-2.6.38-rc7.orig/drivers/cbus/tahvo-usb.c 2011-03-09 18:51:46.240795227 +0100 ++++ linux-2.6.38-rc7/drivers/cbus/tahvo-usb.c 2011-03-09 18:52:34.430126706 +0100 +@@ -725,6 +725,8 @@ static int __init tahvo_usb_probe(struct + + static int __exit tahvo_usb_remove(struct platform_device *pdev) + { ++ struct tahvo_usb *tu = platform_get_drvdata(pdev); ++ + dev_dbg(&pdev->dev, "remove\n"); + + tahvo_free_irq(TAHVO_INT_VBUSON); +@@ -734,6 +736,8 @@ static int __exit tahvo_usb_remove(struc + #ifdef CONFIG_USB_OTG + device_remove_file(&pdev->dev, &dev_attr_otg_mode); + #endif ++ ++ kfree(tu); + tahvo_usb_device = NULL; + + return 0; diff --git a/target/linux/omap24xx/patches-2.6.38/596-cbus-tahvo-usb-clk.patch b/target/linux/omap24xx/patches-2.6.38/596-cbus-tahvo-usb-clk.patch new file mode 100644 index 0000000000..34279b4280 --- /dev/null +++ b/target/linux/omap24xx/patches-2.6.38/596-cbus-tahvo-usb-clk.patch @@ -0,0 +1,78 @@ +Index: linux-2.6.38-rc7/drivers/cbus/tahvo-usb.c +=================================================================== +--- linux-2.6.38-rc7.orig/drivers/cbus/tahvo-usb.c 2011-03-09 18:55:47.177917578 +0100 ++++ linux-2.6.38-rc7/drivers/cbus/tahvo-usb.c 2011-03-09 18:58:35.869996276 +0100 +@@ -98,6 +98,7 @@ struct tahvo_usb { + #ifdef CONFIG_USB_OTG + int tahvo_mode; + #endif ++ struct clk *ick; + }; + static struct tahvo_usb *tahvo_usb_device; + +@@ -673,6 +674,14 @@ static int __init tahvo_usb_probe(struct + INIT_WORK(&tu->irq_work, tahvo_usb_irq_work); + mutex_init(&tu->serialize); + ++ tu->ick = clk_get(NULL, "usb_l4_ick"); ++ if (IS_ERR(tu->ick)) { ++ dev_err(dev, "Failed to get usb_l4_ick\n"); ++ ret = PTR_ERR(tu->ick); ++ goto err_free_tu; ++ } ++ clk_enable(tu->ick); ++ + /* Set initial state, so that we generate kevents only on + * state changes */ + tu->vbus_state = tahvo_read_reg(TAHVO_REG_IDSR) & 0x01; +@@ -681,10 +690,8 @@ static int __init tahvo_usb_probe(struct + ret = tahvo_request_irq(TAHVO_INT_VBUSON, tahvo_usb_vbus_interrupt, + (unsigned long) tu, "vbus_interrupt"); + if (ret != 0) { +- kfree(tu); +- tahvo_usb_device = NULL; + printk(KERN_ERR "Could not register Tahvo interrupt for VBUS\n"); +- return ret; ++ goto err_release_clk; + } + + /* Attributes */ +@@ -709,10 +716,7 @@ static int __init tahvo_usb_probe(struct + ret = otg_set_transceiver(&tu->otg); + if (ret < 0) { + printk(KERN_ERR "Cannot register USB transceiver\n"); +- tahvo_usb_device = NULL; +- kfree(tu); +- tahvo_free_irq(TAHVO_INT_VBUSON); +- return ret; ++ goto err_free_irq; + } + + dev_set_drvdata(dev, tu); +@@ -721,6 +725,17 @@ static int __init tahvo_usb_probe(struct + * may not be generated in addition to this. */ + schedule_work(&tu->irq_work); + return 0; ++ ++err_free_irq: ++ tahvo_free_irq(TAHVO_INT_VBUSON); ++err_release_clk: ++ clk_disable(tu->ick); ++ clk_put(tu->ick); ++err_free_tu: ++ kfree(tu); ++ tahvo_usb_device = NULL; ++ ++ return ret; + } + + static int __exit tahvo_usb_remove(struct platform_device *pdev) +@@ -736,6 +751,8 @@ static int __exit tahvo_usb_remove(struc + #ifdef CONFIG_USB_OTG + device_remove_file(&pdev->dev, &dev_attr_otg_mode); + #endif ++ clk_disable(tu->ick); ++ clk_put(tu->ick); + + kfree(tu); + tahvo_usb_device = NULL; diff --git a/target/linux/omap24xx/patches-2.6.38/597-cbus-tahvo-usb-platform.patch b/target/linux/omap24xx/patches-2.6.38/597-cbus-tahvo-usb-platform.patch new file mode 100644 index 0000000000..4c15cc3e8f --- /dev/null +++ b/target/linux/omap24xx/patches-2.6.38/597-cbus-tahvo-usb-platform.patch @@ -0,0 +1,36 @@ +Index: linux-2.6.38-rc7/arch/arm/mach-omap2/board-n8x0.c +=================================================================== +--- linux-2.6.38-rc7.orig/arch/arm/mach-omap2/board-n8x0.c 2011-03-09 18:47:07.749508720 +0100 ++++ linux-2.6.38-rc7/arch/arm/mach-omap2/board-n8x0.c 2011-03-09 18:59:14.355835051 +0100 +@@ -40,6 +40,7 @@ + #include + #include + #include ++#include + + #include "mux.h" + +@@ -395,6 +396,14 @@ static struct musb_hdrc_platform_data tu + .config = &musb_config, + }; + ++static struct omap_usb_config n8x0_omap_usb_config __initdata = { ++ .otg = 1, ++ .register_host = 1, ++ .register_dev = 1, ++ .hmc_mode = 16, ++ .pins[0] = 6, ++}; ++ + static void __init n8x0_usb_init(void) + { + int ret = 0; +@@ -417,6 +426,8 @@ static void __init n8x0_usb_init(void) + if (ret != 0) + goto err; + ++ omap2_usbfs_init(&n8x0_omap_usb_config); ++ + printk(announce); + + return;