330
330
target_phys_addr_t addr, uint32_t value)
332
332
#ifdef DEBUG_OPBA
333
printf("%s: addr " PADDRX " val %08x\n", __func__, addr, value);
333
printf("%s: addr " PADDRX " val %08" PRIx32 "\n", __func__, addr, value);
335
335
opba_writeb(opaque, addr, value >> 8);
336
336
opba_writeb(opaque, addr + 1, value);
353
353
target_phys_addr_t addr, uint32_t value)
355
355
#ifdef DEBUG_OPBA
356
printf("%s: addr " PADDRX " val %08x\n", __func__, addr, value);
356
printf("%s: addr " PADDRX " val %08" PRIx32 "\n", __func__, addr, value);
358
358
opba_writeb(opaque, addr, value >> 24);
359
359
opba_writeb(opaque, addr + 1, value >> 16);
389
389
if (opba != NULL) {
390
390
opba->base = offset;
391
391
#ifdef DEBUG_OPBA
392
printf("%s: offset=" PADDRX "\n", __func__, offset);
392
printf("%s: offset " PADDRX "\n", __func__, offset);
394
394
ppc4xx_mmio_register(env, mmio, offset, 0x002,
395
395
opba_read, opba_write, opba);
500
503
*bcrp = bcr & 0xFFDEE001;
501
504
if (enabled && (bcr & 0x00000001)) {
502
505
#ifdef DEBUG_SDRAM
503
printf("%s: Map RAM area " TARGET_FMT_plx " " TARGET_FMT_lx "\n",
506
printf("%s: Map RAM area " PADDRX " " ADDRX "\n",
504
507
__func__, sdram_base(bcr), sdram_size(bcr));
506
509
cpu_register_physical_memory(sdram_base(bcr), sdram_size(bcr),
1190
1193
ppc405_gpio_reset(gpio);
1191
1194
qemu_register_reset(&ppc405_gpio_reset, gpio);
1192
1195
#ifdef DEBUG_GPIO
1193
printf("%s: offset=" PADDRX "\n", __func__, offset);
1196
printf("%s: offset " PADDRX "\n", __func__, offset);
1195
1198
ppc4xx_mmio_register(env, mmio, offset, 0x038,
1196
1199
ppc405_gpio_read, ppc405_gpio_write, gpio);
1220
1223
#ifdef DEBUG_SERIAL
1221
printf("%s: offset=" PADDRX "\n", __func__, offset);
1224
printf("%s: offset " PADDRX "\n", __func__, offset);
1223
1226
serial = serial_mm_init(offset, 0, irq, chr, 0);
1224
1227
ppc4xx_mmio_register(env, mmio, offset, 0x008,
1248
1251
uint32_t dsarc, uint32_t dsacntl)
1250
1253
#ifdef DEBUG_OCM
1251
printf("OCM update ISA %08x %08x (%08x %08x) DSA %08x %08x (%08x %08x)\n",
1254
printf("OCM update ISA %08" PRIx32 " %08" PRIx32 " (%08" PRIx32
1255
" %08" PRIx32 ") DSA %08" PRIx32 " %08" PRIx32
1256
" (%08" PRIx32 " %08" PRIx32 ")\n",
1252
1257
isarc, isacntl, dsarc, dsacntl,
1253
1258
ocm->isarc, ocm->isacntl, ocm->dsarc, ocm->dsacntl);
1256
1261
(ocm->isacntl & 0x80000000) != (isacntl & 0x80000000)) {
1257
1262
if (ocm->isacntl & 0x80000000) {
1258
1263
/* Unmap previously assigned memory region */
1259
printf("OCM unmap ISA %08x\n", ocm->isarc);
1264
printf("OCM unmap ISA %08" PRIx32 "\n", ocm->isarc);
1260
1265
cpu_register_physical_memory(ocm->isarc, 0x04000000,
1261
1266
IO_MEM_UNASSIGNED);
1263
1268
if (isacntl & 0x80000000) {
1264
1269
/* Map new instruction memory region */
1265
1270
#ifdef DEBUG_OCM
1266
printf("OCM map ISA %08x\n", isarc);
1271
printf("OCM map ISA %08" PRIx32 "\n", isarc);
1268
1273
cpu_register_physical_memory(isarc, 0x04000000,
1269
1274
ocm->offset | IO_MEM_RAM);
1557
1562
target_phys_addr_t addr, uint32_t value)
1559
1564
#ifdef DEBUG_I2C
1560
printf("%s: addr " PADDRX " val %08x\n", __func__, addr, value);
1565
printf("%s: addr " PADDRX " val %08" PRIx32 "\n", __func__, addr, value);
1562
1567
ppc4xx_i2c_writeb(opaque, addr, value >> 8);
1563
1568
ppc4xx_i2c_writeb(opaque, addr + 1, value);
1582
1587
target_phys_addr_t addr, uint32_t value)
1584
1589
#ifdef DEBUG_I2C
1585
printf("%s: addr " PADDRX " val %08x\n", __func__, addr, value);
1590
printf("%s: addr " PADDRX " val %08" PRIx32 "\n", __func__, addr, value);
1587
1592
ppc4xx_i2c_writeb(opaque, addr, value >> 24);
1588
1593
ppc4xx_i2c_writeb(opaque, addr + 1, value >> 16);
1629
1634
i2c->irq = irq;
1630
1635
ppc4xx_i2c_reset(i2c);
1631
1636
#ifdef DEBUG_I2C
1632
printf("%s: offset=" PADDRX "\n", __func__, offset);
1637
printf("%s: offset " PADDRX "\n", __func__, offset);
1634
1639
ppc4xx_mmio_register(env, mmio, offset, 0x011,
1635
1640
i2c_read, i2c_write, i2c);
1913
1918
gpt->timer = qemu_new_timer(vm_clock, &ppc4xx_gpt_cb, gpt);
1914
1919
ppc4xx_gpt_reset(gpt);
1915
1920
#ifdef DEBUG_GPT
1916
printf("%s: offset=" PADDRX "\n", __func__, offset);
1921
printf("%s: offset " PADDRX "\n", __func__, offset);
1918
1923
ppc4xx_mmio_register(env, mmio, offset, 0x0D4,
1919
1924
gpt_read, gpt_write, gpt);
2657
2662
if ((cpc->pllmr[1] & 0x80000000) && !(cpc->pllmr[1] & 0x40000000)) {
2658
2663
M = (((cpc->pllmr[1] >> 20) - 1) & 0xF) + 1; /* FBMUL */
2659
// printf("FBMUL %01x %d\n", (cpc->pllmr[1] >> 20) & 0xF, M);
2664
#ifdef DEBUG_CLOCKS_LL
2665
printf("FBMUL %01" PRIx32 " %d\n", (cpc->pllmr[1] >> 20) & 0xF, M);
2660
2667
D = 8 - ((cpc->pllmr[1] >> 16) & 0x7); /* FWDA */
2661
// printf("FWDA %01x %d\n", (cpc->pllmr[1] >> 16) & 0x7, D);
2668
#ifdef DEBUG_CLOCKS_LL
2669
printf("FWDA %01" PRIx32 " %d\n", (cpc->pllmr[1] >> 16) & 0x7, D);
2662
2671
VCO_out = cpc->sysclk * M * D;
2663
2672
if (VCO_out < 500000000UL || VCO_out > 1000000000UL) {
2664
2673
/* Error - unlock the PLL */
2684
2693
/* Now, compute all other clocks */
2685
2694
D = ((cpc->pllmr[0] >> 20) & 0x3) + 1; /* CCDV */
2687
// printf("CCDV %01x %d\n", (cpc->pllmr[0] >> 20) & 0x3, D);
2695
#ifdef DEBUG_CLOCKS_LL
2696
printf("CCDV %01" PRIx32 " %d\n", (cpc->pllmr[0] >> 20) & 0x3, D);
2689
2698
CPU_clk = PLL_out / D;
2690
2699
D = ((cpc->pllmr[0] >> 16) & 0x3) + 1; /* CBDV */
2692
// printf("CBDV %01x %d\n", (cpc->pllmr[0] >> 16) & 0x3, D);
2700
#ifdef DEBUG_CLOCKS_LL
2701
printf("CBDV %01" PRIx32 " %d\n", (cpc->pllmr[0] >> 16) & 0x3, D);
2694
2703
PLB_clk = CPU_clk / D;
2695
2704
D = ((cpc->pllmr[0] >> 12) & 0x3) + 1; /* OPDV */
2697
// printf("OPDV %01x %d\n", (cpc->pllmr[0] >> 12) & 0x3, D);
2705
#ifdef DEBUG_CLOCKS_LL
2706
printf("OPDV %01" PRIx32 " %d\n", (cpc->pllmr[0] >> 12) & 0x3, D);
2699
2708
OPB_clk = PLB_clk / D;
2700
2709
D = ((cpc->pllmr[0] >> 8) & 0x3) + 2; /* EPDV */
2702
// printf("EPDV %01x %d\n", (cpc->pllmr[0] >> 8) & 0x3, D);
2710
#ifdef DEBUG_CLOCKS_LL
2711
printf("EPDV %01" PRIx32 " %d\n", (cpc->pllmr[0] >> 8) & 0x3, D);
2704
2713
EBC_clk = PLB_clk / D;
2705
2714
D = ((cpc->pllmr[0] >> 4) & 0x3) + 1; /* MPDV */
2707
// printf("MPDV %01x %d\n", (cpc->pllmr[0] >> 4) & 0x3, D);
2715
#ifdef DEBUG_CLOCKS_LL
2716
printf("MPDV %01" PRIx32 " %d\n", (cpc->pllmr[0] >> 4) & 0x3, D);
2709
2718
MAL_clk = PLB_clk / D;
2710
2719
D = (cpc->pllmr[0] & 0x3) + 1; /* PPDV */
2712
// printf("PPDV %01x %d\n", cpc->pllmr[0] & 0x3, D);
2720
#ifdef DEBUG_CLOCKS_LL
2721
printf("PPDV %01" PRIx32 " %d\n", cpc->pllmr[0] & 0x3, D);
2714
2723
PCI_clk = PLB_clk / D;
2715
2724
D = ((cpc->ucr - 1) & 0x7F) + 1; /* U0DIV */
2717
// printf("U0DIV %01x %d\n", cpc->ucr & 0x7F, D);
2725
#ifdef DEBUG_CLOCKS_LL
2726
printf("U0DIV %01" PRIx32 " %d\n", cpc->ucr & 0x7F, D);
2719
2728
UART0_clk = PLL_out / D;
2720
2729
D = (((cpc->ucr >> 8) - 1) & 0x7F) + 1; /* U1DIV */
2722
// printf("U1DIV %01x %d\n", (cpc->ucr >> 8) & 0x7F, D);
2730
#ifdef DEBUG_CLOCKS_LL
2731
printf("U1DIV %01" PRIx32 " %d\n", (cpc->ucr >> 8) & 0x7F, D);
2724
2733
UART1_clk = PLL_out / D;
2725
2734
#ifdef DEBUG_CLOCKS
2726
printf("Setup PPC405EP clocks - sysclk %d VCO %" PRIu64
2735
printf("Setup PPC405EP clocks - sysclk %" PRIu32 " VCO %" PRIu64
2727
2736
" PLL out %" PRIu64 " Hz\n", cpc->sysclk, VCO_out, PLL_out);
2728
printf("CPU %d PLB %d OPB %d EBC %d MAL %d PCI %d UART0 %d UART1 %d\n",
2737
printf("CPU %" PRIu32 " PLB %" PRIu32 " OPB %" PRIu32 " EBC %" PRIu32
2738
" MAL %" PRIu32 " PCI %" PRIu32 " UART0 %" PRIu32
2739
" UART1 %" PRIu32 "\n",
2729
2740
CPU_clk, PLB_clk, OPB_clk, EBC_clk, MAL_clk, PCI_clk,
2730
2741
UART0_clk, UART1_clk);
2731
printf("CB %p opaque %p\n", cpc->clk_setup[PPC405EP_CPU_CLK].cb,
2732
cpc->clk_setup[PPC405EP_CPU_CLK].opaque);
2734
2743
/* Setup CPU clocks */
2735
2744
clk_setup(&cpc->clk_setup[PPC405EP_CPU_CLK], CPU_clk);