Re: [PATCH v1 2/2] mtd: spi-nor: add NPCM FIU controller driver

2018-12-12 Thread kbuild test robot
Hi Tomer,

I love your patch! Yet something to improve:

[auto build test ERROR on mtd/spi-nor/next]
[also build test ERROR on v4.20-rc6 next-20181212]
[if your patch is applied to the wrong git tree, please drop us a note to help 
improve the system]

url:
https://github.com/0day-ci/linux/commits/Tomer-Maimon/dt-binding-mtd-add-NPCM-FIU-controller/20181203-201804
base:   git://git.infradead.org/linux-mtd.git spi-nor/next
config: x86_64-allmodconfig (attached as .config)
compiler: gcc-7 (Debian 7.3.0-1) 7.3.0
reproduce:
# save the attached .config to linux build tree
make ARCH=x86_64 

All errors (new ones prefixed by >>):

>> drivers/mtd/spi-nor/npcm-fiu.c:25:11: error: unable to open 'asm/sizes.h'

vim +25 drivers/mtd/spi-nor/npcm-fiu.c

24  
  > 25  #include 
26  #include 
27  

---
0-DAY kernel test infrastructureOpen Source Technology Center
https://lists.01.org/pipermail/kbuild-all   Intel Corporation


.config.gz
Description: application/gzip


Re: [PATCH v1 2/2] mtd: spi-nor: add NPCM FIU controller driver

2018-12-03 Thread kbuild test robot
Hi Tomer,

I love your patch! Yet something to improve:

[auto build test ERROR on mtd/spi-nor/next]
[also build test ERROR on v4.20-rc5 next-20181203]
[if your patch is applied to the wrong git tree, please drop us a note to help 
improve the system]

url:
https://github.com/0day-ci/linux/commits/Tomer-Maimon/dt-binding-mtd-add-NPCM-FIU-controller/20181203-201804
base:   git://git.infradead.org/linux-mtd.git spi-nor/next
config: i386-allmodconfig (attached as .config)
compiler: gcc-7 (Debian 7.3.0-1) 7.3.0
reproduce:
# save the attached .config to linux build tree
make ARCH=i386 

All errors (new ones prefixed by >>):

>> drivers/mtd/spi-nor/npcm-fiu.c:25:10: fatal error: asm/sizes.h: No such file 
>> or directory
#include 
 ^
   compilation terminated.

vim +25 drivers/mtd/spi-nor/npcm-fiu.c

24  
  > 25  #include 
26  #include 
27  

---
0-DAY kernel test infrastructureOpen Source Technology Center
https://lists.01.org/pipermail/kbuild-all   Intel Corporation


.config.gz
Description: application/gzip


Re: [PATCH v1 2/2] mtd: spi-nor: add NPCM FIU controller driver

2018-12-03 Thread kbuild test robot
Hi Tomer,

I love your patch! Yet something to improve:

[auto build test ERROR on mtd/spi-nor/next]
[also build test ERROR on v4.20-rc5 next-20181203]
[if your patch is applied to the wrong git tree, please drop us a note to help 
improve the system]

url:
https://github.com/0day-ci/linux/commits/Tomer-Maimon/dt-binding-mtd-add-NPCM-FIU-controller/20181203-201804
base:   git://git.infradead.org/linux-mtd.git spi-nor/next
config: i386-allmodconfig (attached as .config)
compiler: gcc-7 (Debian 7.3.0-1) 7.3.0
reproduce:
# save the attached .config to linux build tree
make ARCH=i386 

All errors (new ones prefixed by >>):

>> drivers/mtd/spi-nor/npcm-fiu.c:25:10: fatal error: asm/sizes.h: No such file 
>> or directory
#include 
 ^
   compilation terminated.

vim +25 drivers/mtd/spi-nor/npcm-fiu.c

24  
  > 25  #include 
26  #include 
27  

---
0-DAY kernel test infrastructureOpen Source Technology Center
https://lists.01.org/pipermail/kbuild-all   Intel Corporation


.config.gz
Description: application/gzip


[PATCH v1 2/2] mtd: spi-nor: add NPCM FIU controller driver

2018-12-03 Thread Tomer Maimon
Add Nuvoton NPCM BMC Flash Interface Unit(FIU) SPI-NOR
controller driver

The FIU supports single, dual or quad communication interface.

the FIU controller can operate in following modes:
- User Mode Access(UMA): provides flash access by using an
  indirect address/data mechanism.
- direct rd/wr mode: maps the flash memory into the core
  address space.
- SPI-X mode: used for an expansion bus to an ASIC or CPLD.

