sdhci.c (cb8278cd997f4776b5a38fce7859bbe3b2d8d139) | sdhci.c (de1b3800b7ec929f95371e6ab0345bf8b583043d) |
---|---|
1/* 2 * SD Association Host Standard Specification v2.0 controller emulation 3 * 4 * Copyright (c) 2011 Samsung Electronics Co., Ltd. 5 * Mitsyanko Igor <i.mitsyanko@samsung.com> 6 * Peter A.G. Crosthwaite <peter.crosthwaite@petalogix.com> 7 * 8 * Based on MMC controller for Samsung S5PC1xx-based board emulation --- 1274 unchanged lines hidden (view full) --- 1283 .max_access_size = 4, 1284 .unaligned = false 1285 }, 1286 .endianness = DEVICE_LITTLE_ENDIAN, 1287}; 1288 1289static void sdhci_init_readonly_registers(SDHCIState *s, Error **errp) 1290{ | 1/* 2 * SD Association Host Standard Specification v2.0 controller emulation 3 * 4 * Copyright (c) 2011 Samsung Electronics Co., Ltd. 5 * Mitsyanko Igor <i.mitsyanko@samsung.com> 6 * Peter A.G. Crosthwaite <peter.crosthwaite@petalogix.com> 7 * 8 * Based on MMC controller for Samsung S5PC1xx-based board emulation --- 1274 unchanged lines hidden (view full) --- 1283 .max_access_size = 4, 1284 .unaligned = false 1285 }, 1286 .endianness = DEVICE_LITTLE_ENDIAN, 1287}; 1288 1289static void sdhci_init_readonly_registers(SDHCIState *s, Error **errp) 1290{ |
1291 Error *local_err = NULL; | 1291 ERRP_GUARD(); |
1292 1293 switch (s->sd_spec_version) { 1294 case 2 ... 3: 1295 break; 1296 default: 1297 error_setg(errp, "Only Spec v2/v3 are supported"); 1298 return; 1299 } 1300 s->version = (SDHC_HCVER_VENDOR << 8) | (s->sd_spec_version - 1); 1301 | 1292 1293 switch (s->sd_spec_version) { 1294 case 2 ... 3: 1295 break; 1296 default: 1297 error_setg(errp, "Only Spec v2/v3 are supported"); 1298 return; 1299 } 1300 s->version = (SDHC_HCVER_VENDOR << 8) | (s->sd_spec_version - 1); 1301 |
1302 sdhci_check_capareg(s, &local_err); 1303 if (local_err) { 1304 error_propagate(errp, local_err); | 1302 sdhci_check_capareg(s, errp); 1303 if (*errp) { |
1305 return; 1306 } 1307} 1308 1309/* --- qdev common --- */ 1310 1311void sdhci_initfn(SDHCIState *s) 1312{ --- 14 unchanged lines hidden (view full) --- 1327 timer_free(s->transfer_timer); 1328 1329 g_free(s->fifo_buffer); 1330 s->fifo_buffer = NULL; 1331} 1332 1333void sdhci_common_realize(SDHCIState *s, Error **errp) 1334{ | 1304 return; 1305 } 1306} 1307 1308/* --- qdev common --- */ 1309 1310void sdhci_initfn(SDHCIState *s) 1311{ --- 14 unchanged lines hidden (view full) --- 1326 timer_free(s->transfer_timer); 1327 1328 g_free(s->fifo_buffer); 1329 s->fifo_buffer = NULL; 1330} 1331 1332void sdhci_common_realize(SDHCIState *s, Error **errp) 1333{ |
1335 Error *local_err = NULL; | 1334 ERRP_GUARD(); |
1336 | 1335 |
1337 sdhci_init_readonly_registers(s, &local_err); 1338 if (local_err) { 1339 error_propagate(errp, local_err); | 1336 sdhci_init_readonly_registers(s, errp); 1337 if (*errp) { |
1340 return; 1341 } 1342 s->buf_maxsz = sdhci_get_fifolen(s); 1343 s->fifo_buffer = g_malloc0(s->buf_maxsz); 1344 1345 memory_region_init_io(&s->iomem, OBJECT(s), s->io_ops, s, "sdhci", 1346 SDHC_REGISTERS_MAP_SIZE); 1347} --- 103 unchanged lines hidden (view full) --- 1451 object_unparent(OBJECT(s->dma_mr)); 1452 } 1453 1454 sdhci_uninitfn(s); 1455} 1456 1457static void sdhci_sysbus_realize(DeviceState *dev, Error **errp) 1458{ | 1338 return; 1339 } 1340 s->buf_maxsz = sdhci_get_fifolen(s); 1341 s->fifo_buffer = g_malloc0(s->buf_maxsz); 1342 1343 memory_region_init_io(&s->iomem, OBJECT(s), s->io_ops, s, "sdhci", 1344 SDHC_REGISTERS_MAP_SIZE); 1345} --- 103 unchanged lines hidden (view full) --- 1449 object_unparent(OBJECT(s->dma_mr)); 1450 } 1451 1452 sdhci_uninitfn(s); 1453} 1454 1455static void sdhci_sysbus_realize(DeviceState *dev, Error **errp) 1456{ |
1457 ERRP_GUARD(); |
|
1459 SDHCIState *s = SYSBUS_SDHCI(dev); 1460 SysBusDevice *sbd = SYS_BUS_DEVICE(dev); | 1458 SDHCIState *s = SYSBUS_SDHCI(dev); 1459 SysBusDevice *sbd = SYS_BUS_DEVICE(dev); |
1461 Error *local_err = NULL; | |
1462 | 1460 |
1463 sdhci_common_realize(s, &local_err); 1464 if (local_err) { 1465 error_propagate(errp, local_err); | 1461 sdhci_common_realize(s, errp); 1462 if (*errp) { |
1466 return; 1467 } 1468 1469 if (s->dma_mr) { 1470 s->dma_as = &s->sysbus_dma_as; 1471 address_space_init(s->dma_as, s->dma_mr, "sdhci-dma"); 1472 } else { 1473 /* use system_memory() if property "dma" not set */ --- 374 unchanged lines hidden --- | 1463 return; 1464 } 1465 1466 if (s->dma_mr) { 1467 s->dma_as = &s->sysbus_dma_as; 1468 address_space_init(s->dma_as, s->dma_mr, "sdhci-dma"); 1469 } else { 1470 /* use system_memory() if property "dma" not set */ --- 374 unchanged lines hidden --- |