405-mtd-spi-nor-Add-support-for-BoHong-bh25q128as.patch 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. From 52d14545d2fc276b1bf9ccf48d4612fab6edfb6a Mon Sep 17 00:00:00 2001
  2. From: David Bauer <[email protected]>
  3. Date: Thu, 6 May 2021 17:49:55 +0200
  4. Subject: [PATCH] mtd: spi-nor: Add support for BoHong bh25q128as
  5. Add MTD support for the BoHong bh25q128as SPI NOR chip.
  6. The chip has 16MB of total capacity, divided into a total of 256
  7. sectors, each 64KB sized. The chip also supports 4KB sectors.
  8. Additionally, it supports dual and quad read modes.
  9. Functionality was verified on an Tenbay WR1800K / MTK MT7621 board.
  10. Signed-off-by: David Bauer <[email protected]>
  11. ---
  12. drivers/mtd/spi-nor/Makefile | 1 +
  13. drivers/mtd/spi-nor/bohong.c | 21 +++++++++++++++++++++
  14. drivers/mtd/spi-nor/core.c | 1 +
  15. drivers/mtd/spi-nor/core.h | 1 +
  16. 4 files changed, 24 insertions(+)
  17. create mode 100644 drivers/mtd/spi-nor/bohong.c
  18. --- a/drivers/mtd/spi-nor/Makefile
  19. +++ b/drivers/mtd/spi-nor/Makefile
  20. @@ -2,6 +2,7 @@
  21. spi-nor-objs := core.o sfdp.o swp.o otp.o sysfs.o
  22. spi-nor-objs += atmel.o
  23. +spi-nor-objs += bohong.o
  24. spi-nor-objs += catalyst.o
  25. spi-nor-objs += eon.o
  26. spi-nor-objs += esmt.o
  27. --- /dev/null
  28. +++ b/drivers/mtd/spi-nor/bohong.c
  29. @@ -0,0 +1,21 @@
  30. +// SPDX-License-Identifier: GPL-2.0
  31. +/*
  32. + * Copyright (C) 2005, Intec Automation Inc.
  33. + * Copyright (C) 2014, Freescale Semiconductor, Inc.
  34. + */
  35. +
  36. +#include <linux/mtd/spi-nor.h>
  37. +
  38. +#include "core.h"
  39. +
  40. +static const struct flash_info bohong_parts[] = {
  41. + /* BoHong Microelectronics */
  42. + { "bh25q128as", INFO(0x684018, 0, 64 * 1024, 256)
  43. + NO_SFDP_FLAGS(SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ) },
  44. +};
  45. +
  46. +const struct spi_nor_manufacturer spi_nor_bohong = {
  47. + .name = "bohong",
  48. + .parts = bohong_parts,
  49. + .nparts = ARRAY_SIZE(bohong_parts),
  50. +};
  51. --- a/drivers/mtd/spi-nor/core.c
  52. +++ b/drivers/mtd/spi-nor/core.c
  53. @@ -1620,6 +1620,7 @@ int spi_nor_sr2_bit7_quad_enable(struct
  54. static const struct spi_nor_manufacturer *manufacturers[] = {
  55. &spi_nor_atmel,
  56. + &spi_nor_bohong,
  57. &spi_nor_catalyst,
  58. &spi_nor_eon,
  59. &spi_nor_esmt,
  60. --- a/drivers/mtd/spi-nor/core.h
  61. +++ b/drivers/mtd/spi-nor/core.h
  62. @@ -617,6 +617,7 @@ struct sfdp {
  63. /* Manufacturer drivers. */
  64. extern const struct spi_nor_manufacturer spi_nor_atmel;
  65. +extern const struct spi_nor_manufacturer spi_nor_bohong;
  66. extern const struct spi_nor_manufacturer spi_nor_catalyst;
  67. extern const struct spi_nor_manufacturer spi_nor_eon;
  68. extern const struct spi_nor_manufacturer spi_nor_esmt;