ispi 27 drivers/mtd/spi-nor/intel-spi-pci.c struct intel_spi *ispi; ispi 49 drivers/mtd/spi-nor/intel-spi-pci.c ispi = intel_spi_probe(&pdev->dev, &pdev->resource[0], info); ispi 50 drivers/mtd/spi-nor/intel-spi-pci.c if (IS_ERR(ispi)) ispi 51 drivers/mtd/spi-nor/intel-spi-pci.c return PTR_ERR(ispi); ispi 53 drivers/mtd/spi-nor/intel-spi-pci.c pci_set_drvdata(pdev, ispi); ispi 18 drivers/mtd/spi-nor/intel-spi-platform.c struct intel_spi *ispi; ispi 26 drivers/mtd/spi-nor/intel-spi-platform.c ispi = intel_spi_probe(&pdev->dev, mem, info); ispi 27 drivers/mtd/spi-nor/intel-spi-platform.c if (IS_ERR(ispi)) ispi 28 drivers/mtd/spi-nor/intel-spi-platform.c return PTR_ERR(ispi); ispi 30 drivers/mtd/spi-nor/intel-spi-platform.c platform_set_drvdata(pdev, ispi); ispi 36 drivers/mtd/spi-nor/intel-spi-platform.c struct intel_spi *ispi = platform_get_drvdata(pdev); ispi 38 drivers/mtd/spi-nor/intel-spi-platform.c return intel_spi_remove(ispi); ispi 162 drivers/mtd/spi-nor/intel-spi.c static void intel_spi_dump_regs(struct intel_spi *ispi) ispi 167 drivers/mtd/spi-nor/intel-spi.c dev_dbg(ispi->dev, "BFPREG=0x%08x\n", readl(ispi->base + BFPREG)); ispi 169 drivers/mtd/spi-nor/intel-spi.c value = readl(ispi->base + HSFSTS_CTL); ispi 170 drivers/mtd/spi-nor/intel-spi.c dev_dbg(ispi->dev, "HSFSTS_CTL=0x%08x\n", value); ispi 172 drivers/mtd/spi-nor/intel-spi.c dev_dbg(ispi->dev, "-> Locked\n"); ispi 174 drivers/mtd/spi-nor/intel-spi.c dev_dbg(ispi->dev, "FADDR=0x%08x\n", readl(ispi->base + FADDR)); ispi 175 drivers/mtd/spi-nor/intel-spi.c dev_dbg(ispi->dev, "DLOCK=0x%08x\n", readl(ispi->base + DLOCK)); ispi 178 drivers/mtd/spi-nor/intel-spi.c dev_dbg(ispi->dev, "FDATA(%d)=0x%08x\n", ispi 179 drivers/mtd/spi-nor/intel-spi.c i, readl(ispi->base + FDATA(i))); ispi 181 drivers/mtd/spi-nor/intel-spi.c dev_dbg(ispi->dev, "FRACC=0x%08x\n", readl(ispi->base + FRACC)); ispi 183 drivers/mtd/spi-nor/intel-spi.c for (i = 0; i < ispi->nregions; i++) ispi 184 drivers/mtd/spi-nor/intel-spi.c dev_dbg(ispi->dev, "FREG(%d)=0x%08x\n", i, ispi 185 drivers/mtd/spi-nor/intel-spi.c readl(ispi->base + FREG(i))); ispi 186 drivers/mtd/spi-nor/intel-spi.c for (i = 0; i < ispi->pr_num; i++) ispi 187 drivers/mtd/spi-nor/intel-spi.c dev_dbg(ispi->dev, "PR(%d)=0x%08x\n", i, ispi 188 drivers/mtd/spi-nor/intel-spi.c readl(ispi->pregs + PR(i))); ispi 190 drivers/mtd/spi-nor/intel-spi.c value = readl(ispi->sregs + SSFSTS_CTL); ispi 191 drivers/mtd/spi-nor/intel-spi.c dev_dbg(ispi->dev, "SSFSTS_CTL=0x%08x\n", value); ispi 192 drivers/mtd/spi-nor/intel-spi.c dev_dbg(ispi->dev, "PREOP_OPTYPE=0x%08x\n", ispi 193 drivers/mtd/spi-nor/intel-spi.c readl(ispi->sregs + PREOP_OPTYPE)); ispi 194 drivers/mtd/spi-nor/intel-spi.c dev_dbg(ispi->dev, "OPMENU0=0x%08x\n", readl(ispi->sregs + OPMENU0)); ispi 195 drivers/mtd/spi-nor/intel-spi.c dev_dbg(ispi->dev, "OPMENU1=0x%08x\n", readl(ispi->sregs + OPMENU1)); ispi 197 drivers/mtd/spi-nor/intel-spi.c if (ispi->info->type == INTEL_SPI_BYT) ispi 198 drivers/mtd/spi-nor/intel-spi.c dev_dbg(ispi->dev, "BCR=0x%08x\n", readl(ispi->base + BYT_BCR)); ispi 200 drivers/mtd/spi-nor/intel-spi.c dev_dbg(ispi->dev, "LVSCC=0x%08x\n", readl(ispi->base + LVSCC)); ispi 201 drivers/mtd/spi-nor/intel-spi.c dev_dbg(ispi->dev, "UVSCC=0x%08x\n", readl(ispi->base + UVSCC)); ispi 203 drivers/mtd/spi-nor/intel-spi.c dev_dbg(ispi->dev, "Protected regions:\n"); ispi 204 drivers/mtd/spi-nor/intel-spi.c for (i = 0; i < ispi->pr_num; i++) { ispi 207 drivers/mtd/spi-nor/intel-spi.c value = readl(ispi->pregs + PR(i)); ispi 214 drivers/mtd/spi-nor/intel-spi.c dev_dbg(ispi->dev, " %02d base: 0x%08x limit: 0x%08x [%c%c]\n", ispi 220 drivers/mtd/spi-nor/intel-spi.c dev_dbg(ispi->dev, "Flash regions:\n"); ispi 221 drivers/mtd/spi-nor/intel-spi.c for (i = 0; i < ispi->nregions; i++) { ispi 224 drivers/mtd/spi-nor/intel-spi.c region = readl(ispi->base + FREG(i)); ispi 229 drivers/mtd/spi-nor/intel-spi.c dev_dbg(ispi->dev, " %02d disabled\n", i); ispi 231 drivers/mtd/spi-nor/intel-spi.c dev_dbg(ispi->dev, " %02d base: 0x%08x limit: 0x%08x\n", ispi 235 drivers/mtd/spi-nor/intel-spi.c dev_dbg(ispi->dev, "Using %cW sequencer for register access\n", ispi 236 drivers/mtd/spi-nor/intel-spi.c ispi->swseq_reg ? 'S' : 'H'); ispi 237 drivers/mtd/spi-nor/intel-spi.c dev_dbg(ispi->dev, "Using %cW sequencer for erase operation\n", ispi 238 drivers/mtd/spi-nor/intel-spi.c ispi->swseq_erase ? 'S' : 'H'); ispi 242 drivers/mtd/spi-nor/intel-spi.c static int intel_spi_read_block(struct intel_spi *ispi, void *buf, size_t size) ispi 252 drivers/mtd/spi-nor/intel-spi.c memcpy_fromio(buf, ispi->base + FDATA(i), bytes); ispi 262 drivers/mtd/spi-nor/intel-spi.c static int intel_spi_write_block(struct intel_spi *ispi, const void *buf, ispi 273 drivers/mtd/spi-nor/intel-spi.c memcpy_toio(ispi->base + FDATA(i), buf, bytes); ispi 282 drivers/mtd/spi-nor/intel-spi.c static int intel_spi_wait_hw_busy(struct intel_spi *ispi) ispi 286 drivers/mtd/spi-nor/intel-spi.c return readl_poll_timeout(ispi->base + HSFSTS_CTL, val, ispi 291 drivers/mtd/spi-nor/intel-spi.c static int intel_spi_wait_sw_busy(struct intel_spi *ispi) ispi 295 drivers/mtd/spi-nor/intel-spi.c return readl_poll_timeout(ispi->sregs + SSFSTS_CTL, val, ispi 300 drivers/mtd/spi-nor/intel-spi.c static int intel_spi_init(struct intel_spi *ispi) ispi 305 drivers/mtd/spi-nor/intel-spi.c switch (ispi->info->type) { ispi 307 drivers/mtd/spi-nor/intel-spi.c ispi->sregs = ispi->base + BYT_SSFSTS_CTL; ispi 308 drivers/mtd/spi-nor/intel-spi.c ispi->pregs = ispi->base + BYT_PR; ispi 309 drivers/mtd/spi-nor/intel-spi.c ispi->nregions = BYT_FREG_NUM; ispi 310 drivers/mtd/spi-nor/intel-spi.c ispi->pr_num = BYT_PR_NUM; ispi 311 drivers/mtd/spi-nor/intel-spi.c ispi->swseq_reg = true; ispi 315 drivers/mtd/spi-nor/intel-spi.c val = readl(ispi->base + BYT_BCR); ispi 318 drivers/mtd/spi-nor/intel-spi.c writel(val, ispi->base + BYT_BCR); ispi 319 drivers/mtd/spi-nor/intel-spi.c val = readl(ispi->base + BYT_BCR); ispi 322 drivers/mtd/spi-nor/intel-spi.c ispi->writeable = !!(val & BYT_BCR_WPD); ispi 328 drivers/mtd/spi-nor/intel-spi.c ispi->sregs = ispi->base + LPT_SSFSTS_CTL; ispi 329 drivers/mtd/spi-nor/intel-spi.c ispi->pregs = ispi->base + LPT_PR; ispi 330 drivers/mtd/spi-nor/intel-spi.c ispi->nregions = LPT_FREG_NUM; ispi 331 drivers/mtd/spi-nor/intel-spi.c ispi->pr_num = LPT_PR_NUM; ispi 332 drivers/mtd/spi-nor/intel-spi.c ispi->swseq_reg = true; ispi 336 drivers/mtd/spi-nor/intel-spi.c ispi->sregs = ispi->base + BXT_SSFSTS_CTL; ispi 337 drivers/mtd/spi-nor/intel-spi.c ispi->pregs = ispi->base + BXT_PR; ispi 338 drivers/mtd/spi-nor/intel-spi.c ispi->nregions = BXT_FREG_NUM; ispi 339 drivers/mtd/spi-nor/intel-spi.c ispi->pr_num = BXT_PR_NUM; ispi 340 drivers/mtd/spi-nor/intel-spi.c ispi->erase_64k = true; ispi 348 drivers/mtd/spi-nor/intel-spi.c val = readl(ispi->base + HSFSTS_CTL); ispi 350 drivers/mtd/spi-nor/intel-spi.c writel(val, ispi->base + HSFSTS_CTL); ispi 360 drivers/mtd/spi-nor/intel-spi.c lvscc = readl(ispi->base + LVSCC); ispi 361 drivers/mtd/spi-nor/intel-spi.c uvscc = readl(ispi->base + UVSCC); ispi 363 drivers/mtd/spi-nor/intel-spi.c ispi->swseq_erase = true; ispi 365 drivers/mtd/spi-nor/intel-spi.c if (ispi->info->type == INTEL_SPI_BXT && !ispi->swseq_erase) ispi 368 drivers/mtd/spi-nor/intel-spi.c ispi->erase_64k = false; ispi 375 drivers/mtd/spi-nor/intel-spi.c if (ispi->swseq_reg) { ispi 377 drivers/mtd/spi-nor/intel-spi.c val = readl(ispi->sregs + SSFSTS_CTL); ispi 379 drivers/mtd/spi-nor/intel-spi.c writel(val, ispi->sregs + SSFSTS_CTL); ispi 383 drivers/mtd/spi-nor/intel-spi.c val = readl(ispi->base + HSFSTS_CTL); ispi 384 drivers/mtd/spi-nor/intel-spi.c ispi->locked = !!(val & HSFSTS_CTL_FLOCKDN); ispi 386 drivers/mtd/spi-nor/intel-spi.c if (ispi->locked) { ispi 392 drivers/mtd/spi-nor/intel-spi.c opmenu0 = readl(ispi->sregs + OPMENU0); ispi 393 drivers/mtd/spi-nor/intel-spi.c opmenu1 = readl(ispi->sregs + OPMENU1); ispi 396 drivers/mtd/spi-nor/intel-spi.c for (i = 0; i < ARRAY_SIZE(ispi->opcodes) / 2; i++) { ispi 397 drivers/mtd/spi-nor/intel-spi.c ispi->opcodes[i] = opmenu0 >> i * 8; ispi 398 drivers/mtd/spi-nor/intel-spi.c ispi->opcodes[i + 4] = opmenu1 >> i * 8; ispi 403 drivers/mtd/spi-nor/intel-spi.c intel_spi_dump_regs(ispi); ispi 408 drivers/mtd/spi-nor/intel-spi.c static int intel_spi_opcode_index(struct intel_spi *ispi, u8 opcode, int optype) ispi 413 drivers/mtd/spi-nor/intel-spi.c if (ispi->locked) { ispi 414 drivers/mtd/spi-nor/intel-spi.c for (i = 0; i < ARRAY_SIZE(ispi->opcodes); i++) ispi 415 drivers/mtd/spi-nor/intel-spi.c if (ispi->opcodes[i] == opcode) ispi 422 drivers/mtd/spi-nor/intel-spi.c writel(opcode, ispi->sregs + OPMENU0); ispi 423 drivers/mtd/spi-nor/intel-spi.c preop = readw(ispi->sregs + PREOP_OPTYPE); ispi 424 drivers/mtd/spi-nor/intel-spi.c writel(optype << 16 | preop, ispi->sregs + PREOP_OPTYPE); ispi 429 drivers/mtd/spi-nor/intel-spi.c static int intel_spi_hw_cycle(struct intel_spi *ispi, u8 opcode, int len) ispi 434 drivers/mtd/spi-nor/intel-spi.c val = readl(ispi->base + HSFSTS_CTL); ispi 457 drivers/mtd/spi-nor/intel-spi.c writel(val, ispi->base + HSFSTS_CTL); ispi 459 drivers/mtd/spi-nor/intel-spi.c ret = intel_spi_wait_hw_busy(ispi); ispi 463 drivers/mtd/spi-nor/intel-spi.c status = readl(ispi->base + HSFSTS_CTL); ispi 472 drivers/mtd/spi-nor/intel-spi.c static int intel_spi_sw_cycle(struct intel_spi *ispi, u8 opcode, int len, ispi 479 drivers/mtd/spi-nor/intel-spi.c ret = intel_spi_opcode_index(ispi, opcode, optype); ispi 490 drivers/mtd/spi-nor/intel-spi.c atomic_preopcode = ispi->atomic_preopcode; ispi 491 drivers/mtd/spi-nor/intel-spi.c ispi->atomic_preopcode = 0; ispi 506 drivers/mtd/spi-nor/intel-spi.c preop = readw(ispi->sregs + PREOP_OPTYPE); ispi 523 drivers/mtd/spi-nor/intel-spi.c writel(val, ispi->sregs + SSFSTS_CTL); ispi 525 drivers/mtd/spi-nor/intel-spi.c ret = intel_spi_wait_sw_busy(ispi); ispi 529 drivers/mtd/spi-nor/intel-spi.c status = readl(ispi->sregs + SSFSTS_CTL); ispi 540 drivers/mtd/spi-nor/intel-spi.c struct intel_spi *ispi = nor->priv; ispi 544 drivers/mtd/spi-nor/intel-spi.c writel(0, ispi->base + FADDR); ispi 546 drivers/mtd/spi-nor/intel-spi.c if (ispi->swseq_reg) ispi 547 drivers/mtd/spi-nor/intel-spi.c ret = intel_spi_sw_cycle(ispi, opcode, len, ispi 550 drivers/mtd/spi-nor/intel-spi.c ret = intel_spi_hw_cycle(ispi, opcode, len); ispi 555 drivers/mtd/spi-nor/intel-spi.c return intel_spi_read_block(ispi, buf, len); ispi 560 drivers/mtd/spi-nor/intel-spi.c struct intel_spi *ispi = nor->priv; ispi 575 drivers/mtd/spi-nor/intel-spi.c if (!ispi->swseq_reg) ispi 578 drivers/mtd/spi-nor/intel-spi.c preop = readw(ispi->sregs + PREOP_OPTYPE); ispi 580 drivers/mtd/spi-nor/intel-spi.c if (ispi->locked) ispi 582 drivers/mtd/spi-nor/intel-spi.c writel(opcode, ispi->sregs + PREOP_OPTYPE); ispi 589 drivers/mtd/spi-nor/intel-spi.c ispi->atomic_preopcode = opcode; ispi 593 drivers/mtd/spi-nor/intel-spi.c writel(0, ispi->base + FADDR); ispi 596 drivers/mtd/spi-nor/intel-spi.c ret = intel_spi_write_block(ispi, buf, len); ispi 600 drivers/mtd/spi-nor/intel-spi.c if (ispi->swseq_reg) ispi 601 drivers/mtd/spi-nor/intel-spi.c return intel_spi_sw_cycle(ispi, opcode, len, ispi 603 drivers/mtd/spi-nor/intel-spi.c return intel_spi_hw_cycle(ispi, opcode, len); ispi 609 drivers/mtd/spi-nor/intel-spi.c struct intel_spi *ispi = nor->priv; ispi 618 drivers/mtd/spi-nor/intel-spi.c if (WARN_ON_ONCE(ispi->atomic_preopcode)) ispi 619 drivers/mtd/spi-nor/intel-spi.c ispi->atomic_preopcode = 0; ispi 638 drivers/mtd/spi-nor/intel-spi.c writel(from, ispi->base + FADDR); ispi 640 drivers/mtd/spi-nor/intel-spi.c val = readl(ispi->base + HSFSTS_CTL); ispi 646 drivers/mtd/spi-nor/intel-spi.c writel(val, ispi->base + HSFSTS_CTL); ispi 648 drivers/mtd/spi-nor/intel-spi.c ret = intel_spi_wait_hw_busy(ispi); ispi 652 drivers/mtd/spi-nor/intel-spi.c status = readl(ispi->base + HSFSTS_CTL); ispi 659 drivers/mtd/spi-nor/intel-spi.c dev_err(ispi->dev, "read error: %llx: %#x\n", from, ispi 664 drivers/mtd/spi-nor/intel-spi.c ret = intel_spi_read_block(ispi, read_buf, block_size); ispi 680 drivers/mtd/spi-nor/intel-spi.c struct intel_spi *ispi = nor->priv; ispi 686 drivers/mtd/spi-nor/intel-spi.c ispi->atomic_preopcode = 0; ispi 695 drivers/mtd/spi-nor/intel-spi.c writel(to, ispi->base + FADDR); ispi 697 drivers/mtd/spi-nor/intel-spi.c val = readl(ispi->base + HSFSTS_CTL); ispi 703 drivers/mtd/spi-nor/intel-spi.c ret = intel_spi_write_block(ispi, write_buf, block_size); ispi 705 drivers/mtd/spi-nor/intel-spi.c dev_err(ispi->dev, "failed to write block\n"); ispi 711 drivers/mtd/spi-nor/intel-spi.c writel(val, ispi->base + HSFSTS_CTL); ispi 713 drivers/mtd/spi-nor/intel-spi.c ret = intel_spi_wait_hw_busy(ispi); ispi 715 drivers/mtd/spi-nor/intel-spi.c dev_err(ispi->dev, "timeout\n"); ispi 719 drivers/mtd/spi-nor/intel-spi.c status = readl(ispi->base + HSFSTS_CTL); ispi 726 drivers/mtd/spi-nor/intel-spi.c dev_err(ispi->dev, "write error: %llx: %#x\n", to, ispi 743 drivers/mtd/spi-nor/intel-spi.c struct intel_spi *ispi = nor->priv; ispi 748 drivers/mtd/spi-nor/intel-spi.c if (len >= SZ_64K && ispi->erase_64k) { ispi 756 drivers/mtd/spi-nor/intel-spi.c if (ispi->swseq_erase) { ispi 758 drivers/mtd/spi-nor/intel-spi.c writel(offs, ispi->base + FADDR); ispi 760 drivers/mtd/spi-nor/intel-spi.c ret = intel_spi_sw_cycle(ispi, nor->erase_opcode, ispi 773 drivers/mtd/spi-nor/intel-spi.c ispi->atomic_preopcode = 0; ispi 776 drivers/mtd/spi-nor/intel-spi.c writel(offs, ispi->base + FADDR); ispi 778 drivers/mtd/spi-nor/intel-spi.c val = readl(ispi->base + HSFSTS_CTL); ispi 783 drivers/mtd/spi-nor/intel-spi.c writel(val, ispi->base + HSFSTS_CTL); ispi 785 drivers/mtd/spi-nor/intel-spi.c ret = intel_spi_wait_hw_busy(ispi); ispi 789 drivers/mtd/spi-nor/intel-spi.c status = readl(ispi->base + HSFSTS_CTL); ispi 802 drivers/mtd/spi-nor/intel-spi.c static bool intel_spi_is_protected(const struct intel_spi *ispi, ispi 807 drivers/mtd/spi-nor/intel-spi.c for (i = 0; i < ispi->pr_num; i++) { ispi 810 drivers/mtd/spi-nor/intel-spi.c pr_value = readl(ispi->pregs + PR(i)); ispi 828 drivers/mtd/spi-nor/intel-spi.c static void intel_spi_fill_partition(struct intel_spi *ispi, ispi 844 drivers/mtd/spi-nor/intel-spi.c for (i = 1; i < ispi->nregions; i++) { ispi 847 drivers/mtd/spi-nor/intel-spi.c region = readl(ispi->base + FREG(i)); ispi 858 drivers/mtd/spi-nor/intel-spi.c if (intel_spi_is_protected(ispi, base, limit)) ispi 859 drivers/mtd/spi-nor/intel-spi.c ispi->writeable = false; ispi 876 drivers/mtd/spi-nor/intel-spi.c struct intel_spi *ispi; ispi 882 drivers/mtd/spi-nor/intel-spi.c ispi = devm_kzalloc(dev, sizeof(*ispi), GFP_KERNEL); ispi 883 drivers/mtd/spi-nor/intel-spi.c if (!ispi) ispi 886 drivers/mtd/spi-nor/intel-spi.c ispi->base = devm_ioremap_resource(dev, mem); ispi 887 drivers/mtd/spi-nor/intel-spi.c if (IS_ERR(ispi->base)) ispi 888 drivers/mtd/spi-nor/intel-spi.c return ERR_CAST(ispi->base); ispi 890 drivers/mtd/spi-nor/intel-spi.c ispi->dev = dev; ispi 891 drivers/mtd/spi-nor/intel-spi.c ispi->info = info; ispi 892 drivers/mtd/spi-nor/intel-spi.c ispi->writeable = info->writeable; ispi 894 drivers/mtd/spi-nor/intel-spi.c ret = intel_spi_init(ispi); ispi 898 drivers/mtd/spi-nor/intel-spi.c ispi->nor.dev = ispi->dev; ispi 899 drivers/mtd/spi-nor/intel-spi.c ispi->nor.priv = ispi; ispi 900 drivers/mtd/spi-nor/intel-spi.c ispi->nor.read_reg = intel_spi_read_reg; ispi 901 drivers/mtd/spi-nor/intel-spi.c ispi->nor.write_reg = intel_spi_write_reg; ispi 902 drivers/mtd/spi-nor/intel-spi.c ispi->nor.read = intel_spi_read; ispi 903 drivers/mtd/spi-nor/intel-spi.c ispi->nor.write = intel_spi_write; ispi 904 drivers/mtd/spi-nor/intel-spi.c ispi->nor.erase = intel_spi_erase; ispi 906 drivers/mtd/spi-nor/intel-spi.c ret = spi_nor_scan(&ispi->nor, NULL, &hwcaps); ispi 912 drivers/mtd/spi-nor/intel-spi.c intel_spi_fill_partition(ispi, &part); ispi 915 drivers/mtd/spi-nor/intel-spi.c if (!ispi->writeable || !writeable) ispi 916 drivers/mtd/spi-nor/intel-spi.c ispi->nor.mtd.flags &= ~MTD_WRITEABLE; ispi 918 drivers/mtd/spi-nor/intel-spi.c ret = mtd_device_register(&ispi->nor.mtd, &part, 1); ispi 922 drivers/mtd/spi-nor/intel-spi.c return ispi; ispi 926 drivers/mtd/spi-nor/intel-spi.c int intel_spi_remove(struct intel_spi *ispi) ispi 928 drivers/mtd/spi-nor/intel-spi.c return mtd_device_unregister(&ispi->nor.mtd); ispi 19 drivers/mtd/spi-nor/intel-spi.h int intel_spi_remove(struct intel_spi *ispi);