Lines Matching +full:8 +full:dev
45 #include <dev/clk/clk.h>
46 #include <dev/fdt/fdt_common.h>
47 #include <dev/ofw/ofw_bus_subr.h>
87 device_t dev; member
120 static int flex_spi_attach(device_t dev);
121 static int flex_spi_probe(device_t dev);
122 static int flex_spi_detach(device_t dev);
213 lut |= LUT_DEF(1, LUT_ADDR, LUT_PAD(1), 3*8); in flex_spi_prepare_lut()
215 lut = LUT_DEF(0, LUT_DUMMY, LUT_PAD(1), 1*8); in flex_spi_prepare_lut()
218 write_reg(sc, FSPI_LUT_REG(lut_id) + 8, 0); in flex_spi_prepare_lut()
228 lut |= LUT_DEF(1, LUT_ADDR, LUT_PAD(1), 3*8); in flex_spi_prepare_lut()
232 write_reg(sc, FSPI_LUT_REG(lut_id) + 8, 0); in flex_spi_prepare_lut()
246 lut |= LUT_DEF(1, LUT_ADDR, LUT_PAD(1), 3*8); in flex_spi_prepare_lut()
271 lut |= LUT_DEF(1, LUT_ADDR, LUT_PAD(1), 3*8); in flex_spi_prepare_ahb_lut()
273 lut = LUT_DEF(0, LUT_DUMMY, LUT_PAD(1), 1*8); in flex_spi_prepare_ahb_lut()
276 write_reg(sc, FSPI_LUT_REG(lut_id) + 8, 0); in flex_spi_prepare_ahb_lut()
292 * Default value of water mark level is 8 bytes, hence in single in flex_spi_read_rxfifo()
293 * read request controller can read max 8 bytes of data. in flex_spi_read_rxfifo()
297 if (i % 8 == 0) { in flex_spi_read_rxfifo()
301 device_printf(sc->dev, in flex_spi_read_rxfifo()
305 if (i % 8 == 0) in flex_spi_read_rxfifo()
316 if (i % 8 != 0) in flex_spi_read_rxfifo()
335 * Default value of water mark level is 8 bytes, hence in single in flex_spi_write_txfifo()
336 * read request controller can read max 8 bytes of data. in flex_spi_write_txfifo()
340 if (i % 8 == 0) { in flex_spi_write_txfifo()
344 device_printf(sc->dev, in flex_spi_write_txfifo()
355 if (i % 8 == 0) in flex_spi_write_txfifo()
361 if (i % 8 != 0) in flex_spi_write_txfifo()
411 device_printf(sc->dev, "timed out waiting for command completion\n"); in flex_spi_do_op()
442 device_printf(sc->dev, "%s: timed out waiting for controller", __func__); in flex_spi_wait_for_flash()
450 device_printf(sc->dev, "ERROR: failed to get flash status\n"); in flex_spi_wait_for_flash()
468 device_printf(sc->dev, "ERROR: failed to identify device\n"); in flex_spi_identify()
475 device_printf(sc->dev, "found %s Flash\n", finfo->name); in flex_spi_identify()
510 device_printf(sc->dev, in flex_spi_read()
557 device_printf(sc->dev, "ERROR: failed to enable writes\n"); in flex_spi_write()
573 device_printf(sc->dev, "ERROR: failed to read sector %d\n", in flex_spi_write()
583 device_printf(sc->dev, "ERROR: failed to erase sector %d\n", in flex_spi_write()
600 device_printf(sc->dev, "ERROR: failed to write address %ld\n", in flex_spi_write()
615 device_printf(sc->dev, "ERROR: failed to disable writes\n"); in flex_spi_write()
643 device_printf(sc->dev, "time out waiting for reset"); in flex_spi_default_setup()
674 write_reg(sc, FSPI_AHBRX_BUF7CR0, (2048 / 8 | in flex_spi_default_setup()
694 flex_spi_probe(device_t dev) in flex_spi_probe() argument
697 if (!ofw_bus_status_okay(dev)) in flex_spi_probe()
700 if (!ofw_bus_search_compatible(dev, flex_spi_compat_data)->ocd_data) in flex_spi_probe()
703 device_set_desc(dev, "NXP FlexSPI Flash"); in flex_spi_probe()
708 flex_spi_attach(device_t dev) in flex_spi_attach() argument
715 node = ofw_bus_get_node(dev); in flex_spi_attach()
716 sc = device_get_softc(dev); in flex_spi_attach()
717 sc->dev = dev; in flex_spi_attach()
723 sc->mem_res = bus_alloc_resource_any(dev, SYS_RES_MEMORY, &rid, in flex_spi_attach()
727 sc->ahb_mem_res = bus_alloc_resource_any(dev, SYS_RES_MEMORY, &rid, in flex_spi_attach()
731 device_printf(dev, "could not allocate resources\n"); in flex_spi_attach()
732 flex_spi_detach(dev); in flex_spi_attach()
737 if ((clk_get_by_ofw_name(dev, node, "fspi_en", &sc->fspi_clk_en) != 0) in flex_spi_attach()
739 device_printf(dev, "could not get fspi_en clock\n"); in flex_spi_attach()
740 flex_spi_detach(dev); in flex_spi_attach()
743 if ((clk_get_by_ofw_name(dev, node, "fspi", &sc->fspi_clk) != 0) in flex_spi_attach()
745 device_printf(dev, "could not get fspi clock\n"); in flex_spi_attach()
746 flex_spi_detach(dev); in flex_spi_attach()
753 device_printf(dev, "could not enable clocks\n"); in flex_spi_attach()
754 flex_spi_detach(dev); in flex_spi_attach()
765 device_printf(sc->dev, "Unable to initialize defaults\n"); in flex_spi_attach()
766 flex_spi_detach(dev); in flex_spi_attach()
772 device_printf(sc->dev, "Unable to identify Flash\n"); in flex_spi_attach()
773 flex_spi_detach(dev); in flex_spi_attach()
778 device_printf(sc->dev, "Unable to set up SPI max clock\n"); in flex_spi_attach()
779 flex_spi_detach(dev); in flex_spi_attach()
796 sc->disk->d_unit = device_get_unit(sc->dev); in flex_spi_attach()
811 flex_spi_detach(device_t dev) in flex_spi_detach() argument
816 sc = device_get_softc(dev); in flex_spi_detach()
819 if (!device_is_attached(dev)) in flex_spi_detach()
831 device_printf(sc->dev, in flex_spi_detach()
849 bus_release_resource(dev, SYS_RES_MEMORY, in flex_spi_detach()
853 bus_release_resource(dev, SYS_RES_MEMORY, in flex_spi_detach()
905 device_t dev; in flex_spi_getattr() local
912 dev = sc->dev; in flex_spi_getattr()
918 if (bp->bio_length != sizeof(dev)) { in flex_spi_getattr()
922 bcopy(&dev, bp->bio_data, sizeof(dev)); in flex_spi_getattr()