11// SPDX-License-Identifier: GPL-2.0-or-later
22/*
3- * at25.c -- support most SPI EEPROMs, such as Atmel AT25 models
4- * and Cypress FRAMs FM25 models
3+ * Driver for most of the SPI EEPROMs, such as Atmel AT25 models
4+ * and Cypress FRAMs FM25 models.
55 *
66 * Copyright (C) 2006 David Brownell
77 */
2121#include <linux/nvmem-provider.h>
2222
2323/*
24- * NOTE: this is an *EEPROM* driver. The vagaries of product naming
24+ * NOTE: this is an *EEPROM* driver. The vagaries of product naming
2525 * mean that some AT25 products are EEPROMs, and others are FLASH.
2626 * Handle FLASH chips with the drivers/mtd/devices/m25p80.c driver,
2727 * not this one!
@@ -57,13 +57,14 @@ struct at25_data {
5757#define AT25_SR_BP1 0x08
5858#define AT25_SR_WPEN 0x80 /* writeprotect enable */
5959
60- #define AT25_INSTR_BIT3 0x08 /* Additional address bit in instr */
60+ #define AT25_INSTR_BIT3 0x08 /* additional address bit in instr */
6161
6262#define FM25_ID_LEN 9 /* ID length */
6363
6464#define EE_MAXADDRLEN 3 /* 24 bit addresses, up to 2 MBytes */
6565
66- /* Specs often allow 5 msec for a page write, sometimes 20 msec;
66+ /*
67+ * Specs often allow 5ms for a page write, sometimes 20ms;
6768 * it's important to recover from write timeouts.
6869 */
6970#define EE_TIMEOUT 25
@@ -108,7 +109,7 @@ static int at25_ee_read(void *priv, unsigned int offset,
108109 * cp ++ = offset >> 8 ;
109110 fallthrough ;
110111 case 1 :
111- case 0 : /* can't happen: for better codegen */
112+ case 0 : /* can't happen: for better code generation */
112113 * cp ++ = offset >> 0 ;
113114 }
114115
@@ -125,11 +126,12 @@ static int at25_ee_read(void *priv, unsigned int offset,
125126
126127 mutex_lock (& at25 -> lock );
127128
128- /* Read it all at once.
129+ /*
130+ * Read it all at once.
129131 *
130132 * REVISIT that's potentially a problem with large chips, if
131133 * other devices on the bus need to be accessed regularly or
132- * this chip is clocked very slowly
134+ * this chip is clocked very slowly.
133135 */
134136 status = spi_sync (at25 -> spi , & m );
135137 dev_dbg (& at25 -> spi -> dev , "read %zu bytes at %d --> %zd\n" ,
@@ -139,9 +141,7 @@ static int at25_ee_read(void *priv, unsigned int offset,
139141 return status ;
140142}
141143
142- /*
143- * read extra registers as ID or serial number
144- */
144+ /* Read extra registers as ID or serial number */
145145static int fm25_aux_read (struct at25_data * at25 , u8 * buf , uint8_t command ,
146146 int len )
147147{
@@ -207,7 +207,8 @@ static int at25_ee_write(void *priv, unsigned int off, void *val, size_t count)
207207 if (!bounce )
208208 return - ENOMEM ;
209209
210- /* For write, rollover is within the page ... so we write at
210+ /*
211+ * For write, rollover is within the page ... so we write at
211212 * most one page, then manually roll over to the next page.
212213 */
213214 mutex_lock (& at25 -> lock );
@@ -241,7 +242,7 @@ static int at25_ee_write(void *priv, unsigned int off, void *val, size_t count)
241242 * cp ++ = offset >> 8 ;
242243 fallthrough ;
243244 case 1 :
244- case 0 : /* can't happen: for better codegen */
245+ case 0 : /* can't happen: for better code generation */
245246 * cp ++ = offset >> 0 ;
246247 }
247248
@@ -257,8 +258,9 @@ static int at25_ee_write(void *priv, unsigned int off, void *val, size_t count)
257258 if (status < 0 )
258259 break ;
259260
260- /* REVISIT this should detect (or prevent) failed writes
261- * to readonly sections of the EEPROM...
261+ /*
262+ * REVISIT this should detect (or prevent) failed writes
263+ * to read-only sections of the EEPROM...
262264 */
263265
264266 /* Wait for non-busy status */
@@ -427,8 +429,9 @@ static int at25_probe(struct spi_device *spi)
427429 else
428430 is_fram = false;
429431
430- /* Ping the chip ... the status register is pretty portable,
431- * unlike probing manufacturer IDs. We do expect that system
432+ /*
433+ * Ping the chip ... the status register is pretty portable,
434+ * unlike probing manufacturer IDs. We do expect that system
432435 * firmware didn't write it in the past few milliseconds!
433436 */
434437 sr = spi_w8r8 (spi , AT25_RDSR );
0 commit comments