aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/firmware
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2013-11-13 17:55:21 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2013-11-13 17:55:21 -0500
commit8ceafbfa91ffbdbb2afaea5c24ccb519ffb8b587 (patch)
tree98c9ea93362536f1ddd73175b13b7847583350df /drivers/firmware
parent42a2d923cc349583ebf6fdd52a7d35e1c2f7e6bd (diff)
parent26ba47b18318abe7dadbe9294a611c0e932651d8 (diff)
Merge branch 'for-linus-dma-masks' of git://git.linaro.org/people/rmk/linux-arm
Pull DMA mask updates from Russell King: "This series cleans up the handling of DMA masks in a lot of drivers, fixing some bugs as we go. Some of the more serious errors include: - drivers which only set their coherent DMA mask if the attempt to set the streaming mask fails. - drivers which test for a NULL dma mask pointer, and then set the dma mask pointer to a location in their module .data section - which will cause problems if the module is reloaded. To counter these, I have introduced two helper functions: - dma_set_mask_and_coherent() takes care of setting both the streaming and coherent masks at the same time, with the correct error handling as specified by the API. - dma_coerce_mask_and_coherent() which resolves the problem of drivers forcefully setting DMA masks. This is more a marker for future work to further clean these locations up - the code which creates the devices really should be initialising these, but to fix that in one go along with this change could potentially be very disruptive. The last thing this series does is prise away some of Linux's addition to "DMA addresses are physical addresses and RAM always starts at zero". We have ARM LPAE systems where all system memory is above 4GB physical, hence having DMA masks interpreted by (eg) the block layers as describing physical addresses in the range 0..DMAMASK fails on these platforms. Santosh Shilimkar addresses this in this series; the patches were copied to the appropriate people multiple times but were ignored. Fixing this also gets rid of some ARM weirdness in the setup of the max*pfn variables, and brings ARM into line with every other Linux architecture as far as those go" * 'for-linus-dma-masks' of git://git.linaro.org/people/rmk/linux-arm: (52 commits) ARM: 7805/1: mm: change max*pfn to include the physical offset of memory ARM: 7797/1: mmc: Use dma_max_pfn(dev) helper for bounce_limit calculations ARM: 7796/1: scsi: Use dma_max_pfn(dev) helper for bounce_limit calculations ARM: 7795/1: mm: dma-mapping: Add dma_max_pfn(dev) helper function ARM: 7794/1: block: Rename parameter dma_mask to max_addr for blk_queue_bounce_limit() ARM: DMA-API: better handing of DMA masks for coherent allocations ARM: 7857/1: dma: imx-sdma: setup dma mask DMA-API: firmware/google/gsmi.c: avoid direct access to DMA masks DMA-API: dcdbas: update DMA mask handing DMA-API: dma: edma.c: no need to explicitly initialize DMA masks DMA-API: usb: musb: use platform_device_register_full() to avoid directly messing with dma masks DMA-API: crypto: remove last references to 'static struct device *dev' DMA-API: crypto: fix ixp4xx crypto platform device support DMA-API: others: use dma_set_coherent_mask() DMA-API: staging: use dma_set_coherent_mask() DMA-API: usb: use new dma_coerce_mask_and_coherent() DMA-API: usb: use dma_set_coherent_mask() DMA-API: parport: parport_pc.c: use dma_coerce_mask_and_coherent() DMA-API: net: octeon: use dma_coerce_mask_and_coherent() DMA-API: net: nxp/lpc_eth: use dma_coerce_mask_and_coherent() ...
Diffstat (limited to 'drivers/firmware')
-rw-r--r--drivers/firmware/dcdbas.c32
-rw-r--r--drivers/firmware/google/gsmi.c13
2 files changed, 27 insertions, 18 deletions
diff --git a/drivers/firmware/dcdbas.c b/drivers/firmware/dcdbas.c
index ff080ee20197..1b5e8e46226d 100644
--- a/drivers/firmware/dcdbas.c
+++ b/drivers/firmware/dcdbas.c
@@ -545,12 +545,15 @@ static int dcdbas_probe(struct platform_device *dev)
545 host_control_action = HC_ACTION_NONE; 545 host_control_action = HC_ACTION_NONE;
546 host_control_smi_type = HC_SMITYPE_NONE; 546 host_control_smi_type = HC_SMITYPE_NONE;
547 547
548 dcdbas_pdev = dev;
549
548 /* 550 /*
549 * BIOS SMI calls require buffer addresses be in 32-bit address space. 551 * BIOS SMI calls require buffer addresses be in 32-bit address space.
550 * This is done by setting the DMA mask below. 552 * This is done by setting the DMA mask below.
551 */ 553 */
552 dcdbas_pdev->dev.coherent_dma_mask = DMA_BIT_MASK(32); 554 error = dma_set_coherent_mask(&dcdbas_pdev->dev, DMA_BIT_MASK(32));
553 dcdbas_pdev->dev.dma_mask = &dcdbas_pdev->dev.coherent_dma_mask; 555 if (error)
556 return error;
554 557
555 error = sysfs_create_group(&dev->dev.kobj, &dcdbas_attr_group); 558 error = sysfs_create_group(&dev->dev.kobj, &dcdbas_attr_group);
556 if (error) 559 if (error)
@@ -581,6 +584,14 @@ static struct platform_driver dcdbas_driver = {
581 .remove = dcdbas_remove, 584 .remove = dcdbas_remove,
582}; 585};
583 586
587static const struct platform_device_info dcdbas_dev_info __initdata = {
588 .name = DRIVER_NAME,
589 .id = -1,
590 .dma_mask = DMA_BIT_MASK(32),
591};
592
593static struct platform_device *dcdbas_pdev_reg;
594
584/** 595/**
585 * dcdbas_init: initialize driver 596 * dcdbas_init: initialize driver
586 */ 597 */
@@ -592,20 +603,14 @@ static int __init dcdbas_init(void)
592 if (error) 603 if (error)
593 return error; 604 return error;
594 605
595 dcdbas_pdev = platform_device_alloc(DRIVER_NAME, -1); 606 dcdbas_pdev_reg = platform_device_register_full(&dcdbas_dev_info);
596 if (!dcdbas_pdev) { 607 if (IS_ERR(dcdbas_pdev_reg)) {
597 error = -ENOMEM; 608 error = PTR_ERR(dcdbas_pdev_reg);
598 goto err_unregister_driver; 609 goto err_unregister_driver;
599 } 610 }
600 611
601 error = platform_device_add(dcdbas_pdev);
602 if (error)
603 goto err_free_device;
604
605 return 0; 612 return 0;
606 613
607 err_free_device:
608 platform_device_put(dcdbas_pdev);
609 err_unregister_driver: 614 err_unregister_driver:
610 platform_driver_unregister(&dcdbas_driver); 615 platform_driver_unregister(&dcdbas_driver);
611 return error; 616 return error;
@@ -628,8 +633,9 @@ static void __exit dcdbas_exit(void)
628 * all sysfs attributes belonging to this module have been 633 * all sysfs attributes belonging to this module have been
629 * released. 634 * released.
630 */ 635 */
631 smi_data_buf_free(); 636 if (dcdbas_pdev)
632 platform_device_unregister(dcdbas_pdev); 637 smi_data_buf_free();
638 platform_device_unregister(dcdbas_pdev_reg);
633 platform_driver_unregister(&dcdbas_driver); 639 platform_driver_unregister(&dcdbas_driver);
634} 640}
635 641
diff --git a/drivers/firmware/google/gsmi.c b/drivers/firmware/google/gsmi.c
index 6eb535ffeddc..e5a67b24587a 100644
--- a/drivers/firmware/google/gsmi.c
+++ b/drivers/firmware/google/gsmi.c
@@ -764,6 +764,13 @@ static __init int gsmi_system_valid(void)
764static struct kobject *gsmi_kobj; 764static struct kobject *gsmi_kobj;
765static struct efivars efivars; 765static struct efivars efivars;
766 766
767static const struct platform_device_info gsmi_dev_info = {
768 .name = "gsmi",
769 .id = -1,
770 /* SMI callbacks require 32bit addresses */
771 .dma_mask = DMA_BIT_MASK(32),
772};
773
767static __init int gsmi_init(void) 774static __init int gsmi_init(void)
768{ 775{
769 unsigned long flags; 776 unsigned long flags;
@@ -776,7 +783,7 @@ static __init int gsmi_init(void)
776 gsmi_dev.smi_cmd = acpi_gbl_FADT.smi_command; 783 gsmi_dev.smi_cmd = acpi_gbl_FADT.smi_command;
777 784
778 /* register device */ 785 /* register device */
779 gsmi_dev.pdev = platform_device_register_simple("gsmi", -1, NULL, 0); 786 gsmi_dev.pdev = platform_device_register_full(&gsmi_dev_info);
780 if (IS_ERR(gsmi_dev.pdev)) { 787 if (IS_ERR(gsmi_dev.pdev)) {
781 printk(KERN_ERR "gsmi: unable to register platform device\n"); 788 printk(KERN_ERR "gsmi: unable to register platform device\n");
782 return PTR_ERR(gsmi_dev.pdev); 789 return PTR_ERR(gsmi_dev.pdev);
@@ -785,10 +792,6 @@ static __init int gsmi_init(void)
785 /* SMI access needs to be serialized */ 792 /* SMI access needs to be serialized */
786 spin_lock_init(&gsmi_dev.lock); 793 spin_lock_init(&gsmi_dev.lock);
787 794
788 /* SMI callbacks require 32bit addresses */
789 gsmi_dev.pdev->dev.coherent_dma_mask = DMA_BIT_MASK(32);
790 gsmi_dev.pdev->dev.dma_mask =
791 &gsmi_dev.pdev->dev.coherent_dma_mask;
792 ret = -ENOMEM; 795 ret = -ENOMEM;
793 gsmi_dev.dma_pool = dma_pool_create("gsmi", &gsmi_dev.pdev->dev, 796 gsmi_dev.dma_pool = dma_pool_create("gsmi", &gsmi_dev.pdev->dev,
794 GSMI_BUF_SIZE, GSMI_BUF_ALIGN, 0); 797 GSMI_BUF_SIZE, GSMI_BUF_ALIGN, 0);