Lines Matching +full:syscon +full:- +full:dev

1 /*-
41 #include <dev/fdt/simplebus.h>
42 #include <dev/ofw/openfirm.h>
43 #include <dev/ofw/ofw_bus.h>
44 #include <dev/ofw/ofw_bus_subr.h>
48 #include <dev/syscon/syscon.h>
60 /* TRM chapter 2 memory map table 2-3 + VER register location */
72 struct syscon *syscon; member
84 am335x_pwmss_probe(device_t dev) in am335x_pwmss_probe() argument
87 if (!ofw_bus_status_okay(dev)) in am335x_pwmss_probe()
90 if (!ofw_bus_is_compatible(dev, "ti,am33xx-pwmss")) in am335x_pwmss_probe()
93 device_set_desc(dev, "AM335x PWM"); in am335x_pwmss_probe()
99 am335x_pwmss_attach(device_t dev) in am335x_pwmss_attach() argument
106 sc = device_get_softc(dev); in am335x_pwmss_attach()
107 sc->sc_dev = dev; in am335x_pwmss_attach()
109 /* FIXME: For now; Go and kidnap syscon from opp-table */ in am335x_pwmss_attach()
110 opp_table = OF_finddevice("/opp-table"); in am335x_pwmss_attach()
111 if (opp_table == -1) { in am335x_pwmss_attach()
112 device_printf(dev, "Cant find /opp-table\n"); in am335x_pwmss_attach()
115 if (!OF_hasprop(opp_table, "syscon")) { in am335x_pwmss_attach()
116 device_printf(dev, "/opp-table doesnt have required syscon property\n"); in am335x_pwmss_attach()
119 if (syscon_get_by_ofw_property(dev, opp_table, "syscon", &sc->syscon) != 0) { in am335x_pwmss_attach()
120 device_printf(dev, "Failed to get syscon\n"); in am335x_pwmss_attach()
124 ti_sysc_clock_enable(device_get_parent(dev)); in am335x_pwmss_attach()
126 rev_address = ti_sysc_get_rev_address(device_get_parent(dev)); in am335x_pwmss_attach()
139 reg = SYSCON_READ_4(sc->syscon, SCM_PWMSS_CTRL); in am335x_pwmss_attach()
141 SYSCON_WRITE_4(sc->syscon, SCM_PWMSS_CTRL, reg); in am335x_pwmss_attach()
143 node = ofw_bus_get_node(dev); in am335x_pwmss_attach()
145 if (node == -1) in am335x_pwmss_attach()
148 simplebus_init(dev, node); in am335x_pwmss_attach()
153 bus_identify_children(dev); in am335x_pwmss_attach()
156 * Now walk the OFW tree and attach top-level devices. in am335x_pwmss_attach()
159 simplebus_add_device(dev, node, 0, NULL, -1, NULL); in am335x_pwmss_attach()
161 bus_attach_children(dev); in am335x_pwmss_attach()
166 am335x_pwmss_detach(device_t dev) in am335x_pwmss_detach() argument