1313 * Gaussian Mixture Model and Neural Network Accelerator (GNA)
1414 */
1515
16+ #define DT_DRV_COMPAT intel_gna
17+
1618#include <kernel.h>
1719#include <string.h>
1820#include <device.h>
1921#include <drivers/gna.h>
2022
23+ #include <memory.h>
2124#include "intel_gna.h"
2225
2326#define LOG_LEVEL CONFIG_NEURAL_NET_LOG_LEVEL
@@ -210,7 +213,7 @@ static int intel_gna_initialize(const struct device *dev)
210213 DEV_NAME (dev ), & gna_config_desc );
211214
212215 /* register interrupt handler */
213- IRQ_CONNECT (INTEL_GNA_IRQ_ID , INTEL_GNA_IRQ_PRIORITY ,
216+ IRQ_CONNECT (DT_INST_IRQN ( 0 ), DT_INST_IRQ ( 0 , priority ) ,
214217 intel_gna_interrupt_handler , DEVICE_GET (gna ), 0 );
215218 /* enable interrupt */
216219 irq_enable (INTEL_GNA_IRQ_ID );
@@ -222,7 +225,6 @@ static int intel_gna_initialize(const struct device *dev)
222225static int intel_gna_configure (const struct device * dev ,
223226 struct gna_config * cfg )
224227{
225- const struct intel_gna_config * const dev_cfg = DEV_CFG (dev );
226228 struct intel_gna_data * const gna = DEV_DATA (dev );
227229 volatile struct intel_gna_regs * regs = gna -> regs ;
228230
@@ -237,7 +239,7 @@ static int intel_gna_configure(const struct device *dev,
237239 return - EINVAL ;
238240 }
239241
240- dev_cfg -> config = * cfg ;
242+ gna -> config = * cfg ;
241243
242244 regs -> gnactrl |= GNA_CTRL_OPER_MODEL_XNN |
243245 GNA_CTRL_ERR_INTR_ENABLE | GNA_CTRL_COMPL_INTR_ENABLE ;
@@ -283,7 +285,7 @@ static int intel_gna_register_model(const struct device *dev,
283285 struct intel_gna_data * const gna = DEV_DATA (dev );
284286 struct intel_gna_model * gna_model ;
285287 struct gna_model_header * header ;
286- uint32_t ro_size , rw_size ;
288+ uint32_t ro_size , rw_size = 0 ;
287289 void * virtual_base ;
288290 void * ro_region ;
289291
@@ -518,12 +520,12 @@ static const struct gna_driver_api gna_driver_api = {
518520 .infer = intel_gna_infer ,
519521};
520522
521- static struct intel_gna_config intel_gna_config ;
522523static struct intel_gna_data intel_gna_driver_data = {
523- .regs = (volatile struct intel_gna_regs * )INTEL_GNA_BASE_ADDR ,
524+ .regs = (volatile struct intel_gna_regs * )DT_INST_REG_ADDR ( 0 ) ,
524525};
525526
526- DEVICE_DEFINE (gna , CONFIG_INTEL_GNA_NAME , intel_gna_initialize ,
527- device_pm_control_nop , (void * )& intel_gna_driver_data ,
528- & intel_gna_config , POST_KERNEL ,
529- CONFIG_INTEL_GNA_INIT_PRIORITY , & gna_driver_api );
527+ DEVICE_DT_INST_DEFINE (0 , intel_gna_initialize ,
528+ device_pm_control_nop ,
529+ (void * )& intel_gna_driver_data , NULL ,
530+ POST_KERNEL , CONFIG_INTEL_GNA_INIT_PRIORITY ,
531+ & gna_driver_api );
0 commit comments