hc
2024-10-22 8ac6c7a54ed1b98d142dce24b11c6de6a1e239a5
kernel/drivers/mtd/lpddr/lpddr_cmds.c
....@@ -1,3 +1,4 @@
1
+// SPDX-License-Identifier: GPL-2.0-or-later
12 /*
23 * LPDDR flash memory device operations. This module provides read, write,
34 * erase, lock/unlock support for LPDDR flash memories
....@@ -5,20 +6,6 @@
56 * (C) 2008 Vasiliy Leonenko <vasiliy.leonenko@gmail.com>
67 * Many thanks to Roman Borisov for initial enabling
78 *
8
- * This program is free software; you can redistribute it and/or
9
- * modify it under the terms of the GNU General Public License
10
- * as published by the Free Software Foundation; either version 2
11
- * of the License, or (at your option) any later version.
12
- *
13
- * This program is distributed in the hope that it will be useful,
14
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
15
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16
- * GNU General Public License for more details.
17
- *
18
- * You should have received a copy of the GNU General Public License
19
- * along with this program; if not, write to the Free Software
20
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
21
- * 02110-1301, USA.
229 * TODO:
2310 * Implement VPP management
2411 * Implement XIP support
....@@ -106,6 +93,34 @@
10693 return mtd;
10794 }
10895 EXPORT_SYMBOL(lpddr_cmdset);
96
+
97
+static void print_drs_error(unsigned int dsr)
98
+{
99
+ int prog_status = (dsr & DSR_RPS) >> 8;
100
+
101
+ if (!(dsr & DSR_AVAILABLE))
102
+ pr_notice("DSR.15: (0) Device not Available\n");
103
+ if ((prog_status & 0x03) == 0x03)
104
+ pr_notice("DSR.9,8: (11) Attempt to program invalid half with 41h command\n");
105
+ else if (prog_status & 0x02)
106
+ pr_notice("DSR.9,8: (10) Object Mode Program attempt in region with Control Mode data\n");
107
+ else if (prog_status & 0x01)
108
+ pr_notice("DSR.9,8: (01) Program attempt in region with Object Mode data\n");
109
+ if (!(dsr & DSR_READY_STATUS))
110
+ pr_notice("DSR.7: (0) Device is Busy\n");
111
+ if (dsr & DSR_ESS)
112
+ pr_notice("DSR.6: (1) Erase Suspended\n");
113
+ if (dsr & DSR_ERASE_STATUS)
114
+ pr_notice("DSR.5: (1) Erase/Blank check error\n");
115
+ if (dsr & DSR_PROGRAM_STATUS)
116
+ pr_notice("DSR.4: (1) Program Error\n");
117
+ if (dsr & DSR_VPPS)
118
+ pr_notice("DSR.3: (1) Vpp low detect, operation aborted\n");
119
+ if (dsr & DSR_PSS)
120
+ pr_notice("DSR.2: (1) Program suspended\n");
121
+ if (dsr & DSR_DPS)
122
+ pr_notice("DSR.1: (1) Aborted Erase/Program attempt on locked block\n");
123
+}
109124
110125 static int wait_for_ready(struct map_info *map, struct flchip *chip,
111126 unsigned int chip_op_time)
....@@ -317,7 +332,7 @@
317332 /* Only if there's no operation suspended... */
318333 if (mode == FL_READY && chip->oldstate == FL_READY)
319334 return 0;
320
-
335
+ fallthrough;
321336 default:
322337 sleep:
323338 set_current_state(TASK_UNINTERRUPTIBLE);