@@ -386,14 +386,14 @@ static void palmetto_bmc_i2c_init(AspeedMachineState *bmc)
386
386
387
387
/* The palmetto platform expects a ds3231 RTC but a ds1338 is
388
388
* enough to provide basic RTC features. Alarms will be missing */
389
- i2c_create_slave (aspeed_i2c_get_bus (DEVICE ( & soc -> i2c ) , 0 ), "ds1338" , 0x68 );
389
+ i2c_slave_create_simple (aspeed_i2c_get_bus (& soc -> i2c , 0 ), "ds1338" , 0x68 );
390
390
391
- smbus_eeprom_init_one (aspeed_i2c_get_bus (DEVICE ( & soc -> i2c ) , 0 ), 0x50 ,
391
+ smbus_eeprom_init_one (aspeed_i2c_get_bus (& soc -> i2c , 0 ), 0x50 ,
392
392
eeprom_buf );
393
393
394
394
/* add a TMP423 temperature sensor */
395
- dev = i2c_create_slave ( aspeed_i2c_get_bus (DEVICE ( & soc -> i2c ) , 2 ),
396
- "tmp423" , 0x4c );
395
+ dev = DEVICE ( i2c_slave_create_simple ( aspeed_i2c_get_bus (& soc -> i2c , 2 ),
396
+ "tmp423" , 0x4c ) );
397
397
object_property_set_int (OBJECT (dev ), "temperature0" , 31000 , & error_abort );
398
398
object_property_set_int (OBJECT (dev ), "temperature1" , 28000 , & error_abort );
399
399
object_property_set_int (OBJECT (dev ), "temperature2" , 20000 , & error_abort );
@@ -405,16 +405,16 @@ static void ast2500_evb_i2c_init(AspeedMachineState *bmc)
405
405
AspeedSoCState * soc = & bmc -> soc ;
406
406
uint8_t * eeprom_buf = g_malloc0 (8 * 1024 );
407
407
408
- smbus_eeprom_init_one (aspeed_i2c_get_bus (DEVICE ( & soc -> i2c ) , 3 ), 0x50 ,
408
+ smbus_eeprom_init_one (aspeed_i2c_get_bus (& soc -> i2c , 3 ), 0x50 ,
409
409
eeprom_buf );
410
410
411
411
/* The AST2500 EVB expects a LM75 but a TMP105 is compatible */
412
- i2c_create_slave (aspeed_i2c_get_bus (DEVICE ( & soc -> i2c ) , 7 ),
412
+ i2c_slave_create_simple (aspeed_i2c_get_bus (& soc -> i2c , 7 ),
413
413
TYPE_TMP105 , 0x4d );
414
414
415
415
/* The AST2500 EVB does not have an RTC. Let's pretend that one is
416
416
* plugged on the I2C bus header */
417
- i2c_create_slave (aspeed_i2c_get_bus (DEVICE ( & soc -> i2c ) , 11 ), "ds1338" , 0x32 );
417
+ i2c_slave_create_simple (aspeed_i2c_get_bus (& soc -> i2c , 11 ), "ds1338" , 0x32 );
418
418
}
419
419
420
420
static void ast2600_evb_i2c_init (AspeedMachineState * bmc )
@@ -429,69 +429,69 @@ static void romulus_bmc_i2c_init(AspeedMachineState *bmc)
429
429
430
430
/* The romulus board expects Epson RX8900 I2C RTC but a ds1338 is
431
431
* good enough */
432
- i2c_create_slave (aspeed_i2c_get_bus (DEVICE ( & soc -> i2c ) , 11 ), "ds1338" , 0x32 );
432
+ i2c_slave_create_simple (aspeed_i2c_get_bus (& soc -> i2c , 11 ), "ds1338" , 0x32 );
433
433
}
434
434
435
435
static void swift_bmc_i2c_init (AspeedMachineState * bmc )
436
436
{
437
437
AspeedSoCState * soc = & bmc -> soc ;
438
438
439
- i2c_create_slave (aspeed_i2c_get_bus (DEVICE ( & soc -> i2c ) , 3 ), "pca9552" , 0x60 );
439
+ i2c_slave_create_simple (aspeed_i2c_get_bus (& soc -> i2c , 3 ), "pca9552" , 0x60 );
440
440
441
441
/* The swift board expects a TMP275 but a TMP105 is compatible */
442
- i2c_create_slave (aspeed_i2c_get_bus (DEVICE ( & soc -> i2c ) , 7 ), "tmp105" , 0x48 );
442
+ i2c_slave_create_simple (aspeed_i2c_get_bus (& soc -> i2c , 7 ), "tmp105" , 0x48 );
443
443
/* The swift board expects a pca9551 but a pca9552 is compatible */
444
- i2c_create_slave (aspeed_i2c_get_bus (DEVICE ( & soc -> i2c ) , 7 ), "pca9552" , 0x60 );
444
+ i2c_slave_create_simple (aspeed_i2c_get_bus (& soc -> i2c , 7 ), "pca9552" , 0x60 );
445
445
446
446
/* The swift board expects an Epson RX8900 RTC but a ds1338 is compatible */
447
- i2c_create_slave (aspeed_i2c_get_bus (DEVICE ( & soc -> i2c ) , 8 ), "ds1338" , 0x32 );
448
- i2c_create_slave (aspeed_i2c_get_bus (DEVICE ( & soc -> i2c ) , 8 ), "pca9552" , 0x60 );
447
+ i2c_slave_create_simple (aspeed_i2c_get_bus (& soc -> i2c , 8 ), "ds1338" , 0x32 );
448
+ i2c_slave_create_simple (aspeed_i2c_get_bus (& soc -> i2c , 8 ), "pca9552" , 0x60 );
449
449
450
- i2c_create_slave (aspeed_i2c_get_bus (DEVICE ( & soc -> i2c ) , 9 ), "tmp423" , 0x4c );
450
+ i2c_slave_create_simple (aspeed_i2c_get_bus (& soc -> i2c , 9 ), "tmp423" , 0x4c );
451
451
/* The swift board expects a pca9539 but a pca9552 is compatible */
452
- i2c_create_slave (aspeed_i2c_get_bus (DEVICE ( & soc -> i2c ) , 9 ), "pca9552" , 0x74 );
452
+ i2c_slave_create_simple (aspeed_i2c_get_bus (& soc -> i2c , 9 ), "pca9552" , 0x74 );
453
453
454
- i2c_create_slave (aspeed_i2c_get_bus (DEVICE ( & soc -> i2c ) , 10 ), "tmp423" , 0x4c );
454
+ i2c_slave_create_simple (aspeed_i2c_get_bus (& soc -> i2c , 10 ), "tmp423" , 0x4c );
455
455
/* The swift board expects a pca9539 but a pca9552 is compatible */
456
- i2c_create_slave (aspeed_i2c_get_bus (DEVICE ( & soc -> i2c ) , 10 ), "pca9552" ,
456
+ i2c_slave_create_simple (aspeed_i2c_get_bus (& soc -> i2c , 10 ), "pca9552" ,
457
457
0x74 );
458
458
459
459
/* The swift board expects a TMP275 but a TMP105 is compatible */
460
- i2c_create_slave (aspeed_i2c_get_bus (DEVICE ( & soc -> i2c ) , 12 ), "tmp105" , 0x48 );
461
- i2c_create_slave (aspeed_i2c_get_bus (DEVICE ( & soc -> i2c ) , 12 ), "tmp105" , 0x4a );
460
+ i2c_slave_create_simple (aspeed_i2c_get_bus (& soc -> i2c , 12 ), "tmp105" , 0x48 );
461
+ i2c_slave_create_simple (aspeed_i2c_get_bus (& soc -> i2c , 12 ), "tmp105" , 0x4a );
462
462
}
463
463
464
464
static void sonorapass_bmc_i2c_init (AspeedMachineState * bmc )
465
465
{
466
466
AspeedSoCState * soc = & bmc -> soc ;
467
467
468
468
/* bus 2 : */
469
- i2c_create_slave (aspeed_i2c_get_bus (DEVICE ( & soc -> i2c ) , 2 ), "tmp105" , 0x48 );
470
- i2c_create_slave (aspeed_i2c_get_bus (DEVICE ( & soc -> i2c ) , 2 ), "tmp105" , 0x49 );
469
+ i2c_slave_create_simple (aspeed_i2c_get_bus (& soc -> i2c , 2 ), "tmp105" , 0x48 );
470
+ i2c_slave_create_simple (aspeed_i2c_get_bus (& soc -> i2c , 2 ), "tmp105" , 0x49 );
471
471
/* bus 2 : pca9546 @ 0x73 */
472
472
473
473
/* bus 3 : pca9548 @ 0x70 */
474
474
475
475
/* bus 4 : */
476
476
uint8_t * eeprom4_54 = g_malloc0 (8 * 1024 );
477
- smbus_eeprom_init_one (aspeed_i2c_get_bus (DEVICE ( & soc -> i2c ) , 4 ), 0x54 ,
477
+ smbus_eeprom_init_one (aspeed_i2c_get_bus (& soc -> i2c , 4 ), 0x54 ,
478
478
eeprom4_54 );
479
479
/* PCA9539 @ 0x76, but PCA9552 is compatible */
480
- i2c_create_slave (aspeed_i2c_get_bus (DEVICE ( & soc -> i2c ) , 4 ), "pca9552" , 0x76 );
480
+ i2c_slave_create_simple (aspeed_i2c_get_bus (& soc -> i2c , 4 ), "pca9552" , 0x76 );
481
481
/* PCA9539 @ 0x77, but PCA9552 is compatible */
482
- i2c_create_slave (aspeed_i2c_get_bus (DEVICE ( & soc -> i2c ) , 4 ), "pca9552" , 0x77 );
482
+ i2c_slave_create_simple (aspeed_i2c_get_bus (& soc -> i2c , 4 ), "pca9552" , 0x77 );
483
483
484
484
/* bus 6 : */
485
- i2c_create_slave (aspeed_i2c_get_bus (DEVICE ( & soc -> i2c ) , 6 ), "tmp105" , 0x48 );
486
- i2c_create_slave (aspeed_i2c_get_bus (DEVICE ( & soc -> i2c ) , 6 ), "tmp105" , 0x49 );
485
+ i2c_slave_create_simple (aspeed_i2c_get_bus (& soc -> i2c , 6 ), "tmp105" , 0x48 );
486
+ i2c_slave_create_simple (aspeed_i2c_get_bus (& soc -> i2c , 6 ), "tmp105" , 0x49 );
487
487
/* bus 6 : pca9546 @ 0x73 */
488
488
489
489
/* bus 8 : */
490
490
uint8_t * eeprom8_56 = g_malloc0 (8 * 1024 );
491
- smbus_eeprom_init_one (aspeed_i2c_get_bus (DEVICE ( & soc -> i2c ) , 8 ), 0x56 ,
491
+ smbus_eeprom_init_one (aspeed_i2c_get_bus (& soc -> i2c , 8 ), 0x56 ,
492
492
eeprom8_56 );
493
- i2c_create_slave (aspeed_i2c_get_bus (DEVICE ( & soc -> i2c ) , 8 ), "pca9552" , 0x60 );
494
- i2c_create_slave (aspeed_i2c_get_bus (DEVICE ( & soc -> i2c ) , 8 ), "pca9552" , 0x61 );
493
+ i2c_slave_create_simple (aspeed_i2c_get_bus (& soc -> i2c , 8 ), "pca9552" , 0x60 );
494
+ i2c_slave_create_simple (aspeed_i2c_get_bus (& soc -> i2c , 8 ), "pca9552" , 0x61 );
495
495
/* bus 8 : adc128d818 @ 0x1d */
496
496
/* bus 8 : adc128d818 @ 0x1f */
497
497
@@ -514,28 +514,30 @@ static void witherspoon_bmc_i2c_init(AspeedMachineState *bmc)
514
514
/* Bus 3: TODO bmp280@77 */
515
515
/* Bus 3: TODO max31785@52 */
516
516
/* Bus 3: TODO dps310@76 */
517
- dev = i2c_try_create_slave ( TYPE_PCA9552 , 0x60 );
517
+ dev = DEVICE ( i2c_slave_new ( TYPE_PCA9552 , 0x60 ) );
518
518
qdev_prop_set_string (dev , "description" , "pca1" );
519
- i2c_realize_and_unref (dev , aspeed_i2c_get_bus (DEVICE (& soc -> i2c ), 3 ),
520
- & error_fatal );
519
+ i2c_slave_realize_and_unref (I2C_SLAVE (dev ),
520
+ aspeed_i2c_get_bus (& soc -> i2c , 3 ),
521
+ & error_fatal );
521
522
522
- i2c_create_slave (aspeed_i2c_get_bus (DEVICE ( & soc -> i2c ) , 4 ), "tmp423" , 0x4c );
523
- i2c_create_slave (aspeed_i2c_get_bus (DEVICE ( & soc -> i2c ) , 5 ), "tmp423" , 0x4c );
523
+ i2c_slave_create_simple (aspeed_i2c_get_bus (& soc -> i2c , 4 ), "tmp423" , 0x4c );
524
+ i2c_slave_create_simple (aspeed_i2c_get_bus (& soc -> i2c , 5 ), "tmp423" , 0x4c );
524
525
525
526
/* The Witherspoon expects a TMP275 but a TMP105 is compatible */
526
- i2c_create_slave (aspeed_i2c_get_bus (DEVICE ( & soc -> i2c ) , 9 ), TYPE_TMP105 ,
527
+ i2c_slave_create_simple (aspeed_i2c_get_bus (& soc -> i2c , 9 ), TYPE_TMP105 ,
527
528
0x4a );
528
529
529
530
/* The witherspoon board expects Epson RX8900 I2C RTC but a ds1338 is
530
531
* good enough */
531
- i2c_create_slave (aspeed_i2c_get_bus (DEVICE ( & soc -> i2c ) , 11 ), "ds1338" , 0x32 );
532
+ i2c_slave_create_simple (aspeed_i2c_get_bus (& soc -> i2c , 11 ), "ds1338" , 0x32 );
532
533
533
- smbus_eeprom_init_one (aspeed_i2c_get_bus (DEVICE ( & soc -> i2c ) , 11 ), 0x51 ,
534
+ smbus_eeprom_init_one (aspeed_i2c_get_bus (& soc -> i2c , 11 ), 0x51 ,
534
535
eeprom_buf );
535
- dev = i2c_try_create_slave ( TYPE_PCA9552 , 0x60 );
536
+ dev = DEVICE ( i2c_slave_new ( TYPE_PCA9552 , 0x60 ) );
536
537
qdev_prop_set_string (dev , "description" , "pca0" );
537
- i2c_realize_and_unref (dev , aspeed_i2c_get_bus (DEVICE (& soc -> i2c ), 11 ),
538
- & error_fatal );
538
+ i2c_slave_realize_and_unref (I2C_SLAVE (dev ),
539
+ aspeed_i2c_get_bus (& soc -> i2c , 11 ),
540
+ & error_fatal );
539
541
/* Bus 11: TODO ucd90160@64 */
540
542
}
541
543
0 commit comments