Thread (25 messages) 25 messages, 4 authors, 2020-05-18

Re: [PATCH v4 7/8] mtd: rawnand: arasan: Add new Arasan NAND controller

From: Miquel Raynal <miquel.raynal@bootlin.com>
Date: 2020-05-10 08:54:00

Hi Boris,

Boris Brezillon [off-list ref] wrote on Sun, 10 May
2020 10:41:45 +0200:
On Sun, 10 May 2020 10:35:47 +0200
Miquel Raynal [off-list ref] wrote:
quoted
Hi Boris,

Boris Brezillon [off-list ref] wrote on Sun, 10 May
2020 09:02:30 +0200:
  
quoted
On Fri,  8 May 2020 19:13:38 +0200
Miquel Raynal [off-list ref] wrote:
    
quoted
+static int anfc_len_to_steps(struct nand_chip *chip, unsigned int len)
+{
+	unsigned int steps = 1, pktsize = len;
+
+	while (pktsize > ANFC_MAX_PKT_SIZE) {
+		steps *= 2;
+		pktsize = DIV_ROUND_UP(len, steps);
+	}      

Same here, you shouldn't have a round_up() but instead complain if
"len != pkt_size * steps"

	if (len % 4)
		return -ENOTSUPP;    
This is not possible, we need unaligned accesses for NAND detection.  
Duh, this really calls for a comment saying how wrong this is and how
it should be fixed (discussions we had about data size constraints and
the 'can-issue-more' flag on data_in/out instructions).
Agreed, I'll add a comment there :/
quoted
  
quoted
	if (len < ANFC_MAX_PKT_SIZE)
		return len;

	for (steps = 2; steps < ANFC_MAX_STEPS; steps *= 2) {
		pkt_size = len / steps;
		if (pkt_size <= ANFC_MAX_PKT_SIZE)
			break;
	}

	if (pkt_size * steps != len)
		return -ENOTSUPP;

	return pkt_size;    
The rest looks fine, I will change it and also add these checks in  
->exec_op() check_nonly path.    
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help