1919#include "ipu7-boot.h"
2020#include "ipu7-bus.h"
2121#include "ipu7-buttress-regs.h"
22+ #include "ipu7-dma.h"
2223#include "ipu7-platform-regs.h"
2324#include "ipu7-syscom.h"
2425
@@ -56,9 +57,9 @@ static const struct ipu7_boot_context contexts[IPU_SUBSYS_NUM] = {
5657static u32 get_fw_boot_reg_addr (const struct ipu7_bus_device * adev ,
5758 enum ia_gofo_buttress_reg_id reg )
5859{
59- u32 base = (adev -> subsys == IPU_IS ) ? 0 : IA_GOFO_FW_BOOT_ID_MAX ;
60+ u32 base = (adev -> subsys == IPU_IS ) ? 0U : ( u32 ) IA_GOFO_FW_BOOT_ID_MAX ;
6061
61- return BUTTRESS_FW_BOOT_PARAMS_ENTRY (base + reg );
62+ return BUTTRESS_FW_BOOT_PARAMS_ENTRY (base + ( u32 ) reg );
6263}
6364
6465static void write_fw_boot_param (const struct ipu7_bus_device * adev ,
@@ -105,7 +106,7 @@ static int ipu7_boot_cell_reset(const struct ipu7_bus_device *adev)
105106 writel (val , base + ucx_ctrl_status );
106107
107108 ret = readl_poll_timeout (base + ucx_ctrl_status , val2 ,
108- (val2 & 0x3 ) == (val & 0x3 ), 100 , timeout );
109+ (val2 & 0x3U ) == (val & 0x3U ), 100 , timeout );
109110 if (ret ) {
110111 dev_err (dev , "cell enter reset timeout. status: 0x%x\n" , val2 );
111112 return - ETIMEDOUT ;
@@ -122,7 +123,7 @@ static int ipu7_boot_cell_reset(const struct ipu7_bus_device *adev)
122123 writel (val , base + ucx_ctrl_status );
123124
124125 ret = readl_poll_timeout (base + ucx_ctrl_status , val2 ,
125- (val2 & 0x3 ) == (val & 0x3 ), 100 , timeout );
126+ (val2 & 0x3U ) == (val & 0x3U ), 100 , timeout );
126127 if (ret ) {
127128 dev_err (dev , "cell exit reset timeout. status: 0x%x\n" , val2 );
128129 return - ETIMEDOUT ;
@@ -224,9 +225,9 @@ int ipu7_boot_init_boot_config(struct ipu7_bus_device *adev,
224225 /* Allocate boot config. */
225226 adev -> boot_config_size =
226227 sizeof (* cfgs ) * num_queues + sizeof (* boot_config );
227- adev -> boot_config = dma_alloc_attrs ( dev , adev -> boot_config_size ,
228- & adev -> boot_config_dma_addr ,
229- GFP_KERNEL , 0 );
228+ adev -> boot_config = ipu7_dma_alloc ( adev , adev -> boot_config_size ,
229+ & adev -> boot_config_dma_addr ,
230+ GFP_KERNEL , 0 );
230231 if (!adev -> boot_config ) {
231232 dev_err (dev , "Failed to allocate boot config.\n" );
232233 return - ENOMEM ;
@@ -245,8 +246,8 @@ int ipu7_boot_init_boot_config(struct ipu7_bus_device *adev,
245246 boot_config -> syscom_context_config .max_input_queues =
246247 syscom -> num_input_queues ;
247248
248- dma_sync_single_for_device ( dev , adev -> boot_config_dma_addr ,
249- adev -> boot_config_size , DMA_TO_DEVICE );
249+ ipu7_dma_sync_single ( adev , adev -> boot_config_dma_addr ,
250+ adev -> boot_config_size );
250251
251252 for (i = 0 ; i < num_queues ; i ++ ) {
252253 u32 queue_size = qconfigs [i ].max_capacity *
@@ -259,9 +260,9 @@ int ipu7_boot_init_boot_config(struct ipu7_bus_device *adev,
259260 }
260261
261262 /* Allocate queue memory */
262- syscom -> queue_mem = dma_alloc_attrs ( dev , total_queue_size_aligned ,
263- & syscom -> queue_mem_dma_addr ,
264- GFP_KERNEL , 0 );
263+ syscom -> queue_mem = ipu7_dma_alloc ( adev , total_queue_size_aligned ,
264+ & syscom -> queue_mem_dma_addr ,
265+ GFP_KERNEL , 0 );
265266 if (!syscom -> queue_mem ) {
266267 dev_err (dev , "Failed to allocate queue memory.\n" );
267268 return - ENOMEM ;
@@ -281,8 +282,8 @@ int ipu7_boot_init_boot_config(struct ipu7_bus_device *adev,
281282 queue_mem_ptr += qconfigs [i ].queue_size ;
282283 }
283284
284- dma_sync_single_for_device ( dev , syscom -> queue_mem_dma_addr ,
285- total_queue_size_aligned , DMA_TO_DEVICE );
285+ ipu7_dma_sync_single ( adev , syscom -> queue_mem_dma_addr ,
286+ total_queue_size_aligned );
286287
287288 return 0 ;
288289}
@@ -295,20 +296,19 @@ EXPORT_SYMBOL_NS_GPL(ipu7_boot_init_boot_config, INTEL_IPU7);
295296void ipu7_boot_release_boot_config (struct ipu7_bus_device * adev )
296297{
297298 struct ipu7_syscom_context * syscom = adev -> syscom ;
298- struct device * dev = & adev -> auxdev .dev ;
299299
300300 if (syscom -> queue_mem ) {
301- dma_free_attrs ( dev , syscom -> queue_mem_size ,
302- syscom -> queue_mem ,
303- syscom -> queue_mem_dma_addr , 0 );
301+ ipu7_dma_free ( adev , syscom -> queue_mem_size ,
302+ syscom -> queue_mem ,
303+ syscom -> queue_mem_dma_addr , 0 );
304304 syscom -> queue_mem = NULL ;
305305 syscom -> queue_mem_dma_addr = 0 ;
306306 }
307307
308308 if (adev -> boot_config ) {
309- dma_free_attrs ( dev , adev -> boot_config_size ,
310- adev -> boot_config ,
311- adev -> boot_config_dma_addr , 0 );
309+ ipu7_dma_free ( adev , adev -> boot_config_size ,
310+ adev -> boot_config ,
311+ adev -> boot_config_dma_addr , 0 );
312312 adev -> boot_config = NULL ;
313313 adev -> boot_config_dma_addr = 0 ;
314314 }
0 commit comments