MCPcopy Create free account
hub / github.com/F-Stack/f-stack / ti_pruss_attach

Function ti_pruss_attach

freebsd/arm/ti/ti_pruss.c:518–703  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

516}
517
518static int
519ti_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,

Callers

nothing calls this directly

Calls 15

device_get_softcFunction · 0.85
device_get_parentFunction · 0.85
device_printfFunction · 0.85
ti_sysc_clock_enableFunction · 0.85
ti_prm_resetFunction · 0.85
mtx_initFunction · 0.85
bus_alloc_resource_anyFunction · 0.85
device_get_sysctl_ctxFunction · 0.85
device_get_sysctl_treeFunction · 0.85
rman_get_bustagFunction · 0.85
rman_get_bushandleFunction · 0.85
bus_alloc_resourcesFunction · 0.85

Tested by

no test coverage detected