Lines Matching +full:spi +full:- +full:mode

1 /*-
2 * SPDX-License-Identifier: BSD-2-Clause
42 #include <dev/spibus/spi.h>
67 if (ofw_bus_get_node(dev) == -1) in ofw_spibus_probe()
69 device_set_desc(dev, "OFW SPI bus"); in ofw_spibus_probe()
82 uint32_t mode = SPIBUS_MODE_NONE; in ofw_spibus_attach() local
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()
106 * Try to get the cpol/cpha mode in ofw_spibus_attach()
108 if (OF_hasprop(child, "spi-cpol")) in ofw_spibus_attach()
109 mode = SPIBUS_MODE_CPOL; in ofw_spibus_attach()
110 if (OF_hasprop(child, "spi-cpha")) { in ofw_spibus_attach()
111 if (mode == SPIBUS_MODE_CPOL) in ofw_spibus_attach()
112 mode = SPIBUS_MODE_CPOL_CPHA; in ofw_spibus_attach()
114 mode = SPIBUS_MODE_CPHA; in ofw_spibus_attach()
120 if (OF_hasprop(child, "spi-cs-high")) 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()
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()
206 return (&dinfo->opd_obdinfo); in ofw_spibus_get_devinfo()
215 return (&devi->rl); in ofw_spibus_get_resource_list()
242 DRIVER_MODULE(ofw_spibus, spi, ofw_spibus_driver, 0, 0);