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