Signed-off-by: Tomer Maimon 
---
 drivers/mtd/spi-nor/Kconfig|   8 +
 drivers/mtd/spi-nor/Makefile   |   1 +
 drivers/mtd/spi-nor/npcm-fiu.c | 930 +
 3 files changed, 939 insertions(+)
 create mode 100644 drivers/mtd/spi-nor/npcm-fiu.c

diff --git a/drivers/mtd/spi-nor/Kconfig b/drivers/mtd/spi-nor/Kconfig
index 6cc9c929ff57..e3451637240a 100644
--- a/drivers/mtd/spi-nor/Kconfig
+++ b/drivers/mtd/spi-nor/Kconfig
@@ -75,6 +75,14 @@ config SPI_HISI_SFC
help
  This enables support for hisilicon SPI-NOR flash controller.
 
+config SPI_NPCM_FIU
+   tristate "NPCM FLASH Interface unit(FIU) controller "
+   depends on ARCH_NPCM || COMPILE_TEST
+   help
+ This enables support for the FLASH Interface unit(FIU) controller.
+ This driver does not support generic SPI. The implementation only
+ supports SPI NOR.
+
 config SPI_NXP_SPIFI
tristate "NXP SPI Flash Interface (SPIFI)"
depends on OF && (ARCH_LPC18XX || COMPILE_TEST)
diff --git a/drivers/mtd/spi-nor/Makefile b/drivers/mtd/spi-nor/Makefile
index f4c61d282abd..fe0e2bdef9cd 100644
--- a/drivers/mtd/spi-nor/Makefile
+++ b/drivers/mtd/spi-nor/Makefile
@@ -6,6 +6,7 @@ obj-$(CONFIG_SPI_CADENCE_QUADSPI)   += cadence-quadspi.o
 obj-$(CONFIG_SPI_FSL_QUADSPI)  += fsl-quadspi.o
 obj-$(CONFIG_SPI_HISI_SFC) += hisi-sfc.o
 obj-$(CONFIG_MTD_MT81xx_NOR)+= mtk-quadspi.o
+obj-$(CONFIG_SPI_NPCM_FIU) += npcm-fiu.o
 obj-$(CONFIG_SPI_NXP_SPIFI)+= nxp-spifi.o
 obj-$(CONFIG_SPI_INTEL_SPI)+= intel-spi.o
 obj-$(CONFIG_SPI_INTEL_SPI_PCI)+= intel-spi-pci.o
diff --git a/drivers/mtd/spi-nor/npcm-fiu.c b/drivers/mtd/spi-nor/npcm-fiu.c
new file mode 100644
index ..9b6e7747d678
--- /dev/null
+++ b/drivers/mtd/spi-nor/npcm-fiu.c
@@ -0,0 +1,930 @@
+// SPDX-License-Identifier: GPL-2.0
+// Copyright (c) 2018 Nuvoton Technology corporation.
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include 
+#include 
+
+/* Flash Interface Unit (FIU) Registers */
+#define NPCM_FIU_DRD_CFG   0x00
+#define NPCM_FIU_DWR_CFG   0x04
+#define NPCM_FIU_UMA_CFG   0x08
+#define NPCM_FIU_UMA_CTS   0x0C
+#define NPCM_FIU_UMA_CMD   0x10
+#define NPCM_FIU_UMA_ADDR  0x14
+#define NPCM_FIU_PRT_CFG   0x18
+#define NPCM_FIU_UMA_DW0   0x20
+#define NPCM_FIU_UMA_DW1   0x24
+#define NPCM_FIU_UMA_DW2   0x28
+#define NPCM_FIU_UMA_DW3   0x2C
+#define NPCM_FIU_UMA_DR0   0x30
+#define NPCM_FIU_UMA_DR1   0x34
+#define NPCM_FIU_UMA_DR2   0x38
+#define NPCM_FIU_UMA_DR3   0x3C
+#define NPCM_FIU_MAX_REG_LIMIT 0x80
+
+/* FIU Direct Read Configuration Register */
+#define NPCM_FIU_DRD_CFG_LCK   BIT(31)
+#define NPCM_FIU_DRD_CFG_R_BURST   GENMASK(25, 24)
+#define NPCM_FIU_DRD_CFG_ADDSIZGENMASK(17, 16)
+#define NPCM_FIU_DRD_CFG_DBW   GENMASK(13, 12)
+#define NPCM_FIU_DRD_CFG_ACCTYPE   GENMASK(9, 8)
+#define NPCM_FIU_DRD_CFG_RDCMD GENMASK(7, 0)
+#define NPCM_FIU_DRD_ADDSIZ_SHIFT  16
+#define NPCM_FIU_DRD_DBW_SHIFT 12
+#define NPCM_FIU_DRD_ACCTYPE_SHIFT 8
+
+/* FIU Direct Write Configuration Register */
+#define NPCM_FIU_DWR_CFG_LCK   BIT(31)
+#define NPCM_FIU_DWR_CFG_W_BURST   GENMASK(25, 24)
+#define NPCM_FIU_DWR_CFG_ADDSIZGENMASK(17, 16)
+#define NPCM_FIU_DWR_CFG_ABPCK GENMASK(11, 10)
+#define NPCM_FIU_DWR_CFG_DBPCK GENMASK(9, 8)
+#define NPCM_FIU_DWR_CFG_WRCMD GENMASK(7, 0)
+#define NPCM_FIU_DWR_ADDSIZ_SHIFT  16
+#define NPCM_FIU_DWR_ABPCK_SHIFT   10
+#define NPCM_FIU_DWR_DBPCK_SHIFT   8
+
+/* FIU UMA Configuration Register */
+#define NPCM_FIU_UMA_CFG_LCK   BIT(31)
+#define NPCM_FIU_UMA_CFG_CMMLCKBIT(30)
+#define NPCM_FIU_UMA_CFG_RDATSIZ   GENMASK(28, 24)
+#define NPCM_FIU_UMA_CFG_DBSIZ GENMASK(23, 21)
+#define NPCM_FIU_UMA_CFG_WDATSIZ   GENMASK(20, 16)
+#define NPCM_FIU_UMA_CFG_ADDSIZGENMASK(13, 11)
+#define NPCM_FIU_UMA_CFG_CMDSIZBIT(10)
+#define NPCM_FIU_UMA_CFG_RDBPCKGENMASK(9, 8)
+#define NPCM_FIU_UMA_CFG_DBPCK GENMASK(7, 6)
+#define NPCM_FIU_UMA_CFG_WDBPCKGENMASK(5, 4)

