ppc40x: fix build errors in the CF and ISP116X drivers

SVN-Revision: 30789
This commit is contained in:
Gabor Juhos 2012-03-02 18:03:59 +00:00
parent dcbeaed9a0
commit b98f798df4
2 changed files with 37 additions and 44 deletions

View file

@ -29,11 +29,11 @@
obj-$(CONFIG_PATA_OPTI) += pata_opti.o obj-$(CONFIG_PATA_OPTI) += pata_opti.o
--- /dev/null --- /dev/null
+++ b/drivers/ata/pata_magicbox_cf.c +++ b/drivers/ata/pata_magicbox_cf.c
@@ -0,0 +1,404 @@ @@ -0,0 +1,401 @@
+/* +/*
+ * PATA/CompactFlash driver for the MagicBox v2/OpenRB boards. + * PATA/CompactFlash driver for the MagicBox v2/OpenRB boards.
+ * + *
+ * Copyright (C) 2009 Gabor Juhos <juhosg@openwrt.org> + * Copyright (C) 2009,2012 Gabor Juhos <juhosg@openwrt.org>
+ * + *
+ * Based on the IDE driver by Wojtek Kaniewski <wojtekka@toxygen.net> + * Based on the IDE driver by Wojtek Kaniewski <wojtekka@toxygen.net>
+ * + *
@ -44,12 +44,13 @@
+ +
+#include <linux/kernel.h> +#include <linux/kernel.h>
+#include <linux/module.h> +#include <linux/module.h>
+#include <linux/slab.h>
+#include <linux/types.h> +#include <linux/types.h>
+#include <linux/ioport.h> +#include <linux/ioport.h>
+#include <linux/libata.h> +#include <linux/libata.h>
+#include <linux/irq.h> +#include <linux/irq.h>
+#include <linux/of.h> +//#include <linux/of.h>
+#include <linux/of_device.h> +//#include <linux/of_device.h>
+#include <linux/of_platform.h> +#include <linux/of_platform.h>
+#include <scsi/scsi_host.h> +#include <scsi/scsi_host.h>
+ +
@ -261,10 +262,9 @@
+ return words << 1; + return words << 1;
+} +}
+ +
+static u8 magicbox_cf_irq_on(struct ata_port *ap) +static void magicbox_cf_irq_on(struct ata_port *ap)
+{ +{
+ /* Nothing to do. */ + /* Nothing to do. */
+ return 0;
+} +}
+ +
+static void magicbox_cf_irq_clear(struct ata_port *ap) +static void magicbox_cf_irq_clear(struct ata_port *ap)
@ -305,7 +305,7 @@
+ +
+ ap->ops = &magicbox_cf_port_ops; + ap->ops = &magicbox_cf_port_ops;
+ ap->pio_mask = ATA_PIO4; + ap->pio_mask = ATA_PIO4;
+ ap->flags |= ATA_FLAG_MMIO | ATA_FLAG_NO_LEGACY | ATA_FLAG_NO_ATAPI; + ap->flags |= ATA_FLAG_NO_ATAPI;
+ +
+ ap->ioaddr.cmd_addr = info->base + MAGICBOX_CF_REG_CMD; + ap->ioaddr.cmd_addr = info->base + MAGICBOX_CF_REG_CMD;
+ ap->ioaddr.data_addr = info->base + MAGICBOX_CF_REG_DATA; + ap->ioaddr.data_addr = info->base + MAGICBOX_CF_REG_DATA;
@ -326,8 +326,7 @@
+ ap->ioaddr.ctl_addr); + ap->ioaddr.ctl_addr);
+} +}
+ +
+static int __devinit magicbox_cf_of_probe(struct of_device *op, +static int __devinit magicbox_cf_of_probe(struct platform_device *op)
+ const struct of_device_id *match)
+{ +{
+ struct magicbox_cf_info *info; + struct magicbox_cf_info *info;
+ struct ata_host *host; + struct ata_host *host;
@ -340,20 +339,20 @@
+ goto err_exit; + goto err_exit;
+ } + }
+ +
+ irq = irq_of_parse_and_map(op->node, 0); + irq = irq_of_parse_and_map(op->dev.of_node, 0);
+ if (irq < 0) { + if (irq < 0) {
+ dev_err(&op->dev, "invalid irq\n"); + dev_err(&op->dev, "invalid irq\n");
+ ret = -EINVAL; + ret = -EINVAL;
+ goto err_free_info; + goto err_free_info;
+ } + }
+ +
+ info->base = of_iomap(op->node, 0); + info->base = of_iomap(op->dev.of_node, 0);
+ if (info->base == NULL) { + if (info->base == NULL) {
+ ret = -ENOMEM; + ret = -ENOMEM;
+ goto err_free_info; + goto err_free_info;
+ } + }
+ +
+ info->ctrl = of_iomap(op->node, 1); + info->ctrl = of_iomap(op->dev.of_node, 1);
+ if (info->ctrl == NULL) { + if (info->ctrl == NULL) {
+ ret = -ENOMEM; + ret = -ENOMEM;
+ goto err_unmap_base; + goto err_unmap_base;
@ -386,7 +385,7 @@
+ return ret; + return ret;
+} +}
+ +
+static __devexit int magicbox_cf_of_remove(struct of_device *op) +static __devexit int magicbox_cf_of_remove(struct platform_device *op)
+{ +{
+ struct ata_host *host = dev_get_drvdata(&op->dev); + struct ata_host *host = dev_get_drvdata(&op->dev);
+ struct magicbox_cf_info *info = host->private_data; + struct magicbox_cf_info *info = host->private_data;
@ -404,26 +403,24 @@
+ {}, + {},
+}; +};
+ +
+static struct of_platform_driver magicbox_cf_of_platform_driver = { +static struct platform_driver magicbox_cf_of_platform_driver = {
+ .owner = THIS_MODULE,
+ .name = DRV_NAME,
+ .match_table = magicbox_cf_of_match,
+ .probe = magicbox_cf_of_probe, + .probe = magicbox_cf_of_probe,
+ .remove = __devexit_p(magicbox_cf_of_remove), + .remove = __devexit_p(magicbox_cf_of_remove),
+ .driver = { + .driver = {
+ .name = DRV_NAME, + .name = DRV_NAME,
+ .owner = THIS_MODULE, + .owner = THIS_MODULE,
+ .of_match_table = magicbox_cf_of_match,
+ }, + },
+}; +};
+ +
+static int __init magicbox_cf_init(void) +static int __init magicbox_cf_init(void)
+{ +{
+ return of_register_platform_driver(&magicbox_cf_of_platform_driver); + return platform_driver_register(&magicbox_cf_of_platform_driver);
+} +}
+ +
+static void __exit magicbox_cf_exit(void) +static void __exit magicbox_cf_exit(void)
+{ +{
+ of_unregister_platform_driver(&magicbox_cf_of_platform_driver); + platform_driver_unregister(&magicbox_cf_of_platform_driver);
+} +}
+ +
+module_init(magicbox_cf_init); +module_init(magicbox_cf_init);

