| 516 | } |
| 517 | |
| 518 | static int |
| 519 | ti_pruss_attach(device_t dev) |
| 520 | { |
| 521 | struct ti_pruss_softc *sc; |
| 522 | int rid, i, err, ncells; |
| 523 | uint32_t reg; |
| 524 | phandle_t node; |
| 525 | clk_t l3_gclk, pruss_ocp_gclk; |
| 526 | phandle_t ti_prm_ref, *cells; |
| 527 | device_t ti_prm_dev; |
| 528 | |
| 529 | rid = 0; |
| 530 | sc = device_get_softc(dev); |
| 531 | node = ofw_bus_get_node(device_get_parent(dev)); |
| 532 | if (node <= 0) { |
| 533 | device_printf(dev, "Cant get ofw node\n"); |
| 534 | return (ENXIO); |
| 535 | } |
| 536 | |
| 537 | /* |
| 538 | * Follow activate pattern from sys/arm/ti/am335x/am335x_prcm.c |
| 539 | * by Damjan Marion |
| 540 | */ |
| 541 | |
| 542 | /* Set MODULEMODE to ENABLE(2) */ |
| 543 | /* Wait for MODULEMODE to become ENABLE(2) */ |
| 544 | if (ti_sysc_clock_enable(device_get_parent(dev)) != 0) { |
| 545 | device_printf(dev, "Could not enable PRUSS clock\n"); |
| 546 | return (ENXIO); |
| 547 | } |
| 548 | |
| 549 | /* Set CLKTRCTRL to SW_WKUP(2) */ |
| 550 | /* Wait for the 200 MHz OCP clock to become active */ |
| 551 | /* Wait for the 200 MHz IEP clock to become active */ |
| 552 | /* Wait for the 192 MHz UART clock to become active */ |
| 553 | /* |
| 554 | * At the moment there is no reference to CM_PER_PRU_ICSS_CLKSTCTRL@140 |
| 555 | * in the devicetree. The register reset state are SW_WKUP(2) as default |
| 556 | * so at the moment ignore setting this register. |
| 557 | */ |
| 558 | |
| 559 | /* Select L3F as OCP clock */ |
| 560 | /* Get the clock and set the parent */ |
| 561 | err = clk_get_by_name(dev, "l3_gclk", &l3_gclk); |
| 562 | if (err) { |
| 563 | device_printf(dev, "Cant get l3_gclk err %d\n", err); |
| 564 | return (ENXIO); |
| 565 | } |
| 566 | |
| 567 | err = clk_get_by_name(dev, "pruss_ocp_gclk@530", &pruss_ocp_gclk); |
| 568 | if (err) { |
| 569 | device_printf(dev, "Cant get pruss_ocp_gclk@530 err %d\n", err); |
| 570 | return (ENXIO); |
| 571 | } |
| 572 | |
| 573 | err = clk_set_parent_by_clk(pruss_ocp_gclk, l3_gclk); |
| 574 | if (err) { |
| 575 | device_printf(dev, |
nothing calls this directly
no test coverage detected