[PATCH v1 2/2] mtd: spi-nor: add NPCM FIU controller driver

2018-12-03 Thread Tomer Maimon
Add Nuvoton NPCM BMC Flash Interface Unit(FIU) SPI-NOR
controller driver

The FIU supports single, dual or quad communication interface.

the FIU controller can operate in following modes:
- User Mode Access(UMA): provides flash access by using an
  indirect address/data mechanism.
- direct rd/wr mode: maps the flash memory into the core
  address space.
- SPI-X mode: used for an expansion bus to an ASIC or CPLD.

Signed-off-by: Tomer Maimon 
---
 drivers/mtd/spi-nor/Kconfig|   8 +
 drivers/mtd/spi-nor/Makefile   |   1 +
 drivers/mtd/spi-nor/npcm-fiu.c | 930 +
 3 files changed, 939 insertions(+)
 create mode 100644 drivers/mtd/spi-nor/npcm-fiu.c

diff --git a/drivers/mtd/spi-nor/Kconfig b/drivers/mtd/spi-nor/Kconfig
index 6cc9c929ff57..e3451637240a 100644
--- a/drivers/mtd/spi-nor/Kconfig
+++ b/drivers/mtd/spi-nor/Kconfig
@@ -75,6 +75,14 @@ config SPI_HISI_SFC
help
  This enables support for hisilicon SPI-NOR flash controller.
 
+config SPI_NPCM_FIU
+   tristate "NPCM FLASH Interface unit(FIU) controller "
+   depends on ARCH_NPCM || COMPILE_TEST
+   help
+ This enables support for the FLASH Interface unit(FIU) controller.
+ This driver does not support generic SPI. The implementation only
+ supports SPI NOR.
+
 config SPI_NXP_SPIFI
tristate "NXP SPI Flash Interface (SPIFI)"
depends on OF && (ARCH_LPC18XX || COMPILE_TEST)
diff --git a/drivers/mtd/spi-nor/Makefile b/drivers/mtd/spi-nor/Makefile
index f4c61d282abd..fe0e2bdef9cd 100644
--- a/drivers/mtd/spi-nor/Makefile
+++ b/drivers/mtd/spi-nor/Makefile
@@ -6,6 +6,7 @@ obj-$(CONFIG_SPI_CADENCE_QUADSPI)   += cadence-quadspi.o
 obj-$(CONFIG_SPI_FSL_QUADSPI)  += fsl-quadspi.o
 obj-$(CONFIG_SPI_HISI_SFC) += hisi-sfc.o
 obj-$(CONFIG_MTD_MT81xx_NOR)+= mtk-quadspi.o
+obj-$(CONFIG_SPI_NPCM_FIU) += npcm-fiu.o
 obj-$(CONFIG_SPI_NXP_SPIFI)+= nxp-spifi.o
 obj-$(CONFIG_SPI_INTEL_SPI)+= intel-spi.o
 obj-$(CONFIG_SPI_INTEL_SPI_PCI)+= intel-spi-pci.o
diff --git a/drivers/mtd/spi-nor/npcm-fiu.c b/drivers/mtd/spi-nor/npcm-fiu.c
new file mode 100644
index ..9b6e7747d678
--- /dev/null
+++ b/drivers/mtd/spi-nor/npcm-fiu.c
@@ -0,0 +1,930 @@
+// SPDX-License-Identifier: GPL-2.0
+// Copyright (c) 2018 Nuvoton Technology corporation.
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include 
+#include 
+
+/* Flash Interface Unit (FIU) Registers */
+#define NPCM_FIU_DRD_CFG   0x00
+#define NPCM_FIU_DWR_CFG   0x04
+#define NPCM_FIU_UMA_CFG   0x08
+#define NPCM_FIU_UMA_CTS   0x0C
+#define NPCM_FIU_UMA_CMD   0x10
+#define NPCM_FIU_UMA_ADDR  0x14
+#define NPCM_FIU_PRT_CFG   0x18
+#define NPCM_FIU_UMA_DW0   0x20
+#define NPCM_FIU_UMA_DW1   0x24
+#define NPCM_FIU_UMA_DW2   0x28
+#define NPCM_FIU_UMA_DW3   0x2C
+#define NPCM_FIU_UMA_DR0   0x30
+#define NPCM_FIU_UMA_DR1   0x34
+#define NPCM_FIU_UMA_DR2   0x38
+#define NPCM_FIU_UMA_DR3   0x3C
+#define NPCM_FIU_MAX_REG_LIMIT 0x80
+
+/* FIU Direct Read Configuration Register */
+#define NPCM_FIU_DRD_CFG_LCK   BIT(31)
+#define NPCM_FIU_DRD_CFG_R_BURST   GENMASK(25, 24)
+#define NPCM_FIU_DRD_CFG_ADDSIZGENMASK(17, 16)
+#define NPCM_FIU_DRD_CFG_DBW   GENMASK(13, 12)
+#define NPCM_FIU_DRD_CFG_ACCTYPE   GENMASK(9, 8)
+#define NPCM_FIU_DRD_CFG_RDCMD GENMASK(7, 0)
+#define NPCM_FIU_DRD_ADDSIZ_SHIFT  16
+#define NPCM_FIU_DRD_DBW_SHIFT 12
+#define NPCM_FIU_DRD_ACCTYPE_SHIFT 8
+
+/* FIU Direct Write Configuration Register */
+#define NPCM_FIU_DWR_CFG_LCK   BIT(31)
+#define NPCM_FIU_DWR_CFG_W_BURST   GENMASK(25, 24)
+#define NPCM_FIU_DWR_CFG_ADDSIZGENMASK(17, 16)
+#define NPCM_FIU_DWR_CFG_ABPCK GENMASK(11, 10)
+#define NPCM_FIU_DWR_CFG_DBPCK GENMASK(9, 8)
+#define NPCM_FIU_DWR_CFG_WRCMD GENMASK(7, 0)
+#define NPCM_FIU_DWR_ADDSIZ_SHIFT  16
+#define NPCM_FIU_DWR_ABPCK_SHIFT   10
+#define NPCM_FIU_DWR_DBPCK_SHIFT   8
+
+/* FIU UMA Configuration Register */
+#define NPCM_FIU_UMA_CFG_LCK   BIT(31)
+#define NPCM_FIU_UMA_CFG_CMMLCKBIT(30)
+#define NPCM_FIU_UMA_CFG_RDATSIZ   GENMASK(28, 24)
+#define NPCM_FIU_UMA_CFG_DBSIZ GENMASK(23, 21)
+#define NPCM_FIU_UMA_CFG_WDATSIZ   GENMASK(20, 16)
+#define NPCM_FIU_UMA_CFG_ADDSIZGENMASK(13, 11)
+#define NPCM_FIU_UMA_CFG_CMDSIZBIT(10)
+#define NPCM_FIU_UMA_CFG_RDBPCKGENMASK(9, 8)
+#define NPCM_FIU_UMA_CFG_DBPCK GENMASK(7, 6)
+#define NPCM_FIU_UMA_CFG_WDBPCKGENMASK(5, 4)