|
@@ -15,6 +15,8 @@
|
|
#include <linux/list.h>
|
|
#include <linux/list.h>
|
|
#include <linux/gpio.h>
|
|
#include <linux/gpio.h>
|
|
#include <linux/io.h>
|
|
#include <linux/io.h>
|
|
|
|
+#include <linux/platform_device.h>
|
|
|
|
+#include <linux/dma-mapping.h>
|
|
|
|
|
|
#include <asm/cacheflush.h>
|
|
#include <asm/cacheflush.h>
|
|
|
|
|
|
@@ -442,3 +444,85 @@ const struct musb_platform_ops musb_ops = {
|
|
.vbus_status = bfin_musb_vbus_status,
|
|
.vbus_status = bfin_musb_vbus_status,
|
|
.set_vbus = bfin_musb_set_vbus,
|
|
.set_vbus = bfin_musb_set_vbus,
|
|
};
|
|
};
|
|
|
|
+
|
|
|
|
+static u64 bfin_dmamask = DMA_BIT_MASK(32);
|
|
|
|
+
|
|
|
|
+static int __init bfin_probe(struct platform_device *pdev)
|
|
|
|
+{
|
|
|
|
+ struct musb_hdrc_platform_data *pdata = pdev->dev.platform_data;
|
|
|
|
+ struct platform_device *musb;
|
|
|
|
+
|
|
|
|
+ int ret = -ENOMEM;
|
|
|
|
+
|
|
|
|
+ musb = platform_device_alloc("musb-hdrc", -1);
|
|
|
|
+ if (!musb) {
|
|
|
|
+ dev_err(&pdev->dev, "failed to allocate musb device\n");
|
|
|
|
+ goto err0;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ musb->dev.parent = &pdev->dev;
|
|
|
|
+ musb->dev.dma_mask = &bfin_dmamask;
|
|
|
|
+ musb->dev.coherent_dma_mask = bfin_dmamask;
|
|
|
|
+
|
|
|
|
+ platform_set_drvdata(pdev, musb);
|
|
|
|
+
|
|
|
|
+ ret = platform_device_add_resources(musb, pdev->resource,
|
|
|
|
+ pdev->num_resources);
|
|
|
|
+ if (ret) {
|
|
|
|
+ dev_err(&pdev->dev, "failed to add resources\n");
|
|
|
|
+ goto err1;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ ret = platform_device_add_data(musb, pdata, sizeof(*pdata));
|
|
|
|
+ if (ret) {
|
|
|
|
+ dev_err(&pdev->dev, "failed to add platform_data\n");
|
|
|
|
+ goto err1;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ ret = platform_device_add(musb);
|
|
|
|
+ if (ret) {
|
|
|
|
+ dev_err(&pdev->dev, "failed to register musb device\n");
|
|
|
|
+ goto err1;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ return 0;
|
|
|
|
+
|
|
|
|
+err1:
|
|
|
|
+ platform_device_put(musb);
|
|
|
|
+
|
|
|
|
+err0:
|
|
|
|
+ return ret;
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+static int __exit bfin_remove(struct platform_device *pdev)
|
|
|
|
+{
|
|
|
|
+ struct platform_device *musb = platform_get_drvdata(pdev);
|
|
|
|
+
|
|
|
|
+ platform_device_del(musb);
|
|
|
|
+ platform_device_put(musb);
|
|
|
|
+
|
|
|
|
+ return 0;
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+static struct platform_driver bfin_driver = {
|
|
|
|
+ .remove = __exit_p(bfin_remove),
|
|
|
|
+ .driver = {
|
|
|
|
+ .name = "musb-bfin",
|
|
|
|
+ },
|
|
|
|
+};
|
|
|
|
+
|
|
|
|
+MODULE_DESCRIPTION("Blackfin MUSB Glue Layer");
|
|
|
|
+MODULE_AUTHOR("Bryan Wy <cooloney@kernel.org>");
|
|
|
|
+MODULE_LICENSE("GPL v2");
|
|
|
|
+
|
|
|
|
+static int __init bfin_init(void)
|
|
|
|
+{
|
|
|
|
+ return platform_driver_probe(&bfin_driver, bfin_probe);
|
|
|
|
+}
|
|
|
|
+subsys_initcall(bfin_init);
|
|
|
|
+
|
|
|
|
+static void __exit bfin_exit(void)
|
|
|
|
+{
|
|
|
|
+ platform_driver_unregister(&bfin_driver);
|
|
|
|
+}
|
|
|
|
+module_exit(bfin_exit);
|