Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

spi: npcm-fiu: add Arbel NPCM8XX support

Merge series from Tomer Maimon <tmaimon77@gmail.com>:

This patch set adds Arbel NPCM8XX Flash Interface Unit (FIU) support to FIU NPCM
driver and modify direct read dummy configuration.

NPCM8XX FIU supports four controllers.

The NPCM FIU driver tested on NPCM845 evaluation board.

+38 -3
+12 -1
Documentation/devicetree/bindings/spi/nuvoton,npcm-fiu.txt
··· 6 6 FIU0 and FIUx supports two chip selects, 7 7 FIU3 support four chip select. 8 8 9 + The NPCM8XX supports four FIU modules, 10 + FIU0 and FIUx supports two chip selects, 11 + FIU1 and FIU3 supports four chip selects. 12 + 9 13 Required properties: 10 - - compatible : "nuvoton,npcm750-fiu" for the NPCM7XX BMC 14 + - compatible : "nuvoton,npcm750-fiu" for Poleg NPCM7XX BMC 15 + "nuvoton,npcm845-fiu" for Arbel NPCM8XX BMC 11 16 - #address-cells : should be 1. 12 17 - #size-cells : should be 0. 13 18 - reg : the first contains the register location and length, ··· 34 29 fiu0 represent fiu 0 controller 35 30 fiu1 represent fiu 3 controller 36 31 fiu2 represent fiu x controller 32 + 33 + In the NPCM8XX BMC: 34 + fiu0 represent fiu 0 controller 35 + fiu1 represent fiu 1 controller 36 + fiu2 represent fiu 3 controller 37 + fiu3 represent fiu x controller 37 38 38 39 Example: 39 40 fiu3: spi@c00000000 {
+26 -2
drivers/spi/spi-npcm-fiu.c
··· 36 36 #define NPCM_FIU_UMA_DR1 0x34 37 37 #define NPCM_FIU_UMA_DR2 0x38 38 38 #define NPCM_FIU_UMA_DR3 0x3C 39 + #define NPCM_FIU_CFG 0x78 39 40 #define NPCM_FIU_MAX_REG_LIMIT 0x80 40 41 41 42 /* FIU Direct Read Configuration Register */ ··· 152 151 #define NPCM_FIU_UMA_DR3_RB13 GENMASK(15, 8) 153 152 #define NPCM_FIU_UMA_DR3_RB12 GENMASK(7, 0) 154 153 154 + /* FIU Configuration Register */ 155 + #define NPCM_FIU_CFG_FIU_FIX BIT(31) 156 + 155 157 /* FIU Read Mode */ 156 158 enum { 157 159 DRD_SINGLE_WIRE_MODE = 0, ··· 191 187 FIU0 = 0, 192 188 FIU3, 193 189 FIUX, 190 + FIU1, 194 191 }; 195 192 196 193 struct npcm_fiu_info { ··· 217 212 static const struct fiu_data npcm7xx_fiu_data = { 218 213 .npcm_fiu_data_info = npcm7xx_fiu_info, 219 214 .fiu_max = 3, 215 + }; 216 + 217 + static const struct npcm_fiu_info npxm8xx_fiu_info[] = { 218 + {.name = "FIU0", .fiu_id = FIU0, 219 + .max_map_size = MAP_SIZE_128MB, .max_cs = 2}, 220 + {.name = "FIU3", .fiu_id = FIU3, 221 + .max_map_size = MAP_SIZE_128MB, .max_cs = 4}, 222 + {.name = "FIUX", .fiu_id = FIUX, 223 + .max_map_size = MAP_SIZE_16MB, .max_cs = 2}, 224 + {.name = "FIU1", .fiu_id = FIU1, 225 + .max_map_size = MAP_SIZE_16MB, .max_cs = 4} }; 226 + 227 + static const struct fiu_data npxm8xx_fiu_data = { 228 + .npcm_fiu_data_info = npxm8xx_fiu_info, 229 + .fiu_max = 4, 220 230 }; 221 231 222 232 struct npcm_fiu_spi; ··· 272 252 fiu->drd_op.addr.buswidth = op->addr.buswidth; 273 253 regmap_update_bits(fiu->regmap, NPCM_FIU_DRD_CFG, 274 254 NPCM_FIU_DRD_CFG_DBW, 275 - ((op->dummy.nbytes * ilog2(op->addr.buswidth)) / BITS_PER_BYTE) 276 - << NPCM_FIU_DRD_DBW_SHIFT); 255 + op->dummy.nbytes << NPCM_FIU_DRD_DBW_SHIFT); 277 256 fiu->drd_op.dummy.nbytes = op->dummy.nbytes; 278 257 regmap_update_bits(fiu->regmap, NPCM_FIU_DRD_CFG, 279 258 NPCM_FIU_DRD_CFG_RDCMD, op->cmd.opcode); ··· 644 625 regmap_update_bits(gcr_regmap, NPCM7XX_INTCR3_OFFSET, 645 626 NPCM7XX_INTCR3_FIU_FIX, 646 627 NPCM7XX_INTCR3_FIU_FIX); 628 + } else { 629 + regmap_update_bits(fiu->regmap, NPCM_FIU_CFG, 630 + NPCM_FIU_CFG_FIU_FIX, 631 + NPCM_FIU_CFG_FIU_FIX); 647 632 } 648 633 649 634 if (desc->info.op_tmpl.data.dir == SPI_MEM_DATA_IN) { ··· 688 665 689 666 static const struct of_device_id npcm_fiu_dt_ids[] = { 690 667 { .compatible = "nuvoton,npcm750-fiu", .data = &npcm7xx_fiu_data }, 668 + { .compatible = "nuvoton,npcm845-fiu", .data = &npxm8xx_fiu_data }, 691 669 { /* sentinel */ } 692 670 }; 693 671