Re: [PATCH v2 02/21] dma: add dma_sync nop stubs for PBL

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 14.06.22 10:49, Sascha Hauer wrote:
> On Thu, Jun 09, 2022 at 07:59:03AM +0200, Ahmad Fatoum wrote:
>> We can implement dma_sync functions as compiler barriers when we are
>> certain that the buffers are in coherent/uncached memory, e.g. because
>> MMU is only enabled in barebox_arm_entry which hasn't run yet.
>>
>> This will come in handy when doing mailbox communication in PBL on the
>> Raspberry Pi.
>>
>> Signed-off-by: Ahmad Fatoum <a.fatoum@xxxxxxxxxxxxxx>
>> ---
>>  include/dma.h | 19 +++++++++++++++++++
>>  1 file changed, 19 insertions(+)
>>
>> diff --git a/include/dma.h b/include/dma.h
>> index 90f9254ea80f..aeaba7d9316d 100644
>> --- a/include/dma.h
>> +++ b/include/dma.h
>> @@ -8,6 +8,7 @@
>>  
>>  #include <malloc.h>
>>  #include <xfuncs.h>
>> +#include <pbl.h>
>>  #include <linux/kernel.h>
>>  
>>  #include <dma-dir.h>
>> @@ -56,12 +57,30 @@ static inline int dma_mapping_error(struct device_d *dev, dma_addr_t dma_addr)
>>  		(dev->dma_mask && dma_addr > dev->dma_mask);
>>  }
>>  
>> +#ifndef __PBL__
>>  /* streaming DMA - implement the below calls to support HAS_DMA */
>>  void dma_sync_single_for_cpu(dma_addr_t address, size_t size,
>>  			     enum dma_data_direction dir);
>>  
>>  void dma_sync_single_for_device(dma_addr_t address, size_t size,
>>  				enum dma_data_direction dir);
>> +#else
>> +/*
>> + * assumes buffers are in coherent/uncached memory, e.g. because
>> + * MMU is only enabled in barebox_arm_entry which hasn't run yet.
>> + */
>> +static inline void dma_sync_single_for_cpu(dma_addr_t address, size_t size,
>> +			     enum dma_data_direction dir)
>> +{
>> +	barrier_data((void *)address);
>> +}
>> +
>> +static inline void dma_sync_single_for_device(dma_addr_t address, size_t size,
>> +				enum dma_data_direction dir)
>> +{
>> +	barrier_data((void *)address);
>> +}
>> +#endif
> 
> This breaks compilation of socfpga-arria10_defconfig. We have these
> stubs in arch/arm/include/asm/dma.h as well inside a #ifndef CONFIG_MMU.

I am preparing a fix.

> 
> Sascha
> 


-- 
Pengutronix e.K.                           |                             |
Steuerwalder Str. 21                       | http://www.pengutronix.de/  |
31137 Hildesheim, Germany                  | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

_______________________________________________
barebox mailing list
barebox@xxxxxxxxxxxxxxxxxxx
http://lists.infradead.org/mailman/listinfo/barebox



[Index of Archives]     [Linux Embedded]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux