Lines Matching +full:spi +full:- +full:bus

1 /*-
2 * SPDX-License-Identifier: BSD-2-Clause
34 #include <sys/bus.h>
42 #include <dev/spibus/spi.h>
60 static const struct ofw_bus_devinfo *ofw_spibus_get_devinfo(device_t bus,
67 if (ofw_bus_get_node(dev) == -1) in ofw_spibus_probe()
69 device_set_desc(dev, "OFW SPI bus"); in ofw_spibus_probe()
84 sc->dev = dev; in ofw_spibus_attach()
95 * Try to get the CS number first from the spi-chipselect in ofw_spibus_attach()
98 if (OF_getencprop(child, "spi-chipselect", &paddr, in ofw_spibus_attach()
99 sizeof(paddr)) == -1) { in ofw_spibus_attach()
101 sizeof(paddr)) == -1) in ofw_spibus_attach()
108 if (OF_hasprop(child, "spi-cpol")) in ofw_spibus_attach()
110 if (OF_hasprop(child, "spi-cpha")) { in ofw_spibus_attach()
120 if (OF_hasprop(child, "spi-cs-high")) in ofw_spibus_attach()
125 * use the default bus speed. in ofw_spibus_attach()
127 * XXX Note that the current (2018-04-07) dts bindings say that in ofw_spibus_attach()
128 * spi-max-frequency is a required property (but says nothing of in ofw_spibus_attach()
131 if (OF_getencprop(child, "spi-max-frequency", &clock, in ofw_spibus_attach()
132 sizeof(clock)) == -1) in ofw_spibus_attach()
136 * Now set up the SPI and OFW bus layer devinfo and add it in ofw_spibus_attach()
137 * to the bus. in ofw_spibus_attach()
143 dinfo->opd_dinfo.cs = paddr; in ofw_spibus_attach()
144 dinfo->opd_dinfo.clock = clock; in ofw_spibus_attach()
145 dinfo->opd_dinfo.mode = mode; in ofw_spibus_attach()
146 if (ofw_bus_gen_setup_devinfo(&dinfo->opd_obdinfo, child) != in ofw_spibus_attach()
153 resource_list_init(&dinfo->opd_dinfo.rl); in ofw_spibus_attach()
155 &dinfo->opd_dinfo.rl, NULL); in ofw_spibus_attach()
180 * NULL all the OFW-related parts of the ivars for non-OFW in ofw_spibus_add_child()
183 devi->opd_obdinfo.obd_node = -1; in ofw_spibus_add_child()
184 devi->opd_obdinfo.obd_name = NULL; in ofw_spibus_add_child()
185 devi->opd_obdinfo.obd_compat = NULL; in ofw_spibus_add_child()
186 devi->opd_obdinfo.obd_type = NULL; in ofw_spibus_add_child()
187 devi->opd_obdinfo.obd_model = NULL; in ofw_spibus_add_child()
201 ofw_spibus_get_devinfo(device_t bus, device_t dev) in ofw_spibus_get_devinfo() argument
206 return (&dinfo->opd_obdinfo); in ofw_spibus_get_devinfo()
210 ofw_spibus_get_resource_list(device_t bus __unused, device_t child) in ofw_spibus_get_resource_list()
215 return (&devi->rl); in ofw_spibus_get_resource_list()
223 /* Bus interface */
242 DRIVER_MODULE(ofw_spibus, spi, ofw_spibus_driver, 0, 0);