BCMA - Reorder SPROM fill
[openwrt.git] / target / linux / ppc40x / patches / 120-usb-isp116x-hcd-add-of-binding.patch
index 6de6e9b..d869cff 100644 (file)
@@ -1,27 +1,14 @@
 --- a/drivers/usb/host/isp116x-hcd.c
 +++ b/drivers/usb/host/isp116x-hcd.c
-@@ -1531,8 +1531,11 @@ static struct hc_driver isp116x_hc_drive
-       .bus_resume = isp116x_bus_resume,
- };
+@@ -1535,6 +1535,7 @@ static struct hc_driver isp116x_hc_drive
  
-+#define resource_len(r) (((r)->end - (r)->start) + 1)
-+
  /*----------------------------------------------------------------*/
  
 +#ifdef CONFIG_USB_ISP116X_HCD_PLATFORM
  static int isp116x_remove(struct platform_device *pdev)
  {
        struct usb_hcd *hcd = platform_get_drvdata(pdev);
-@@ -1556,8 +1559,6 @@ static int isp116x_remove(struct platfor
-       return 0;
- }
--#define resource_len(r) (((r)->end - (r)->start) + 1)
--
- static int __devinit isp116x_probe(struct platform_device *pdev)
- {
-       struct usb_hcd *hcd;
-@@ -1708,22 +1709,253 @@ static struct platform_driver isp116x_dr
+@@ -1708,22 +1709,249 @@ static struct platform_driver isp116x_dr
        },
  };
  
@@ -43,8 +30,6 @@
 +
 +#ifdef CONFIG_USB_ISP116X_HCD_OF
 +
-+#include <linux/of.h>
-+#include <linux/of_device.h>
 +#include <linux/of_platform.h>
 +
 +#ifdef USE_PLATFORM_DELAY
 +#define isp116x_of_delay      NULL
 +#endif
 +