View file

@ -8,7 +8,7 @@
static int isp116x_remove(struct platform_device *pdev) static int isp116x_remove(struct platform_device *pdev)
{ {
struct usb_hcd *hcd = platform_get_drvdata(pdev); struct usb_hcd *hcd = platform_get_drvdata(pdev);
@@ -1708,22 +1709,253 @@ static struct platform_driver isp116x_dr @@ -1708,22 +1709,249 @@ static struct platform_driver isp116x_dr
}, },
}; };
@ -30,8 +30,6 @@
+ +
+#ifdef CONFIG_USB_ISP116X_HCD_OF +#ifdef CONFIG_USB_ISP116X_HCD_OF
+ +
+#include <linux/of.h>
+#include <linux/of_device.h>
+#include <linux/of_platform.h> +#include <linux/of_platform.h>
+ +
+#ifdef USE_PLATFORM_DELAY +#ifdef USE_PLATFORM_DELAY
@ -43,13 +41,12 @@
+#define isp116x_of_delay NULL +#define isp116x_of_delay NULL
+#endif +#endif
+ +
+static int __devinit isp116x_of_probe(struct of_device *op, +static int __devinit isp116x_of_probe(struct platform_device *op)
+ const struct of_device_id *match)
+{ +{
+ struct device_node *dn = op->node; + struct device_node *dn = op->dev.of_node;
+ struct usb_hcd *hcd; + struct usb_hcd *hcd;
+ struct isp116x *isp116x; + struct isp116x *isp116x;
+ struct resource addr, data, ires; + struct resource addr, data;
+ struct isp116x_platform_data *board; + struct isp116x_platform_data *board;
+ void __iomem *addr_reg; + void __iomem *addr_reg;
+ void __iomem *data_reg; + void __iomem *data_reg;
@ -65,12 +62,6 @@
+ if (ret) + if (ret)
+ return 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); + board = kzalloc(sizeof(struct isp116x_platform_data), GFP_KERNEL);
+ if (board == NULL) + if (board == NULL)
+ return -ENOMEM; + return -ENOMEM;
@ -97,7 +88,7 @@
+ goto err_release_data; + 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) { + if (irq == NO_IRQ) {
+ ret = -EINVAL; + ret = -EINVAL;
+ goto err_unmap_data; + goto err_unmap_data;
@ -132,6 +123,13 @@
+ if (of_get_property(dn, "int_edge_triggered", NULL)) + if (of_get_property(dn, "int_edge_triggered", NULL))
+ board->int_edge_triggered = 1; + 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); + ret = usb_add_hcd(hcd, irq, irqflags | IRQF_DISABLED);
+ if (ret) + if (ret)
+ goto err_put_hcd; + goto err_put_hcd;
@ -163,7 +161,7 @@
+ return ret; + 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 usb_hcd *hcd = dev_get_drvdata(&op->dev);
+ struct isp116x *isp116x; + struct isp116x *isp116x;
@ -181,11 +179,11 @@
+ irq_dispose_mapping(hcd->irq); + irq_dispose_mapping(hcd->irq);
+ +
+ iounmap(isp116x->data_reg); + iounmap(isp116x->data_reg);
+ (void) of_address_to_resource(op->node, 0, &res); + (void) of_address_to_resource(op->dev.of_node, 0, &res);
+ release_mem_region(res.start, resource_size(&res)); + release_mem_region(res.start, resource_size(&res));
+ +
+ iounmap(isp116x->addr_reg); + iounmap(isp116x->addr_reg);
+ (void) of_address_to_resource(op->node, 1, &res); + (void) of_address_to_resource(op->dev.of_node, 1, &res);
+ release_mem_region(res.start, resource_size(&res)); + release_mem_region(res.start, resource_size(&res));
+ +
+ kfree(isp116x->board); + kfree(isp116x->board);
@ -199,26 +197,24 @@
+ {}, + {},
+}; +};
+ +
+static struct of_platform_driver isp116x_of_platform_driver = { +static struct platform_driver isp116x_of_platform_driver = {
+ .owner = THIS_MODULE,
+ .name = "isp116x-hcd-of",
+ .match_table = isp116x_of_match,
+ .probe = isp116x_of_probe, + .probe = isp116x_of_probe,
+ .remove = __devexit_p(isp116x_of_remove), + .remove = __devexit_p(isp116x_of_remove),
+ .driver = { + .driver = {
+ .name = "isp116x-hcd-of", + .name = "isp116x-hcd-of",
+ .owner = THIS_MODULE, + .owner = THIS_MODULE,
+ .of_match_table = isp116x_of_match,
+ }, + },
+}; +};
+ +
+static int __init isp116x_of_register(void) +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) +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_DEVICE_TABLE(of, isp116x_of_match);