Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

intel_th: gth: Factor out trace start/stop

The trace enable/disable functions of the GTH include the code that starts
and stops trace flom from the sources. This start/stop functionality will
also be used in the window switch trigger sequence.

Factor out start/stop code from the larger trace enable/disable code in
preparation for the window switch sequence.

Signed-off-by: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

authored by

Alexander Shishkin and committed by
Greg Kroah-Hartman
9958e025 8d415512

+65 -30
+65 -30
drivers/hwtracing/intel_th/gth.c
··· 457 457 } 458 458 459 459 /** 460 + * intel_th_gth_stop() - stop tracing to an output device 461 + * @gth: GTH device 462 + * @output: output device's descriptor 463 + * @capture_done: set when no more traces will be captured 464 + * 465 + * This will stop tracing using force storeEn off signal and wait for the 466 + * pipelines to be empty for the corresponding output port. 467 + */ 468 + static void intel_th_gth_stop(struct gth_device *gth, 469 + struct intel_th_output *output, 470 + bool capture_done) 471 + { 472 + struct intel_th_device *outdev = 473 + container_of(output, struct intel_th_device, output); 474 + struct intel_th_driver *outdrv = 475 + to_intel_th_driver(outdev->dev.driver); 476 + unsigned long count; 477 + u32 reg; 478 + u32 scr2 = 0xfc | (capture_done ? 1 : 0); 479 + 480 + iowrite32(0, gth->base + REG_GTH_SCR); 481 + iowrite32(scr2, gth->base + REG_GTH_SCR2); 482 + 483 + /* wait on pipeline empty for the given port */ 484 + for (reg = 0, count = GTH_PLE_WAITLOOP_DEPTH; 485 + count && !(reg & BIT(output->port)); count--) { 486 + reg = ioread32(gth->base + REG_GTH_STAT); 487 + cpu_relax(); 488 + } 489 + 490 + if (!count) 491 + dev_dbg(gth->dev, "timeout waiting for GTH[%d] PLE\n", 492 + output->port); 493 + 494 + /* wait on output piepline empty */ 495 + if (outdrv->wait_empty) 496 + outdrv->wait_empty(outdev); 497 + 498 + /* clear force capture done for next captures */ 499 + iowrite32(0xfc, gth->base + REG_GTH_SCR2); 500 + } 501 + 502 + /** 503 + * intel_th_gth_start() - start tracing to an output device 504 + * @gth: GTH device 505 + * @output: output device's descriptor 506 + * 507 + * This will start tracing using force storeEn signal. 508 + */ 509 + static void intel_th_gth_start(struct gth_device *gth, 510 + struct intel_th_output *output) 511 + { 512 + u32 scr = 0xfc0000; 513 + 514 + if (output->multiblock) 515 + scr |= 0xff; 516 + 517 + iowrite32(scr, gth->base + REG_GTH_SCR); 518 + iowrite32(0, gth->base + REG_GTH_SCR2); 519 + } 520 + 521 + /** 460 522 * intel_th_gth_disable() - disable tracing to an output device 461 523 * @thdev: GTH device 462 524 * @output: output device's descriptor ··· 531 469 struct intel_th_output *output) 532 470 { 533 471 struct gth_device *gth = dev_get_drvdata(&thdev->dev); 534 - struct intel_th_device *outdev = 535 - container_of(output, struct intel_th_device, output); 536 - struct intel_th_driver *outdrv = 537 - to_intel_th_driver(outdev->dev.driver); 538 - unsigned long count; 539 472 int master; 540 473 u32 reg; 541 474 ··· 543 486 } 544 487 spin_unlock(&gth->gth_lock); 545 488 546 - iowrite32(0, gth->base + REG_GTH_SCR); 547 - iowrite32(0xfd, gth->base + REG_GTH_SCR2); 548 - 549 - /* wait on pipeline empty for the given port */ 550 - for (reg = 0, count = GTH_PLE_WAITLOOP_DEPTH; 551 - count && !(reg & BIT(output->port)); count--) { 552 - reg = ioread32(gth->base + REG_GTH_STAT); 553 - cpu_relax(); 554 - } 555 - 556 - if (outdrv->wait_empty) 557 - outdrv->wait_empty(outdev); 558 - 559 - /* clear force capture done for next captures */ 560 - iowrite32(0xfc, gth->base + REG_GTH_SCR2); 561 - 562 - if (!count) 563 - dev_dbg(&thdev->dev, "timeout waiting for GTH[%d] PLE\n", 564 - output->port); 489 + intel_th_gth_stop(gth, output, true); 565 490 566 491 reg = ioread32(gth->base + REG_GTH_SCRPD0); 567 492 reg &= ~output->scratchpad; ··· 572 533 { 573 534 struct gth_device *gth = dev_get_drvdata(&thdev->dev); 574 535 struct intel_th *th = to_intel_th(thdev); 575 - u32 scr = 0xfc0000, scrpd; 576 536 int master; 537 + u32 scrpd; 577 538 578 539 spin_lock(&gth->gth_lock); 579 540 for_each_set_bit(master, gth->output[output->port].master, 580 541 TH_CONFIGURABLE_MASTERS + 1) { 581 542 gth_master_set(gth, master, output->port); 582 543 } 583 - 584 - if (output->multiblock) 585 - scr |= 0xff; 586 544 587 545 output->active = true; 588 546 spin_unlock(&gth->gth_lock); ··· 591 555 scrpd |= output->scratchpad; 592 556 iowrite32(scrpd, gth->base + REG_GTH_SCRPD0); 593 557 594 - iowrite32(scr, gth->base + REG_GTH_SCR); 595 - iowrite32(0, gth->base + REG_GTH_SCR2); 558 + intel_th_gth_start(gth, output); 596 559 } 597 560 598 561 /**