-+static int __devinit isp116x_of_probe(struct of_device *op,
-+                                    const struct of_device_id *match)
++static int __devinit isp116x_of_probe(struct platform_device *op)
 +{
-+      struct device_node *dn = op->node;
++      struct device_node *dn = op->dev.of_node;
 +      struct usb_hcd *hcd;
 +      struct isp116x *isp116x;
-+      struct resource addr, data, ires;
++      struct resource addr, data;
 +      struct isp116x_platform_data *board;
 +      void __iomem *addr_reg;
 +      void __iomem *data_reg;
 +      if (ret)
 +              return ret;
 +
-+      ret = of_irq_to_resource(dn, 1, &ires);
-+      if (ret)
-+              return ret;
-+
-+      irqflags = ires.flags & IRQF_TRIGGER_MASK;
-+
 +      board = kzalloc(sizeof(struct isp116x_platform_data), GFP_KERNEL);
 +      if (board == NULL)
 +              return -ENOMEM;
 +
-+      if (!request_mem_region(addr.start, resource_len(&addr), hcd_name)) {
++      if (!request_mem_region(addr.start, resource_size(&addr), hcd_name)) {
 +              ret = -EBUSY;
 +              goto err_free_board;
 +      }
 +
-+      addr_reg = ioremap_nocache(addr.start, resource_len(&addr));
++      addr_reg = ioremap_nocache(addr.start, resource_size(&addr));
 +      if (addr_reg == NULL) {
 +              ret = -ENOMEM;
 +              goto err_release_addr;
 +      }
 +
-+      if (!request_mem_region(data.start, resource_len(&data), hcd_name)) {
++      if (!request_mem_region(data.start, resource_size(&data), hcd_name)) {
 +              ret = -EBUSY;
 +              goto err_unmap_addr;
 +      }
 +
-+      data_reg = ioremap_nocache(data.start, resource_len(&data));
++      data_reg = ioremap_nocache(data.start, resource_size(&data));
 +      if (data_reg == NULL) {
 +              ret = -ENOMEM;
 +              goto err_release_data;
 +      }
 +
-+      irq = irq_of_parse_and_map(op->node, 0);
++      irq = irq_of_parse_and_map(dn, 0);
 +      if (irq == NO_IRQ) {
 +              ret = -EINVAL;
 +              goto err_unmap_data;
 +      if (of_get_property(dn, "int_edge_triggered", NULL))
 +              board->int_edge_triggered = 1;
 +
++      if (board->int_edge_triggered)
++              irqflags = board->int_act_high ? IRQF_TRIGGER_RISING :
++                                               IRQF_TRIGGER_FALLING;
++      else
++              irqflags = board->int_act_high ? IRQF_TRIGGER_HIGH :
++                                               IRQF_TRIGGER_LOW;
++
 +      ret = usb_add_hcd(hcd, irq, irqflags | IRQF_DISABLED);
 +      if (ret)
 +              goto err_put_hcd;
 + err_unmap_data:
 +      iounmap(data_reg);
 + err_release_data:
-+      release_mem_region(data.start, resource_len(&data));
++      release_mem_region(data.start, resource_size(&data));
 + err_unmap_addr:
 +      iounmap(addr_reg);
 + err_release_addr:
-+      release_mem_region(addr.start, resource_len(&addr));
++      release_mem_region(addr.start, resource_size(&addr));
 + err_free_board:
 +      kfree(board);
 +      return ret;
 +}
 +
-+static __devexit int isp116x_of_remove(struct of_device *op)
++static __devexit int isp116x_of_remove(struct platform_device *op)
 +{
 +      struct usb_hcd *hcd = dev_get_drvdata(&op->dev);
 +      struct isp116x *isp116x;
 +      irq_dispose_mapping(hcd->irq);
 +
 +      iounmap(isp116x->data_reg);
-+      (void) of_address_to_resource(op->node, 0, &res);
-+      release_mem_region(res.start, resource_len(&res));
++      (void) of_address_to_resource(op->dev.of_node, 0, &res);
++      release_mem_region(res.start, resource_size(&res));
 +
 +      iounmap(isp116x->addr_reg);
-+      (void) of_address_to_resource(op->node, 1, &res);
-+      release_mem_region(res.start, resource_len(&res));
++      (void) of_address_to_resource(op->dev.of_node, 1, &res);
++      release_mem_region(res.start, resource_size(&res));
 +
 +      kfree(isp116x->board);
 +      usb_put_hcd(hcd);
 +      {},
 +};
 +
-+static struct of_platform_driver isp116x_of_platform_driver = {
-+      .owner          = THIS_MODULE,
-+      .name           = "isp116x-hcd-of",
-+      .match_table    = isp116x_of_match,
++static struct platform_driver isp116x_of_platform_driver = {
 +      .probe          = isp116x_of_probe,
 +      .remove         = __devexit_p(isp116x_of_remove),
 +      .driver         = {
 +              .name   = "isp116x-hcd-of",
 +              .owner  = THIS_MODULE,
++              .of_match_table = isp116x_of_match,
 +      },
 +};
 +
 +static int __init isp116x_of_register(void)
 +{
-+      return of_register_platform_driver(&isp116x_of_platform_driver);
++      return platform_driver_register(&isp116x_of_platform_driver);
 +}
 +
 +static void __exit isp116x_of_unregister(void)
 +{
-+      of_unregister_platform_driver(&isp116x_of_platform_driver);
++      platform_driver_unregister(&isp116x_of_platform_driver);
 +}
 +
 +MODULE_DEVICE_TABLE(of, isp116x_of_match);
  module_exit(isp116x_cleanup);
 --- a/drivers/usb/host/Kconfig
 +++ b/drivers/usb/host/Kconfig
-@@ -144,6 +144,24 @@ config USB_ISP116X_HCD
+@@ -242,6 +242,24 @@ config USB_ISP116X_HCD
          To compile this driver as a module, choose M here: the
          module will be called isp116x-hcd.
  
This page took 0.036594 seconds and 4 git commands to generate.