linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] spi: reorganize drivers
@ 2011-06-05  7:18 Grant Likely
  2011-06-05  7:43 ` Jassi Brar
                   ` (2 more replies)
  0 siblings, 3 replies; 28+ messages in thread
From: Grant Likely @ 2011-06-05  7:18 UTC (permalink / raw)
  To: spi-devel-general, linux-kernel

[repost: I had a typo on the spi-devel-general mailing list address]

Sort the SPI makefile and enforce the naming convention spi_*.c for
spi drivers.

This change also rolls the contents of atmel_spi.h into the .c file
since there is only one user of that particular include file.

Signed-off-by: Grant Likely <grant.likely@secretlab.ca>
---
 drivers/spi/Makefile            |   80 ++++++++-----------
 drivers/spi/atmel_spi.h         |  167 ---------------------------------------
 drivers/spi/spi_ath79.c         |    0 
 drivers/spi/spi_atmel.c         |  155 ++++++++++++++++++++++++++++++++++++
 drivers/spi/spi_au1550.c        |    0 
 drivers/spi/spi_coldfire_qspi.c |    0 
 drivers/spi/spi_davinci.c       |    0 
 drivers/spi/spi_dw.c            |    2 
 drivers/spi/spi_dw.h            |    0 
 drivers/spi/spi_dw_mid.c        |    2 
 drivers/spi/spi_dw_mmio.c       |    2 
 drivers/spi/spi_dw_pci.c        |    2 
 drivers/spi/spi_ep93xx.c        |    0 
 drivers/spi/spi_mpc512x_psc.c   |    0 
 drivers/spi/spi_mpc52xx.c       |    0 
 drivers/spi/spi_mpc52xx_psc.c   |    0 
 drivers/spi/spi_omap2_mcspi.c   |    0 
 drivers/spi/spi_omap_100k.c     |    0 
 drivers/spi/spi_omap_uwire.c    |    0 
 drivers/spi/spi_orion.c         |    0 
 drivers/spi/spi_pl022.c         |    0 
 drivers/spi/spi_pxa2xx.c        |    0 
 drivers/spi/spi_pxa2xx_pci.c    |    0 
 drivers/spi/spi_ti_ssp.c        |    0 
 drivers/spi/spi_tle62x0.c       |    0 
 drivers/spi/spi_xilinx.c        |    0 
 26 files changed, 192 insertions(+), 218 deletions(-)
 delete mode 100644 drivers/spi/atmel_spi.h
 rename drivers/spi/{ath79_spi.c => spi_ath79.c} (100%)
 rename drivers/spi/{atmel_spi.c => spi_atmel.c} (85%)
 rename drivers/spi/{au1550_spi.c => spi_au1550.c} (100%)
 rename drivers/spi/{coldfire_qspi.c => spi_coldfire_qspi.c} (100%)
 rename drivers/spi/{davinci_spi.c => spi_davinci.c} (100%)
 rename drivers/spi/{dw_spi.c => spi_dw.c} (99%)
 rename drivers/spi/{dw_spi.h => spi_dw.h} (100%)
 rename drivers/spi/{dw_spi_mid.c => spi_dw_mid.c} (99%)
 rename drivers/spi/{dw_spi_mmio.c => spi_dw_mmio.c} (99%)
 rename drivers/spi/{dw_spi_pci.c => spi_dw_pci.c} (99%)
 rename drivers/spi/{ep93xx_spi.c => spi_ep93xx.c} (100%)
 rename drivers/spi/{mpc512x_psc_spi.c => spi_mpc512x_psc.c} (100%)
 rename drivers/spi/{mpc52xx_spi.c => spi_mpc52xx.c} (100%)
 rename drivers/spi/{mpc52xx_psc_spi.c => spi_mpc52xx_psc.c} (100%)
 rename drivers/spi/{omap2_mcspi.c => spi_omap2_mcspi.c} (100%)
 rename drivers/spi/{omap_spi_100k.c => spi_omap_100k.c} (100%)
 rename drivers/spi/{omap_uwire.c => spi_omap_uwire.c} (100%)
 rename drivers/spi/{orion_spi.c => spi_orion.c} (100%)
 rename drivers/spi/{amba-pl022.c => spi_pl022.c} (100%)
 rename drivers/spi/{pxa2xx_spi.c => spi_pxa2xx.c} (100%)
 rename drivers/spi/{pxa2xx_spi_pci.c => spi_pxa2xx_pci.c} (100%)
 rename drivers/spi/{ti-ssp-spi.c => spi_ti_ssp.c} (100%)
 rename drivers/spi/{tle62x0.c => spi_tle62x0.c} (100%)
 rename drivers/spi/{xilinx_spi.c => spi_xilinx.c} (100%)

diff --git a/drivers/spi/Makefile b/drivers/spi/Makefile
index 0f8c69b..39ab8e3 100644
--- a/drivers/spi/Makefile
+++ b/drivers/spi/Makefile
@@ -7,68 +7,56 @@ ccflags-$(CONFIG_SPI_DEBUG) := -DDEBUG
 # small core, mostly translating board-specific
 # config declarations into driver model code
 obj-$(CONFIG_SPI_MASTER)		+= spi.o
+obj-$(CONFIG_SPI_SPIDEV)		+= spidev.o
 
 # SPI master controller drivers (bus)
 obj-$(CONFIG_SPI_ALTERA)		+= spi_altera.o
-obj-$(CONFIG_SPI_ATMEL)			+= atmel_spi.o
-obj-$(CONFIG_SPI_ATH79)			+= ath79_spi.o
+obj-$(CONFIG_SPI_ATMEL)			+= spi_atmel.o
+obj-$(CONFIG_SPI_ATH79)			+= spi_ath79.o
+obj-$(CONFIG_SPI_AU1550)		+= spi_au1550.o
 obj-$(CONFIG_SPI_BFIN)			+= spi_bfin5xx.o
 obj-$(CONFIG_SPI_BFIN_SPORT)		+= spi_bfin_sport.o
 obj-$(CONFIG_SPI_BITBANG)		+= spi_bitbang.o
-obj-$(CONFIG_SPI_AU1550)		+= au1550_spi.o
 obj-$(CONFIG_SPI_BUTTERFLY)		+= spi_butterfly.o
-obj-$(CONFIG_SPI_COLDFIRE_QSPI)		+= coldfire_qspi.o
-obj-$(CONFIG_SPI_DAVINCI)		+= davinci_spi.o
-obj-$(CONFIG_SPI_DESIGNWARE)		+= dw_spi.o
-obj-$(CONFIG_SPI_DW_PCI)		+= dw_spi_midpci.o
-dw_spi_midpci-objs			:= dw_spi_pci.o dw_spi_mid.o
-obj-$(CONFIG_SPI_DW_MMIO)		+= dw_spi_mmio.o
-obj-$(CONFIG_SPI_EP93XX)		+= ep93xx_spi.o
+obj-$(CONFIG_SPI_COLDFIRE_QSPI)		+= spi_coldfire_qspi.o
+obj-$(CONFIG_SPI_DAVINCI)		+= spi_davinci.o
+obj-$(CONFIG_SPI_DESIGNWARE)		+= spi_dw.o
+obj-$(CONFIG_SPI_DW_MMIO)		+= spi_dw_mmio.o
+obj-$(CONFIG_SPI_DW_PCI)		+= spi_dw_midpci.o
+spi_dw_midpci-objs			:= spi_dw_pci.o spi_dw_mid.o
+obj-$(CONFIG_SPI_EP93XX)		+= spi_ep93xx.o
+obj-$(CONFIG_SPI_FSL_LIB)		+= spi_fsl_lib.o
+obj-$(CONFIG_SPI_FSL_ESPI)		+= spi_fsl_espi.o
+obj-$(CONFIG_SPI_FSL_SPI)		+= spi_fsl_spi.o
 obj-$(CONFIG_SPI_GPIO)			+= spi_gpio.o
 obj-$(CONFIG_SPI_IMX)			+= spi_imx.o
 obj-$(CONFIG_SPI_LM70_LLP)		+= spi_lm70llp.o
-obj-$(CONFIG_SPI_PXA2XX)		+= pxa2xx_spi.o
-obj-$(CONFIG_SPI_PXA2XX_PCI)		+= pxa2xx_spi_pci.o
+obj-$(CONFIG_SPI_MPC512x_PSC)		+= spi_mpc512x_psc.o
+obj-$(CONFIG_SPI_MPC52xx_PSC)		+= spi_mpc52xx_psc.o
+obj-$(CONFIG_SPI_MPC52xx)		+= spi_mpc52xx.o
+obj-$(CONFIG_SPI_NUC900)		+= spi_nuc900.o
 obj-$(CONFIG_SPI_OC_TINY)		+= spi_oc_tiny.o
-obj-$(CONFIG_SPI_OMAP_UWIRE)		+= omap_uwire.o
-obj-$(CONFIG_SPI_OMAP24XX)		+= omap2_mcspi.o
-obj-$(CONFIG_SPI_OMAP_100K)		+= omap_spi_100k.o
-obj-$(CONFIG_SPI_ORION)			+= orion_spi.o
-obj-$(CONFIG_SPI_PL022)			+= amba-pl022.o
-obj-$(CONFIG_SPI_MPC512x_PSC)		+= mpc512x_psc_spi.o
-obj-$(CONFIG_SPI_MPC52xx_PSC)		+= mpc52xx_psc_spi.o
-obj-$(CONFIG_SPI_MPC52xx)		+= mpc52xx_spi.o
-obj-$(CONFIG_SPI_FSL_LIB)		+= spi_fsl_lib.o
-obj-$(CONFIG_SPI_FSL_ESPI)		+= spi_fsl_espi.o
-obj-$(CONFIG_SPI_FSL_SPI)		+= spi_fsl_spi.o
+obj-$(CONFIG_SPI_OMAP_UWIRE)		+= spi_omap_uwire.o
+obj-$(CONFIG_SPI_OMAP_100K)		+= spi_omap_100k.o
+obj-$(CONFIG_SPI_OMAP24XX)		+= spi_omap2_mcspi.o
+obj-$(CONFIG_SPI_ORION)			+= spi_orion.o
+obj-$(CONFIG_SPI_PL022)			+= spi_pl022.o
 obj-$(CONFIG_SPI_PPC4xx)		+= spi_ppc4xx.o
+obj-$(CONFIG_SPI_PXA2XX)		+= spi_pxa2xx.o
+obj-$(CONFIG_SPI_PXA2XX_PCI)		+= spi_pxa2xx_pci.o
 obj-$(CONFIG_SPI_S3C24XX_GPIO)		+= spi_s3c24xx_gpio.o
 obj-$(CONFIG_SPI_S3C24XX)		+= spi_s3c24xx_hw.o
+spi_s3c24xx_hw-y			:= spi_s3c24xx.o
+spi_s3c24xx_hw-$(CONFIG_SPI_S3C24XX_FIQ) += spi_s3c24xx_fiq.o
 obj-$(CONFIG_SPI_S3C64XX)		+= spi_s3c64xx.o
-obj-$(CONFIG_SPI_TEGRA)			+= spi_tegra.o
-obj-$(CONFIG_SPI_TI_SSP)		+= ti-ssp-spi.o
-obj-$(CONFIG_SPI_TOPCLIFF_PCH)		+= spi_topcliff_pch.o
-obj-$(CONFIG_SPI_TXX9)			+= spi_txx9.o
-obj-$(CONFIG_SPI_XILINX)		+= xilinx_spi.o
 obj-$(CONFIG_SPI_SH)			+= spi_sh.o
-obj-$(CONFIG_SPI_SH_SCI)		+= spi_sh_sci.o
 obj-$(CONFIG_SPI_SH_MSIOF)		+= spi_sh_msiof.o
+obj-$(CONFIG_SPI_SH_SCI)		+= spi_sh_sci.o
 obj-$(CONFIG_SPI_STMP3XXX)		+= spi_stmp.o
-obj-$(CONFIG_SPI_NUC900)		+= spi_nuc900.o
-
-# special build for s3c24xx spi driver with fiq support
-spi_s3c24xx_hw-y			:= spi_s3c24xx.o
-spi_s3c24xx_hw-$(CONFIG_SPI_S3C24XX_FIQ) += spi_s3c24xx_fiq.o
-
-# 	... add above this line ...
-
-# SPI protocol drivers (device/link on bus)
-obj-$(CONFIG_SPI_SPIDEV)	+= spidev.o
-obj-$(CONFIG_SPI_TLE62X0)	+= tle62x0.o
-# 	... add above this line ...
-
-# SPI slave controller drivers (upstream link)
-# 	... add above this line ...
+obj-$(CONFIG_SPI_TEGRA)			+= spi_tegra.o
+obj-$(CONFIG_SPI_TI_SSP)		+= spi_ti_ssp.o
+obj-$(CONFIG_SPI_TLE62X0)	+= spi_tle62x0.o
+obj-$(CONFIG_SPI_TOPCLIFF_PCH)		+= spi_topcliff_pch.o
+obj-$(CONFIG_SPI_TXX9)			+= spi_txx9.o
+obj-$(CONFIG_SPI_XILINX)		+= spi_xilinx.o
 
-# SPI slave drivers (protocol for that link)
-# 	... add above this line ...
diff --git a/drivers/spi/atmel_spi.h b/drivers/spi/atmel_spi.h
deleted file mode 100644
index 6e06b6a..0000000
--- a/drivers/spi/atmel_spi.h
+++ /dev/null
@@ -1,167 +0,0 @@
-/*
- * Register definitions for Atmel Serial Peripheral Interface (SPI)
- *
- * Copyright (C) 2006 Atmel Corporation
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
- * published by the Free Software Foundation.
- */
-#ifndef __ATMEL_SPI_H__
-#define __ATMEL_SPI_H__
-
-/* SPI register offsets */
-#define SPI_CR					0x0000
-#define SPI_MR					0x0004
-#define SPI_RDR					0x0008
-#define SPI_TDR					0x000c
-#define SPI_SR					0x0010
-#define SPI_IER					0x0014
-#define SPI_IDR					0x0018
-#define SPI_IMR					0x001c
-#define SPI_CSR0				0x0030
-#define SPI_CSR1				0x0034
-#define SPI_CSR2				0x0038
-#define SPI_CSR3				0x003c
-#define SPI_RPR					0x0100
-#define SPI_RCR					0x0104
-#define SPI_TPR					0x0108
-#define SPI_TCR					0x010c
-#define SPI_RNPR				0x0110
-#define SPI_RNCR				0x0114
-#define SPI_TNPR				0x0118
-#define SPI_TNCR				0x011c
-#define SPI_PTCR				0x0120
-#define SPI_PTSR				0x0124
-
-/* Bitfields in CR */
-#define SPI_SPIEN_OFFSET			0
-#define SPI_SPIEN_SIZE				1
-#define SPI_SPIDIS_OFFSET			1
-#define SPI_SPIDIS_SIZE				1
-#define SPI_SWRST_OFFSET			7
-#define SPI_SWRST_SIZE				1
-#define SPI_LASTXFER_OFFSET			24
-#define SPI_LASTXFER_SIZE			1
-
-/* Bitfields in MR */
-#define SPI_MSTR_OFFSET				0
-#define SPI_MSTR_SIZE				1
-#define SPI_PS_OFFSET				1
-#define SPI_PS_SIZE				1
-#define SPI_PCSDEC_OFFSET			2
-#define SPI_PCSDEC_SIZE				1
-#define SPI_FDIV_OFFSET				3
-#define SPI_FDIV_SIZE				1
-#define SPI_MODFDIS_OFFSET			4
-#define SPI_MODFDIS_SIZE			1
-#define SPI_LLB_OFFSET				7
-#define SPI_LLB_SIZE				1
-#define SPI_PCS_OFFSET				16
-#define SPI_PCS_SIZE				4
-#define SPI_DLYBCS_OFFSET			24
-#define SPI_DLYBCS_SIZE				8
-
-/* Bitfields in RDR */
-#define SPI_RD_OFFSET				0
-#define SPI_RD_SIZE				16
-
-/* Bitfields in TDR */
-#define SPI_TD_OFFSET				0
-#define SPI_TD_SIZE				16
-
-/* Bitfields in SR */
-#define SPI_RDRF_OFFSET				0
-#define SPI_RDRF_SIZE				1
-#define SPI_TDRE_OFFSET				1
-#define SPI_TDRE_SIZE				1
-#define SPI_MODF_OFFSET				2
-#define SPI_MODF_SIZE				1
-#define SPI_OVRES_OFFSET			3
-#define SPI_OVRES_SIZE				1
-#define SPI_ENDRX_OFFSET			4
-#define SPI_ENDRX_SIZE				1
-#define SPI_ENDTX_OFFSET			5
-#define SPI_ENDTX_SIZE				1
-#define SPI_RXBUFF_OFFSET			6
-#define SPI_RXBUFF_SIZE				1
-#define SPI_TXBUFE_OFFSET			7
-#define SPI_TXBUFE_SIZE				1
-#define SPI_NSSR_OFFSET				8
-#define SPI_NSSR_SIZE				1
-#define SPI_TXEMPTY_OFFSET			9
-#define SPI_TXEMPTY_SIZE			1
-#define SPI_SPIENS_OFFSET			16
-#define SPI_SPIENS_SIZE				1
-
-/* Bitfields in CSR0 */
-#define SPI_CPOL_OFFSET				0
-#define SPI_CPOL_SIZE				1
-#define SPI_NCPHA_OFFSET			1
-#define SPI_NCPHA_SIZE				1
-#define SPI_CSAAT_OFFSET			3
-#define SPI_CSAAT_SIZE				1
-#define SPI_BITS_OFFSET				4
-#define SPI_BITS_SIZE				4
-#define SPI_SCBR_OFFSET				8
-#define SPI_SCBR_SIZE				8
-#define SPI_DLYBS_OFFSET			16
-#define SPI_DLYBS_SIZE				8
-#define SPI_DLYBCT_OFFSET			24
-#define SPI_DLYBCT_SIZE				8
-
-/* Bitfields in RCR */
-#define SPI_RXCTR_OFFSET			0
-#define SPI_RXCTR_SIZE				16
-
-/* Bitfields in TCR */
-#define SPI_TXCTR_OFFSET			0
-#define SPI_TXCTR_SIZE				16
-
-/* Bitfields in RNCR */
-#define SPI_RXNCR_OFFSET			0
-#define SPI_RXNCR_SIZE				16
-
-/* Bitfields in TNCR */
-#define SPI_TXNCR_OFFSET			0
-#define SPI_TXNCR_SIZE				16
-
-/* Bitfields in PTCR */
-#define SPI_RXTEN_OFFSET			0
-#define SPI_RXTEN_SIZE				1
-#define SPI_RXTDIS_OFFSET			1
-#define SPI_RXTDIS_SIZE				1
-#define SPI_TXTEN_OFFSET			8
-#define SPI_TXTEN_SIZE				1
-#define SPI_TXTDIS_OFFSET			9
-#define SPI_TXTDIS_SIZE				1
-
-/* Constants for BITS */
-#define SPI_BITS_8_BPT				0
-#define SPI_BITS_9_BPT				1
-#define SPI_BITS_10_BPT				2
-#define SPI_BITS_11_BPT				3
-#define SPI_BITS_12_BPT				4
-#define SPI_BITS_13_BPT				5
-#define SPI_BITS_14_BPT				6
-#define SPI_BITS_15_BPT				7
-#define SPI_BITS_16_BPT				8
-
-/* Bit manipulation macros */
-#define SPI_BIT(name) \
-	(1 << SPI_##name##_OFFSET)
-#define SPI_BF(name,value) \
-	(((value) & ((1 << SPI_##name##_SIZE) - 1)) << SPI_##name##_OFFSET)
-#define SPI_BFEXT(name,value) \
-	(((value) >> SPI_##name##_OFFSET) & ((1 << SPI_##name##_SIZE) - 1))
-#define SPI_BFINS(name,value,old) \
-	( ((old) & ~(((1 << SPI_##name##_SIZE) - 1) << SPI_##name##_OFFSET)) \
-	  | SPI_BF(name,value))
-
-/* Register access macros */
-#define spi_readl(port,reg) \
-	__raw_readl((port)->regs + SPI_##reg)
-#define spi_writel(port,reg,value) \
-	__raw_writel((value), (port)->regs + SPI_##reg)
-
-#endif /* __ATMEL_SPI_H__ */
diff --git a/drivers/spi/ath79_spi.c b/drivers/spi/spi_ath79.c
similarity index 100%
rename from drivers/spi/ath79_spi.c
rename to drivers/spi/spi_ath79.c
diff --git a/drivers/spi/atmel_spi.c b/drivers/spi/spi_atmel.c
similarity index 85%
rename from drivers/spi/atmel_spi.c
rename to drivers/spi/spi_atmel.c
index 08711e9..82dee9a 100644
--- a/drivers/spi/atmel_spi.c
+++ b/drivers/spi/spi_atmel.c
@@ -25,7 +25,160 @@
 #include <mach/gpio.h>
 #include <mach/cpu.h>
 
-#include "atmel_spi.h"
+/* SPI register offsets */
+#define SPI_CR					0x0000
+#define SPI_MR					0x0004
+#define SPI_RDR					0x0008
+#define SPI_TDR					0x000c
+#define SPI_SR					0x0010
+#define SPI_IER					0x0014
+#define SPI_IDR					0x0018
+#define SPI_IMR					0x001c
+#define SPI_CSR0				0x0030
+#define SPI_CSR1				0x0034
+#define SPI_CSR2				0x0038
+#define SPI_CSR3				0x003c
+#define SPI_RPR					0x0100
+#define SPI_RCR					0x0104
+#define SPI_TPR					0x0108
+#define SPI_TCR					0x010c
+#define SPI_RNPR				0x0110
+#define SPI_RNCR				0x0114
+#define SPI_TNPR				0x0118
+#define SPI_TNCR				0x011c
+#define SPI_PTCR				0x0120
+#define SPI_PTSR				0x0124
+
+/* Bitfields in CR */
+#define SPI_SPIEN_OFFSET			0
+#define SPI_SPIEN_SIZE				1
+#define SPI_SPIDIS_OFFSET			1
+#define SPI_SPIDIS_SIZE				1
+#define SPI_SWRST_OFFSET			7
+#define SPI_SWRST_SIZE				1
+#define SPI_LASTXFER_OFFSET			24
+#define SPI_LASTXFER_SIZE			1
+
+/* Bitfields in MR */
+#define SPI_MSTR_OFFSET				0
+#define SPI_MSTR_SIZE				1
+#define SPI_PS_OFFSET				1
+#define SPI_PS_SIZE				1
+#define SPI_PCSDEC_OFFSET			2
+#define SPI_PCSDEC_SIZE				1
+#define SPI_FDIV_OFFSET				3
+#define SPI_FDIV_SIZE				1
+#define SPI_MODFDIS_OFFSET			4
+#define SPI_MODFDIS_SIZE			1
+#define SPI_LLB_OFFSET				7
+#define SPI_LLB_SIZE				1
+#define SPI_PCS_OFFSET				16
+#define SPI_PCS_SIZE				4
+#define SPI_DLYBCS_OFFSET			24
+#define SPI_DLYBCS_SIZE				8
+
+/* Bitfields in RDR */
+#define SPI_RD_OFFSET				0
+#define SPI_RD_SIZE				16
+
+/* Bitfields in TDR */
+#define SPI_TD_OFFSET				0
+#define SPI_TD_SIZE				16
+
+/* Bitfields in SR */
+#define SPI_RDRF_OFFSET				0
+#define SPI_RDRF_SIZE				1
+#define SPI_TDRE_OFFSET				1
+#define SPI_TDRE_SIZE				1
+#define SPI_MODF_OFFSET				2
+#define SPI_MODF_SIZE				1
+#define SPI_OVRES_OFFSET			3
+#define SPI_OVRES_SIZE				1
+#define SPI_ENDRX_OFFSET			4
+#define SPI_ENDRX_SIZE				1
+#define SPI_ENDTX_OFFSET			5
+#define SPI_ENDTX_SIZE				1
+#define SPI_RXBUFF_OFFSET			6
+#define SPI_RXBUFF_SIZE				1
+#define SPI_TXBUFE_OFFSET			7
+#define SPI_TXBUFE_SIZE				1
+#define SPI_NSSR_OFFSET				8
+#define SPI_NSSR_SIZE				1
+#define SPI_TXEMPTY_OFFSET			9
+#define SPI_TXEMPTY_SIZE			1
+#define SPI_SPIENS_OFFSET			16
+#define SPI_SPIENS_SIZE				1
+
+/* Bitfields in CSR0 */
+#define SPI_CPOL_OFFSET				0
+#define SPI_CPOL_SIZE				1
+#define SPI_NCPHA_OFFSET			1
+#define SPI_NCPHA_SIZE				1
+#define SPI_CSAAT_OFFSET			3
+#define SPI_CSAAT_SIZE				1
+#define SPI_BITS_OFFSET				4
+#define SPI_BITS_SIZE				4
+#define SPI_SCBR_OFFSET				8
+#define SPI_SCBR_SIZE				8
+#define SPI_DLYBS_OFFSET			16
+#define SPI_DLYBS_SIZE				8
+#define SPI_DLYBCT_OFFSET			24
+#define SPI_DLYBCT_SIZE				8
+
+/* Bitfields in RCR */
+#define SPI_RXCTR_OFFSET			0
+#define SPI_RXCTR_SIZE				16
+
+/* Bitfields in TCR */
+#define SPI_TXCTR_OFFSET			0
+#define SPI_TXCTR_SIZE				16
+
+/* Bitfields in RNCR */
+#define SPI_RXNCR_OFFSET			0
+#define SPI_RXNCR_SIZE				16
+
+/* Bitfields in TNCR */
+#define SPI_TXNCR_OFFSET			0
+#define SPI_TXNCR_SIZE				16
+
+/* Bitfields in PTCR */
+#define SPI_RXTEN_OFFSET			0
+#define SPI_RXTEN_SIZE				1
+#define SPI_RXTDIS_OFFSET			1
+#define SPI_RXTDIS_SIZE				1
+#define SPI_TXTEN_OFFSET			8
+#define SPI_TXTEN_SIZE				1
+#define SPI_TXTDIS_OFFSET			9
+#define SPI_TXTDIS_SIZE				1
+
+/* Constants for BITS */
+#define SPI_BITS_8_BPT				0
+#define SPI_BITS_9_BPT				1
+#define SPI_BITS_10_BPT				2
+#define SPI_BITS_11_BPT				3
+#define SPI_BITS_12_BPT				4
+#define SPI_BITS_13_BPT				5
+#define SPI_BITS_14_BPT				6
+#define SPI_BITS_15_BPT				7
+#define SPI_BITS_16_BPT				8
+
+/* Bit manipulation macros */
+#define SPI_BIT(name) \
+	(1 << SPI_##name##_OFFSET)
+#define SPI_BF(name,value) \
+	(((value) & ((1 << SPI_##name##_SIZE) - 1)) << SPI_##name##_OFFSET)
+#define SPI_BFEXT(name,value) \
+	(((value) >> SPI_##name##_OFFSET) & ((1 << SPI_##name##_SIZE) - 1))
+#define SPI_BFINS(name,value,old) \
+	( ((old) & ~(((1 << SPI_##name##_SIZE) - 1) << SPI_##name##_OFFSET)) \
+	  | SPI_BF(name,value))
+
+/* Register access macros */
+#define spi_readl(port,reg) \
+	__raw_readl((port)->regs + SPI_##reg)
+#define spi_writel(port,reg,value) \
+	__raw_writel((value), (port)->regs + SPI_##reg)
+
 
 /*
  * The core SPI transfer engine just talks to a register bank to set up
diff --git a/drivers/spi/au1550_spi.c b/drivers/spi/spi_au1550.c
similarity index 100%
rename from drivers/spi/au1550_spi.c
rename to drivers/spi/spi_au1550.c
diff --git a/drivers/spi/coldfire_qspi.c b/drivers/spi/spi_coldfire_qspi.c
similarity index 100%
rename from drivers/spi/coldfire_qspi.c
rename to drivers/spi/spi_coldfire_qspi.c
diff --git a/drivers/spi/davinci_spi.c b/drivers/spi/spi_davinci.c
similarity index 100%
rename from drivers/spi/davinci_spi.c
rename to drivers/spi/spi_davinci.c
diff --git a/drivers/spi/dw_spi.c b/drivers/spi/spi_dw.c
similarity index 99%
rename from drivers/spi/dw_spi.c
rename to drivers/spi/spi_dw.c
index 919fa9d..33b2b76 100644
--- a/drivers/spi/dw_spi.c
+++ b/drivers/spi/spi_dw.c
@@ -24,7 +24,7 @@
 #include <linux/slab.h>
 #include <linux/spi/spi.h>
 
-#include "dw_spi.h"
+#include "spi_dw.h"
 
 #ifdef CONFIG_DEBUG_FS
 #include <linux/debugfs.h>
diff --git a/drivers/spi/dw_spi.h b/drivers/spi/spi_dw.h
similarity index 100%
rename from drivers/spi/dw_spi.h
rename to drivers/spi/spi_dw.h
diff --git a/drivers/spi/dw_spi_mid.c b/drivers/spi/spi_dw_mid.c
similarity index 99%
rename from drivers/spi/dw_spi_mid.c
rename to drivers/spi/spi_dw_mid.c
index 4891782..83311f8 100644
--- a/drivers/spi/dw_spi_mid.c
+++ b/drivers/spi/spi_dw_mid.c
@@ -23,7 +23,7 @@
 #include <linux/slab.h>
 #include <linux/spi/spi.h>
 
-#include "dw_spi.h"
+#include "spi_dw.h"
 
 #ifdef CONFIG_SPI_DW_MID_DMA
 #include <linux/intel_mid_dma.h>
diff --git a/drivers/spi/dw_spi_mmio.c b/drivers/spi/spi_dw_mmio.c
similarity index 99%
rename from drivers/spi/dw_spi_mmio.c
rename to drivers/spi/spi_dw_mmio.c
index e0e813d..9f0a2ce 100644
--- a/drivers/spi/dw_spi_mmio.c
+++ b/drivers/spi/spi_dw_mmio.c
@@ -16,7 +16,7 @@
 #include <linux/spi/spi.h>
 #include <linux/scatterlist.h>
 
-#include "dw_spi.h"
+#include "spi_dw.h"
 
 #define DRIVER_NAME "dw_spi_mmio"
 
diff --git a/drivers/spi/dw_spi_pci.c b/drivers/spi/spi_dw_pci.c
similarity index 99%
rename from drivers/spi/dw_spi_pci.c
rename to drivers/spi/spi_dw_pci.c
index ad260aa..4877d1a 100644
--- a/drivers/spi/dw_spi_pci.c
+++ b/drivers/spi/spi_dw_pci.c
@@ -22,7 +22,7 @@
 #include <linux/slab.h>
 #include <linux/spi/spi.h>
 
-#include "dw_spi.h"
+#include "spi_dw.h"
 
 #define DRIVER_NAME "dw_spi_pci"
 
diff --git a/drivers/spi/ep93xx_spi.c b/drivers/spi/spi_ep93xx.c
similarity index 100%
rename from drivers/spi/ep93xx_spi.c
rename to drivers/spi/spi_ep93xx.c
diff --git a/drivers/spi/mpc512x_psc_spi.c b/drivers/spi/spi_mpc512x_psc.c
similarity index 100%
rename from drivers/spi/mpc512x_psc_spi.c
rename to drivers/spi/spi_mpc512x_psc.c
diff --git a/drivers/spi/mpc52xx_spi.c b/drivers/spi/spi_mpc52xx.c
similarity index 100%
rename from drivers/spi/mpc52xx_spi.c
rename to drivers/spi/spi_mpc52xx.c
diff --git a/drivers/spi/mpc52xx_psc_spi.c b/drivers/spi/spi_mpc52xx_psc.c
similarity index 100%
rename from drivers/spi/mpc52xx_psc_spi.c
rename to drivers/spi/spi_mpc52xx_psc.c
diff --git a/drivers/spi/omap2_mcspi.c b/drivers/spi/spi_omap2_mcspi.c
similarity index 100%
rename from drivers/spi/omap2_mcspi.c
rename to drivers/spi/spi_omap2_mcspi.c
diff --git a/drivers/spi/omap_spi_100k.c b/drivers/spi/spi_omap_100k.c
similarity index 100%
rename from drivers/spi/omap_spi_100k.c
rename to drivers/spi/spi_omap_100k.c
diff --git a/drivers/spi/omap_uwire.c b/drivers/spi/spi_omap_uwire.c
similarity index 100%
rename from drivers/spi/omap_uwire.c
rename to drivers/spi/spi_omap_uwire.c
diff --git a/drivers/spi/orion_spi.c b/drivers/spi/spi_orion.c
similarity index 100%
rename from drivers/spi/orion_spi.c
rename to drivers/spi/spi_orion.c
diff --git a/drivers/spi/amba-pl022.c b/drivers/spi/spi_pl022.c
similarity index 100%
rename from drivers/spi/amba-pl022.c
rename to drivers/spi/spi_pl022.c
diff --git a/drivers/spi/pxa2xx_spi.c b/drivers/spi/spi_pxa2xx.c
similarity index 100%
rename from drivers/spi/pxa2xx_spi.c
rename to drivers/spi/spi_pxa2xx.c
diff --git a/drivers/spi/pxa2xx_spi_pci.c b/drivers/spi/spi_pxa2xx_pci.c
similarity index 100%
rename from drivers/spi/pxa2xx_spi_pci.c
rename to drivers/spi/spi_pxa2xx_pci.c
diff --git a/drivers/spi/ti-ssp-spi.c b/drivers/spi/spi_ti_ssp.c
similarity index 100%
rename from drivers/spi/ti-ssp-spi.c
rename to drivers/spi/spi_ti_ssp.c
diff --git a/drivers/spi/tle62x0.c b/drivers/spi/spi_tle62x0.c
similarity index 100%
rename from drivers/spi/tle62x0.c
rename to drivers/spi/spi_tle62x0.c
diff --git a/drivers/spi/xilinx_spi.c b/drivers/spi/spi_xilinx.c
similarity index 100%
rename from drivers/spi/xilinx_spi.c
rename to drivers/spi/spi_xilinx.c


^ permalink raw reply related	[flat|nested] 28+ messages in thread

* Re: [PATCH] spi: reorganize drivers
  2011-06-05  7:18 [PATCH] spi: reorganize drivers Grant Likely
@ 2011-06-05  7:43 ` Jassi Brar
  2011-06-05  7:54   ` Baruch Siach
  2011-06-05  8:13 ` Mika Westerberg
  2011-06-06  9:00 ` Arnd Bergmann
  2 siblings, 1 reply; 28+ messages in thread
From: Jassi Brar @ 2011-06-05  7:43 UTC (permalink / raw)
  To: Grant Likely; +Cc: spi-devel-general, linux-kernel

On Sun, Jun 5, 2011 at 12:48 PM, Grant Likely <grant.likely@secretlab.ca> wrote:
> [repost: I had a typo on the spi-devel-general mailing list address]
>
> Sort the SPI makefile and enforce the naming convention spi_*.c for
> spi drivers.
>
> This change also rolls the contents of atmel_spi.h into the .c file
> since there is only one user of that particular include file.
>
> Signed-off-by: Grant Likely <grant.likely@secretlab.ca>
> ---
>  drivers/spi/Makefile            |   80 ++++++++-----------
>  drivers/spi/atmel_spi.h         |  167 ---------------------------------------
>  drivers/spi/spi_ath79.c         |    0
>  drivers/spi/spi_atmel.c         |  155 ++++++++++++++++++++++++++++++++++++
>  drivers/spi/spi_au1550.c        |    0
>  drivers/spi/spi_coldfire_qspi.c |    0
>  drivers/spi/spi_davinci.c       |    0
>  drivers/spi/spi_dw.c            |    2
>  drivers/spi/spi_dw.h            |    0
>  drivers/spi/spi_dw_mid.c        |    2
>  drivers/spi/spi_dw_mmio.c       |    2
>  drivers/spi/spi_dw_pci.c        |    2
>  drivers/spi/spi_ep93xx.c        |    0
>  drivers/spi/spi_mpc512x_psc.c   |    0
>  drivers/spi/spi_mpc52xx.c       |    0
>  drivers/spi/spi_mpc52xx_psc.c   |    0
>  drivers/spi/spi_omap2_mcspi.c   |    0
>  drivers/spi/spi_omap_100k.c     |    0
>  drivers/spi/spi_omap_uwire.c    |    0
>  drivers/spi/spi_orion.c         |    0
>  drivers/spi/spi_pl022.c         |    0
>  drivers/spi/spi_pxa2xx.c        |    0
>  drivers/spi/spi_pxa2xx_pci.c    |    0
>  drivers/spi/spi_ti_ssp.c        |    0
>  drivers/spi/spi_tle62x0.c       |    0
>  drivers/spi/spi_xilinx.c        |    0

Though the spi_ prefix seems redundant considering the files are in
'spi' directory.
Just a thought, no objection.

^ permalink raw reply	[flat|nested] 28+ messages in thread

* Re: [PATCH] spi: reorganize drivers
  2011-06-05  7:43 ` Jassi Brar
@ 2011-06-05  7:54   ` Baruch Siach
  2011-06-05 11:49     ` Geert Uytterhoeven
  2011-06-05 13:12     ` Jassi Brar
  0 siblings, 2 replies; 28+ messages in thread
From: Baruch Siach @ 2011-06-05  7:54 UTC (permalink / raw)
  To: Jassi Brar; +Cc: Grant Likely, spi-devel-general, linux-kernel

Hi Jassi,

On Sun, Jun 05, 2011 at 01:13:28PM +0530, Jassi Brar wrote:
> On Sun, Jun 5, 2011 at 12:48 PM, Grant Likely <grant.likely@secretlab.ca> wrote:
> > [repost: I had a typo on the spi-devel-general mailing list address]
> >
> > Sort the SPI makefile and enforce the naming convention spi_*.c for
> > spi drivers.

[snip]

> Though the spi_ prefix seems redundant considering the files are in
> 'spi' directory.
> Just a thought, no objection.

When looking at the list of loaded modules (e.g. in an Oops message), the name 
"spi_xilinx" is much more meaningful than just "xilinx", for example.

baruch

-- 
                                                     ~. .~   Tk Open Systems
=}------------------------------------------------ooO--U--Ooo------------{=
   - baruch@tkos.co.il - tel: +972.2.679.5364, http://www.tkos.co.il -

^ permalink raw reply	[flat|nested] 28+ messages in thread

* Re: [PATCH] spi: reorganize drivers
  2011-06-05  7:18 [PATCH] spi: reorganize drivers Grant Likely
  2011-06-05  7:43 ` Jassi Brar
@ 2011-06-05  8:13 ` Mika Westerberg
  2011-06-05 14:37   ` Grant Likely
  2011-06-06  9:00 ` Arnd Bergmann
  2 siblings, 1 reply; 28+ messages in thread
From: Mika Westerberg @ 2011-06-05  8:13 UTC (permalink / raw)
  To: Grant Likely; +Cc: spi-devel-general, linux-kernel

On Sun, Jun 05, 2011 at 01:18:14AM -0600, Grant Likely wrote:
> [repost: I had a typo on the spi-devel-general mailing list address]
> 
> Sort the SPI makefile and enforce the naming convention spi_*.c for
> spi drivers.
> 
> This change also rolls the contents of atmel_spi.h into the .c file
> since there is only one user of that particular include file.
> 
> Signed-off-by: Grant Likely <grant.likely@secretlab.ca>
> ---
>  drivers/spi/Makefile            |   80 ++++++++-----------
>  drivers/spi/atmel_spi.h         |  167 ---------------------------------------
>  drivers/spi/spi_ath79.c         |    0 
>  drivers/spi/spi_atmel.c         |  155 ++++++++++++++++++++++++++++++++++++
>  drivers/spi/spi_au1550.c        |    0 
>  drivers/spi/spi_coldfire_qspi.c |    0 
>  drivers/spi/spi_davinci.c       |    0 
>  drivers/spi/spi_dw.c            |    2 
>  drivers/spi/spi_dw.h            |    0 
>  drivers/spi/spi_dw_mid.c        |    2 
>  drivers/spi/spi_dw_mmio.c       |    2 
>  drivers/spi/spi_dw_pci.c        |    2 
>  drivers/spi/spi_ep93xx.c        |    0 
>  drivers/spi/spi_mpc512x_psc.c   |    0 
>  drivers/spi/spi_mpc52xx.c       |    0 
>  drivers/spi/spi_mpc52xx_psc.c   |    0 
>  drivers/spi/spi_omap2_mcspi.c   |    0 
>  drivers/spi/spi_omap_100k.c     |    0 
>  drivers/spi/spi_omap_uwire.c    |    0 
>  drivers/spi/spi_orion.c         |    0 
>  drivers/spi/spi_pl022.c         |    0 
>  drivers/spi/spi_pxa2xx.c        |    0 
>  drivers/spi/spi_pxa2xx_pci.c    |    0 
>  drivers/spi/spi_ti_ssp.c        |    0 
>  drivers/spi/spi_tle62x0.c       |    0 
>  drivers/spi/spi_xilinx.c        |    0 
>  26 files changed, 192 insertions(+), 218 deletions(-)
>  delete mode 100644 drivers/spi/atmel_spi.h
>  rename drivers/spi/{ath79_spi.c => spi_ath79.c} (100%)
>  rename drivers/spi/{atmel_spi.c => spi_atmel.c} (85%)
>  rename drivers/spi/{au1550_spi.c => spi_au1550.c} (100%)
>  rename drivers/spi/{coldfire_qspi.c => spi_coldfire_qspi.c} (100%)
>  rename drivers/spi/{davinci_spi.c => spi_davinci.c} (100%)
>  rename drivers/spi/{dw_spi.c => spi_dw.c} (99%)
>  rename drivers/spi/{dw_spi.h => spi_dw.h} (100%)
>  rename drivers/spi/{dw_spi_mid.c => spi_dw_mid.c} (99%)
>  rename drivers/spi/{dw_spi_mmio.c => spi_dw_mmio.c} (99%)
>  rename drivers/spi/{dw_spi_pci.c => spi_dw_pci.c} (99%)
>  rename drivers/spi/{ep93xx_spi.c => spi_ep93xx.c} (100%)
>  rename drivers/spi/{mpc512x_psc_spi.c => spi_mpc512x_psc.c} (100%)
>  rename drivers/spi/{mpc52xx_spi.c => spi_mpc52xx.c} (100%)
>  rename drivers/spi/{mpc52xx_psc_spi.c => spi_mpc52xx_psc.c} (100%)
>  rename drivers/spi/{omap2_mcspi.c => spi_omap2_mcspi.c} (100%)
>  rename drivers/spi/{omap_spi_100k.c => spi_omap_100k.c} (100%)
>  rename drivers/spi/{omap_uwire.c => spi_omap_uwire.c} (100%)
>  rename drivers/spi/{orion_spi.c => spi_orion.c} (100%)
>  rename drivers/spi/{amba-pl022.c => spi_pl022.c} (100%)
>  rename drivers/spi/{pxa2xx_spi.c => spi_pxa2xx.c} (100%)
>  rename drivers/spi/{pxa2xx_spi_pci.c => spi_pxa2xx_pci.c} (100%)
>  rename drivers/spi/{ti-ssp-spi.c => spi_ti_ssp.c} (100%)
>  rename drivers/spi/{tle62x0.c => spi_tle62x0.c} (100%)
>  rename drivers/spi/{xilinx_spi.c => spi_xilinx.c} (100%)

We also have things like this in drivers/spi/Kconfig:

config SPI_DAVINCI
	...

	This driver can also be built as a module. The module will
	be called davinci_spi <--- This is now wrong

should these be converted as well?

^ permalink raw reply	[flat|nested] 28+ messages in thread

* Re: [PATCH] spi: reorganize drivers
  2011-06-05  7:54   ` Baruch Siach
@ 2011-06-05 11:49     ` Geert Uytterhoeven
  2011-06-05 13:08       ` Stefan Richter
  2011-06-05 20:55       ` Grant Likely
  2011-06-05 13:12     ` Jassi Brar
  1 sibling, 2 replies; 28+ messages in thread
From: Geert Uytterhoeven @ 2011-06-05 11:49 UTC (permalink / raw)
  To: Baruch Siach, Grant Likely; +Cc: Jassi Brar, spi-devel-general, linux-kernel

On Sun, Jun 5, 2011 at 09:54, Baruch Siach <baruch@tkos.co.il> wrote:
> On Sun, Jun 05, 2011 at 01:13:28PM +0530, Jassi Brar wrote:
>> On Sun, Jun 5, 2011 at 12:48 PM, Grant Likely <grant.likely@secretlab.ca> wrote:
>> > [repost: I had a typo on the spi-devel-general mailing list address]
>> >
>> > Sort the SPI makefile and enforce the naming convention spi_*.c for
>> > spi drivers.
>
> [snip]
>
>> Though the spi_ prefix seems redundant considering the files are in
>> 'spi' directory.
>> Just a thought, no objection.
>
> When looking at the list of loaded modules (e.g. in an Oops message), the name
> "spi_xilinx" is much more meaningful than just "xilinx", for example.

Plus, when dropping the prefix, spi_xilinx.ko and gpio-xilinx.ko
become the same...

So now we have spi_<name>.c (with underscore) and gpio-<name>.c (with dash)?
And other subsystems go with <name>-<type>.c instead, e.g.
drivers/mfd/wm831x-spi.c?

Gr{oetje,eeting}s,

                        Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds

^ permalink raw reply	[flat|nested] 28+ messages in thread

* Re: [PATCH] spi: reorganize drivers
  2011-06-05 11:49     ` Geert Uytterhoeven
@ 2011-06-05 13:08       ` Stefan Richter
  2011-06-05 20:55       ` Grant Likely
  1 sibling, 0 replies; 28+ messages in thread
From: Stefan Richter @ 2011-06-05 13:08 UTC (permalink / raw)
  To: Geert Uytterhoeven
  Cc: Baruch Siach, Grant Likely, Jassi Brar, spi-devel-general, linux-kernel

On Jun 05 Geert Uytterhoeven wrote:
> On Sun, Jun 5, 2011 at 09:54, Baruch Siach <baruch@tkos.co.il> wrote:
> > On Sun, Jun 05, 2011 at 01:13:28PM +0530, Jassi Brar wrote:
> >> On Sun, Jun 5, 2011 at 12:48 PM, Grant Likely <grant.likely@secretlab.ca> wrote:
> >> > [repost: I had a typo on the spi-devel-general mailing list address]
> >> >
> >> > Sort the SPI makefile and enforce the naming convention spi_*.c for
> >> > spi drivers.
> >
> > [snip]
> >
> >> Though the spi_ prefix seems redundant considering the files are in
> >> 'spi' directory.
> >> Just a thought, no objection.
> >
> > When looking at the list of loaded modules (e.g. in an Oops message), the name
> > "spi_xilinx" is much more meaningful than just "xilinx", for example.
> 
> Plus, when dropping the prefix, spi_xilinx.ko and gpio-xilinx.ko
> become the same...

In drivers/firewire/Makefile for example, there is this:

	firewire-core-y += core-card.o core-cdev.o core-device.o \
	                   core-iso.o core-topology.o core-transaction.o
	firewire-ohci-y += ohci.o
	firewire-sbp2-y += sbp2.o
	firewire-net-y  += net.o

Which is impractical though if there are more than a handful of drivers
involved.
-- 
Stefan Richter
-=====-==-== -==- --=-=
http://arcgraph.de/sr/

^ permalink raw reply	[flat|nested] 28+ messages in thread

* Re: [PATCH] spi: reorganize drivers
  2011-06-05  7:54   ` Baruch Siach
  2011-06-05 11:49     ` Geert Uytterhoeven
@ 2011-06-05 13:12     ` Jassi Brar
  2011-06-05 20:57       ` Grant Likely
  1 sibling, 1 reply; 28+ messages in thread
From: Jassi Brar @ 2011-06-05 13:12 UTC (permalink / raw)
  To: Baruch Siach; +Cc: Grant Likely, spi-devel-general, linux-kernel

Hi Baruch,

On Sun, Jun 5, 2011 at 1:24 PM, Baruch Siach <baruch@tkos.co.il> wrote:
>> Though the spi_ prefix seems redundant considering the files are in
>> 'spi' directory.
>> Just a thought, no objection.
>
> When looking at the list of loaded modules (e.g. in an Oops message), the name
> "spi_xilinx" is much more meaningful than just "xilinx", for example.
Good catch.
Perhaps we could get Makefile to build modules with spi_ prefix. Just
like USB gadgets do ?

^ permalink raw reply	[flat|nested] 28+ messages in thread

* Re: [PATCH] spi: reorganize drivers
  2011-06-05  8:13 ` Mika Westerberg
@ 2011-06-05 14:37   ` Grant Likely
  0 siblings, 0 replies; 28+ messages in thread
From: Grant Likely @ 2011-06-05 14:37 UTC (permalink / raw)
  To: Mika Westerberg; +Cc: spi-devel-general, linux-kernel

On Sun, Jun 5, 2011 at 2:13 AM, Mika Westerberg <mika.westerberg@iki.fi> wrote:
> On Sun, Jun 05, 2011 at 01:18:14AM -0600, Grant Likely wrote:
>> [repost: I had a typo on the spi-devel-general mailing list address]
>>
>> Sort the SPI makefile and enforce the naming convention spi_*.c for
>> spi drivers.
>>
>> This change also rolls the contents of atmel_spi.h into the .c file
>> since there is only one user of that particular include file.
>>
>> Signed-off-by: Grant Likely <grant.likely@secretlab.ca>
>> ---
>>  drivers/spi/Makefile            |   80 ++++++++-----------
>>  drivers/spi/atmel_spi.h         |  167 ---------------------------------------
>>  drivers/spi/spi_ath79.c         |    0
>>  drivers/spi/spi_atmel.c         |  155 ++++++++++++++++++++++++++++++++++++
>>  drivers/spi/spi_au1550.c        |    0
>>  drivers/spi/spi_coldfire_qspi.c |    0
>>  drivers/spi/spi_davinci.c       |    0
>>  drivers/spi/spi_dw.c            |    2
>>  drivers/spi/spi_dw.h            |    0
>>  drivers/spi/spi_dw_mid.c        |    2
>>  drivers/spi/spi_dw_mmio.c       |    2
>>  drivers/spi/spi_dw_pci.c        |    2
>>  drivers/spi/spi_ep93xx.c        |    0
>>  drivers/spi/spi_mpc512x_psc.c   |    0
>>  drivers/spi/spi_mpc52xx.c       |    0
>>  drivers/spi/spi_mpc52xx_psc.c   |    0
>>  drivers/spi/spi_omap2_mcspi.c   |    0
>>  drivers/spi/spi_omap_100k.c     |    0
>>  drivers/spi/spi_omap_uwire.c    |    0
>>  drivers/spi/spi_orion.c         |    0
>>  drivers/spi/spi_pl022.c         |    0
>>  drivers/spi/spi_pxa2xx.c        |    0
>>  drivers/spi/spi_pxa2xx_pci.c    |    0
>>  drivers/spi/spi_ti_ssp.c        |    0
>>  drivers/spi/spi_tle62x0.c       |    0
>>  drivers/spi/spi_xilinx.c        |    0
>>  26 files changed, 192 insertions(+), 218 deletions(-)
>>  delete mode 100644 drivers/spi/atmel_spi.h
>>  rename drivers/spi/{ath79_spi.c => spi_ath79.c} (100%)
>>  rename drivers/spi/{atmel_spi.c => spi_atmel.c} (85%)
>>  rename drivers/spi/{au1550_spi.c => spi_au1550.c} (100%)
>>  rename drivers/spi/{coldfire_qspi.c => spi_coldfire_qspi.c} (100%)
>>  rename drivers/spi/{davinci_spi.c => spi_davinci.c} (100%)
>>  rename drivers/spi/{dw_spi.c => spi_dw.c} (99%)
>>  rename drivers/spi/{dw_spi.h => spi_dw.h} (100%)
>>  rename drivers/spi/{dw_spi_mid.c => spi_dw_mid.c} (99%)
>>  rename drivers/spi/{dw_spi_mmio.c => spi_dw_mmio.c} (99%)
>>  rename drivers/spi/{dw_spi_pci.c => spi_dw_pci.c} (99%)
>>  rename drivers/spi/{ep93xx_spi.c => spi_ep93xx.c} (100%)
>>  rename drivers/spi/{mpc512x_psc_spi.c => spi_mpc512x_psc.c} (100%)
>>  rename drivers/spi/{mpc52xx_spi.c => spi_mpc52xx.c} (100%)
>>  rename drivers/spi/{mpc52xx_psc_spi.c => spi_mpc52xx_psc.c} (100%)
>>  rename drivers/spi/{omap2_mcspi.c => spi_omap2_mcspi.c} (100%)
>>  rename drivers/spi/{omap_spi_100k.c => spi_omap_100k.c} (100%)
>>  rename drivers/spi/{omap_uwire.c => spi_omap_uwire.c} (100%)
>>  rename drivers/spi/{orion_spi.c => spi_orion.c} (100%)
>>  rename drivers/spi/{amba-pl022.c => spi_pl022.c} (100%)
>>  rename drivers/spi/{pxa2xx_spi.c => spi_pxa2xx.c} (100%)
>>  rename drivers/spi/{pxa2xx_spi_pci.c => spi_pxa2xx_pci.c} (100%)
>>  rename drivers/spi/{ti-ssp-spi.c => spi_ti_ssp.c} (100%)
>>  rename drivers/spi/{tle62x0.c => spi_tle62x0.c} (100%)
>>  rename drivers/spi/{xilinx_spi.c => spi_xilinx.c} (100%)
>
> We also have things like this in drivers/spi/Kconfig:
>
> config SPI_DAVINCI
>        ...
>
>        This driver can also be built as a module. The module will
>        be called davinci_spi <--- This is now wrong
>
> should these be converted as well?

yes.

g.

^ permalink raw reply	[flat|nested] 28+ messages in thread

* Re: [PATCH] spi: reorganize drivers
  2011-06-05 11:49     ` Geert Uytterhoeven
  2011-06-05 13:08       ` Stefan Richter
@ 2011-06-05 20:55       ` Grant Likely
  2011-06-05 21:19         ` Jassi Brar
  1 sibling, 1 reply; 28+ messages in thread
From: Grant Likely @ 2011-06-05 20:55 UTC (permalink / raw)
  To: Geert Uytterhoeven
  Cc: Baruch Siach, Jassi Brar, spi-devel-general, linux-kernel

On Sun, Jun 5, 2011 at 5:49 AM, Geert Uytterhoeven <geert@linux-m68k.org> wrote:
> On Sun, Jun 5, 2011 at 09:54, Baruch Siach <baruch@tkos.co.il> wrote:
>> On Sun, Jun 05, 2011 at 01:13:28PM +0530, Jassi Brar wrote:
>>> On Sun, Jun 5, 2011 at 12:48 PM, Grant Likely <grant.likely@secretlab.ca> wrote:
>>> > [repost: I had a typo on the spi-devel-general mailing list address]
>>> >
>>> > Sort the SPI makefile and enforce the naming convention spi_*.c for
>>> > spi drivers.
>>
>> [snip]
>>
>>> Though the spi_ prefix seems redundant considering the files are in
>>> 'spi' directory.
>>> Just a thought, no objection.
>>
>> When looking at the list of loaded modules (e.g. in an Oops message), the name
>> "spi_xilinx" is much more meaningful than just "xilinx", for example.
>
> Plus, when dropping the prefix, spi_xilinx.ko and gpio-xilinx.ko
> become the same...

Exactly.  We essentially have a flat namespace for modules, despite
the fact of them being organized into directories.  At least for the
subsystems I maintain, I'd like to have a consistent prefix for that
reason.

> So now we have spi_<name>.c (with underscore) and gpio-<name>.c (with dash)?
> And other subsystems go with <name>-<type>.c instead, e.g.
> drivers/mfd/wm831x-spi.c?

On a brief survey of drivers:

apci: *.c
ata: pata_*.c, sata_*.c
atm: *.c
block: *.c
bluetooth: *.c
crypto: *.c
dma: *dma.c
gpio: gpio-*.c (after applying my patch)
hid: hid-*.c
hwmon: *.c
i2c: i2c-*.c
ide: *.c and ide-*.c
input: *.c
leds: leds-*.c
mca: mca-*.c
md: largely dm-*.c
mfd: *.c
mmc: *.c
mtd: *.c
net: *.c
rtc: rtc-*.c
scsi: *.c and scsi_*.c for core code
spi: (before patch) mix of spi_*.c and *_spi.c and *.c
uio: uio_*.c
virtio: virtio_*.c
wdt: *wdt.c and *_wdt.c

So, in this (admittedly incomplete) survey, I see 5 users of the
"prefix_" pattern, 8 of the "prefix-" pattern, a small number using a
suffix, and a whole lot without any pattern at all.  Personally, I
prefer the using a prefix with a '-', but in the spi directory there
was already a number of drivers using '_', so it was smaller impact to
change to using that instead of a dash.  If people don't think it is a
big deal though, then I'll change it to '-' to match the gpio change.

g.

^ permalink raw reply	[flat|nested] 28+ messages in thread

* Re: [PATCH] spi: reorganize drivers
  2011-06-05 13:12     ` Jassi Brar
@ 2011-06-05 20:57       ` Grant Likely
  0 siblings, 0 replies; 28+ messages in thread
From: Grant Likely @ 2011-06-05 20:57 UTC (permalink / raw)
  To: Jassi Brar; +Cc: Baruch Siach, spi-devel-general, linux-kernel

On Sun, Jun 5, 2011 at 7:12 AM, Jassi Brar <jassisinghbrar@gmail.com> wrote:
> Hi Baruch,
>
> On Sun, Jun 5, 2011 at 1:24 PM, Baruch Siach <baruch@tkos.co.il> wrote:
>>> Though the spi_ prefix seems redundant considering the files are in
>>> 'spi' directory.
>>> Just a thought, no objection.
>>
>> When looking at the list of loaded modules (e.g. in an Oops message), the name
>> "spi_xilinx" is much more meaningful than just "xilinx", for example.
> Good catch.
> Perhaps we could get Makefile to build modules with spi_ prefix. Just
> like USB gadgets do ?

I don't think it's worth mucking about with <module_name>-y :=
filename.o when the filename can just be made the same as the module
name.

g.

-- 
Grant Likely, B.Sc., P.Eng.
Secret Lab Technologies Ltd.

^ permalink raw reply	[flat|nested] 28+ messages in thread

* Re: [PATCH] spi: reorganize drivers
  2011-06-05 20:55       ` Grant Likely
@ 2011-06-05 21:19         ` Jassi Brar
  0 siblings, 0 replies; 28+ messages in thread
From: Jassi Brar @ 2011-06-05 21:19 UTC (permalink / raw)
  To: Grant Likely
  Cc: Geert Uytterhoeven, Baruch Siach, spi-devel-general, linux-kernel

> On Sun, Jun 5, 2011 at 5:49 AM, Geert Uytterhoeven <geert@linux-m68k.org> wrote:
>>>> Though the spi_ prefix seems redundant considering the files are in
>>>> 'spi' directory.
>>>> Just a thought, no objection.
>>>
>>> When looking at the list of loaded modules (e.g. in an Oops message), the name
>>> "spi_xilinx" is much more meaningful than just "xilinx", for example.
>>
>> Plus, when dropping the prefix, spi_xilinx.ko and gpio-xilinx.ko
>> become the same...
As I said, the modules could still be made spi_xilinx.ko from
drivers/spi/xilinx.c
and gpio_xilinx.ko from drivers/gpio/xilinx.c


On Mon, Jun 6, 2011 at 2:25 AM, Grant Likely <grant.likely@secretlab.ca> wrote:
>> Perhaps we could get Makefile to build modules with spi_ prefix. Just
>> like USB gadgets do ?
> I don't think it's worth mucking about with <module_name>-y :=
> filename.o when the filename can just be made the same as the module
> name.
Well, the solution was for discarding the 'redundant' prefix and yet
have device specific
module names. Not just for the sake of it.

Anyways, I don't wanna be bitchy about it. I can buy at face value
from a maintainer.
I am ok with the proposed naming.

Cheers!
-j

^ permalink raw reply	[flat|nested] 28+ messages in thread

* Re: [PATCH] spi: reorganize drivers
  2011-06-05  7:18 [PATCH] spi: reorganize drivers Grant Likely
  2011-06-05  7:43 ` Jassi Brar
  2011-06-05  8:13 ` Mika Westerberg
@ 2011-06-06  9:00 ` Arnd Bergmann
  2011-06-06  9:08   ` Dominik Brodowski
                     ` (5 more replies)
  2 siblings, 6 replies; 28+ messages in thread
From: Arnd Bergmann @ 2011-06-06  9:00 UTC (permalink / raw)
  To: Grant Likely, Stefan Richter, Jean Delvare (PC drivers, core),
	Ben Dooks (embedded platforms),
	James Bottomley, linux-pcmcia, Matt Porter, Alexandre Bounine,
	David S. Miller, Michael Buesch, Maciej W. Rozycki,
	Rusty Russell, Florian Fainelli, Geert Uytterhoeven
  Cc: spi-devel-general, linux-kernel, Russell King

On Sunday 05 June 2011, Grant Likely wrote:
>  rename drivers/spi/{omap2_mcspi.c => spi_omap2_mcspi.c} (100%)
>  rename drivers/spi/{omap_spi_100k.c => spi_omap_100k.c} (100%)
>  rename drivers/spi/{omap_uwire.c => spi_omap_uwire.c} (100%)
>  rename drivers/spi/{orion_spi.c => spi_orion.c} (100%)
>  rename drivers/spi/{amba-pl022.c => spi_pl022.c} (100%)
>  rename drivers/spi/{pxa2xx_spi.c => spi_pxa2xx.c} (100%)
>  rename drivers/spi/{pxa2xx_spi_pci.c => spi_pxa2xx_pci.c} (100%)
>  rename drivers/spi/{ti-ssp-spi.c => spi_ti_ssp.c} (100%)
>  rename drivers/spi/{tle62x0.c => spi_tle62x0.c} (100%)
>  rename drivers/spi/{xilinx_spi.c => spi_xilinx.c} (100%)

I recently looked at the directory structure in drivers/ and found a lot
of bus drivers with very few files, plus a few bus drivers with a lot
of files in them besides directories for non-bus specific subsystems.

I think it would be good to move them into a deeper directory drivers/bus/
if we have support from the maintainers, and it's probably better if we
only have to move the files once to reduce the amount of churn on the
MAINTAINERS file and any out of tree patches.

Specifically, I'd like to do these moves:

drivers/{ => bus}/amba
drivers/{ => bus}/dio
drivers/{ => bus}/eisa
drivers/{ => bus}/firewire
drivers/{ => bus}/i2c
drivers/{ => bus}/mca
drivers/{ => bus}/nubus
drivers/{ => bus}/pcmcia
drivers/{ => bus}/rapidio
drivers/{ => bus}/sbus
drivers/{ => bus}/spi
drivers/{ => bus}/ssb
drivers/{ => bus}/tc
drivers/{ => bus}/uwb
drivers/{ => bus}/virtio
drivers/{ => bus}/vlync
drivers/{ => bus}/w1
drivers/{ => bus}/zorro

This leaves out the two most common buses, USB and PCI, mostly because
the directories contain a lot of stuff that is not really bus code
but actual drivers. It does include i2c and spi, which stick out by
being a lot larger than most others.

Opinions? Move or don't move?

	Arnd

^ permalink raw reply	[flat|nested] 28+ messages in thread

* Re: [PATCH] spi: reorganize drivers
  2011-06-06  9:00 ` Arnd Bergmann
@ 2011-06-06  9:08   ` Dominik Brodowski
  2011-06-06  9:08   ` Russell King - ARM Linux
                     ` (4 subsequent siblings)
  5 siblings, 0 replies; 28+ messages in thread
From: Dominik Brodowski @ 2011-06-06  9:08 UTC (permalink / raw)
  To: Arnd Bergmann
  Cc: Grant Likely, Stefan Richter, Jean Delvare (PC drivers, core),
	Ben Dooks (embedded platforms),
	James Bottomley, linux-pcmcia, Matt Porter, Alexandre Bounine,
	David S. Miller, Michael Buesch, Maciej W. Rozycki,
	Rusty Russell, Florian Fainelli, Geert Uytterhoeven,
	spi-devel-general, linux-kernel, Russell King

On Mon, Jun 06, 2011 at 11:00:38AM +0200, Arnd Bergmann wrote:
> On Sunday 05 June 2011, Grant Likely wrote:
> >  rename drivers/spi/{omap2_mcspi.c => spi_omap2_mcspi.c} (100%)
> >  rename drivers/spi/{omap_spi_100k.c => spi_omap_100k.c} (100%)
> >  rename drivers/spi/{omap_uwire.c => spi_omap_uwire.c} (100%)
> >  rename drivers/spi/{orion_spi.c => spi_orion.c} (100%)
> >  rename drivers/spi/{amba-pl022.c => spi_pl022.c} (100%)
> >  rename drivers/spi/{pxa2xx_spi.c => spi_pxa2xx.c} (100%)
> >  rename drivers/spi/{pxa2xx_spi_pci.c => spi_pxa2xx_pci.c} (100%)
> >  rename drivers/spi/{ti-ssp-spi.c => spi_ti_ssp.c} (100%)
> >  rename drivers/spi/{tle62x0.c => spi_tle62x0.c} (100%)
> >  rename drivers/spi/{xilinx_spi.c => spi_xilinx.c} (100%)
> 
> I recently looked at the directory structure in drivers/ and found a lot
> of bus drivers with very few files, plus a few bus drivers with a lot
> of files in them besides directories for non-bus specific subsystems.
> 
> I think it would be good to move them into a deeper directory drivers/bus/
> if we have support from the maintainers, and it's probably better if we
> only have to move the files once to reduce the amount of churn on the
> MAINTAINERS file and any out of tree patches.
> 
> Specifically, I'd like to do these moves:
> 
> drivers/{ => bus}/amba
> drivers/{ => bus}/dio
> drivers/{ => bus}/eisa
> drivers/{ => bus}/firewire
> drivers/{ => bus}/i2c
> drivers/{ => bus}/mca
> drivers/{ => bus}/nubus
> drivers/{ => bus}/pcmcia
> drivers/{ => bus}/rapidio
> drivers/{ => bus}/sbus
> drivers/{ => bus}/spi
> drivers/{ => bus}/ssb
> drivers/{ => bus}/tc
> drivers/{ => bus}/uwb
> drivers/{ => bus}/virtio
> drivers/{ => bus}/vlync
> drivers/{ => bus}/w1
> drivers/{ => bus}/zorro
> 
> This leaves out the two most common buses, USB and PCI, mostly because
> the directories contain a lot of stuff that is not really bus code
> but actual drivers. It does include i2c and spi, which stick out by
> being a lot larger than most others.
> 
> Opinions? Move or don't move?

For PCMCIA, you'd have my Acked-by, if it doesn't end up being the only
directory being moved ;)

Best
	Dominik

^ permalink raw reply	[flat|nested] 28+ messages in thread

* Re: [PATCH] spi: reorganize drivers
  2011-06-06  9:00 ` Arnd Bergmann
  2011-06-06  9:08   ` Dominik Brodowski
@ 2011-06-06  9:08   ` Russell King - ARM Linux
  2011-06-06  9:17   ` Jean Delvare
                     ` (3 subsequent siblings)
  5 siblings, 0 replies; 28+ messages in thread
From: Russell King - ARM Linux @ 2011-06-06  9:08 UTC (permalink / raw)
  To: Arnd Bergmann
  Cc: Grant Likely, Stefan Richter, Jean Delvare (PC drivers, core),
	Ben Dooks (embedded platforms),
	James Bottomley, linux-pcmcia, Matt Porter, Alexandre Bounine,
	David S. Miller, Michael Buesch, Maciej W. Rozycki,
	Rusty Russell, Florian Fainelli, Geert Uytterhoeven,
	spi-devel-general, linux-kernel

On Mon, Jun 06, 2011 at 11:00:38AM +0200, Arnd Bergmann wrote:
> This leaves out the two most common buses, USB and PCI, mostly because
> the directories contain a lot of stuff that is not really bus code
> but actual drivers. It does include i2c and spi, which stick out by
> being a lot larger than most others.
> 
> Opinions? Move or don't move?

I don't see much point in adding an additional level of directories.
All that it'll do is add to the shell filename completion workload
and wear out our tab keys faster...

We'll still have these directories with not a lot under them.

^ permalink raw reply	[flat|nested] 28+ messages in thread

* Re: [PATCH] spi: reorganize drivers
  2011-06-06  9:00 ` Arnd Bergmann
  2011-06-06  9:08   ` Dominik Brodowski
  2011-06-06  9:08   ` Russell King - ARM Linux
@ 2011-06-06  9:17   ` Jean Delvare
  2011-06-06  9:29   ` James Bottomley
                     ` (2 subsequent siblings)
  5 siblings, 0 replies; 28+ messages in thread
From: Jean Delvare @ 2011-06-06  9:17 UTC (permalink / raw)
  To: Arnd Bergmann
  Cc: Grant Likely, Stefan Richter, Ben Dooks (embedded platforms),
	James Bottomley, linux-pcmcia, Matt Porter, Alexandre Bounine,
	David S. Miller, Michael Buesch, Maciej W. Rozycki,
	Rusty Russell, Florian Fainelli, Geert Uytterhoeven,
	spi-devel-general, linux-kernel, Russell King

On Mon, 6 Jun 2011 11:00:38 +0200, Arnd Bergmann wrote:
> On Sunday 05 June 2011, Grant Likely wrote:
> >  rename drivers/spi/{omap2_mcspi.c => spi_omap2_mcspi.c} (100%)
> >  rename drivers/spi/{omap_spi_100k.c => spi_omap_100k.c} (100%)
> >  rename drivers/spi/{omap_uwire.c => spi_omap_uwire.c} (100%)
> >  rename drivers/spi/{orion_spi.c => spi_orion.c} (100%)
> >  rename drivers/spi/{amba-pl022.c => spi_pl022.c} (100%)
> >  rename drivers/spi/{pxa2xx_spi.c => spi_pxa2xx.c} (100%)
> >  rename drivers/spi/{pxa2xx_spi_pci.c => spi_pxa2xx_pci.c} (100%)
> >  rename drivers/spi/{ti-ssp-spi.c => spi_ti_ssp.c} (100%)
> >  rename drivers/spi/{tle62x0.c => spi_tle62x0.c} (100%)
> >  rename drivers/spi/{xilinx_spi.c => spi_xilinx.c} (100%)
> 
> I recently looked at the directory structure in drivers/ and found a lot
> of bus drivers with very few files, plus a few bus drivers with a lot
> of files in them besides directories for non-bus specific subsystems.
> 
> I think it would be good to move them into a deeper directory drivers/bus/
> if we have support from the maintainers, and it's probably better if we
> only have to move the files once to reduce the amount of churn on the
> MAINTAINERS file and any out of tree patches.
> 
> Specifically, I'd like to do these moves:
> 
> drivers/{ => bus}/amba
> drivers/{ => bus}/dio
> drivers/{ => bus}/eisa
> drivers/{ => bus}/firewire
> drivers/{ => bus}/i2c
> drivers/{ => bus}/mca
> drivers/{ => bus}/nubus
> drivers/{ => bus}/pcmcia
> drivers/{ => bus}/rapidio
> drivers/{ => bus}/sbus
> drivers/{ => bus}/spi
> drivers/{ => bus}/ssb
> drivers/{ => bus}/tc
> drivers/{ => bus}/uwb
> drivers/{ => bus}/virtio
> drivers/{ => bus}/vlync
> drivers/{ => bus}/w1
> drivers/{ => bus}/zorro
> 
> This leaves out the two most common buses, USB and PCI, mostly because
> the directories contain a lot of stuff that is not really bus code
> but actual drivers. It does include i2c and spi, which stick out by
> being a lot larger than most others.
> 
> Opinions? Move or don't move?

No opinion, I just don't care.

-- 
Jean Delvare

^ permalink raw reply	[flat|nested] 28+ messages in thread

* Re: [PATCH] spi: reorganize drivers
  2011-06-06  9:00 ` Arnd Bergmann
                     ` (2 preceding siblings ...)
  2011-06-06  9:17   ` Jean Delvare
@ 2011-06-06  9:29   ` James Bottomley
  2011-06-06 11:21     ` Arnd Bergmann
  2011-06-06 10:01   ` Geert Uytterhoeven
  2011-06-06 14:39   ` Grant Likely
  5 siblings, 1 reply; 28+ messages in thread
From: James Bottomley @ 2011-06-06  9:29 UTC (permalink / raw)
  To: Arnd Bergmann
  Cc: Grant Likely, Stefan Richter, Jean Delvare (PC drivers, core),
	Ben Dooks (embedded platforms),
	linux-pcmcia, Matt Porter, Alexandre Bounine, David S. Miller,
	Michael Buesch, Maciej W. Rozycki, Rusty Russell,
	Florian Fainelli, Geert Uytterhoeven, spi-devel-general,
	linux-kernel, Russell King

On Mon, 2011-06-06 at 11:00 +0200, Arnd Bergmann wrote:
> On Sunday 05 June 2011, Grant Likely wrote:
> >  rename drivers/spi/{omap2_mcspi.c => spi_omap2_mcspi.c} (100%)
> >  rename drivers/spi/{omap_spi_100k.c => spi_omap_100k.c} (100%)
> >  rename drivers/spi/{omap_uwire.c => spi_omap_uwire.c} (100%)
> >  rename drivers/spi/{orion_spi.c => spi_orion.c} (100%)
> >  rename drivers/spi/{amba-pl022.c => spi_pl022.c} (100%)
> >  rename drivers/spi/{pxa2xx_spi.c => spi_pxa2xx.c} (100%)
> >  rename drivers/spi/{pxa2xx_spi_pci.c => spi_pxa2xx_pci.c} (100%)
> >  rename drivers/spi/{ti-ssp-spi.c => spi_ti_ssp.c} (100%)
> >  rename drivers/spi/{tle62x0.c => spi_tle62x0.c} (100%)
> >  rename drivers/spi/{xilinx_spi.c => spi_xilinx.c} (100%)
> 
> I recently looked at the directory structure in drivers/ and found a lot
> of bus drivers with very few files, plus a few bus drivers with a lot
> of files in them besides directories for non-bus specific subsystems.
> 
> I think it would be good to move them into a deeper directory drivers/bus/
> if we have support from the maintainers, and it's probably better if we
> only have to move the files once to reduce the amount of churn on the
> MAINTAINERS file and any out of tree patches.
> 
> Specifically, I'd like to do these moves:
> 
> drivers/{ => bus}/amba
> drivers/{ => bus}/dio
> drivers/{ => bus}/eisa
> drivers/{ => bus}/firewire
> drivers/{ => bus}/i2c
> drivers/{ => bus}/mca
> drivers/{ => bus}/nubus
> drivers/{ => bus}/pcmcia
> drivers/{ => bus}/rapidio
> drivers/{ => bus}/sbus
> drivers/{ => bus}/spi
> drivers/{ => bus}/ssb
> drivers/{ => bus}/tc
> drivers/{ => bus}/uwb
> drivers/{ => bus}/virtio
> drivers/{ => bus}/vlync
> drivers/{ => bus}/w1
> drivers/{ => bus}/zorro
> 
> This leaves out the two most common buses, USB and PCI, mostly because
> the directories contain a lot of stuff that is not really bus code
> but actual drivers. It does include i2c and spi, which stick out by
> being a lot larger than most others.
> 
> Opinions? Move or don't move?

I'd say it only makes sense if we do it for all busses ... so USB and
PCI would have to move too.  Logically, the bus code should move and we
should be left with the drivers in both of those directories.  I'd also
say that we don't have to deepen the tree: /bus would be fine.  That
way, /drivers/<bus> would be only for <bus> specific drivers, with non
bus specific drivers we just group them by function as now.

What about the half busses (like SCSI)?

Finally, is there any real point (other than we can do it)?  what is
actually helped by having the bus code obviously separated from the
driver code (assuming we sort out what is bus and what is driver)?

James



^ permalink raw reply	[flat|nested] 28+ messages in thread

* Re: [PATCH] spi: reorganize drivers
  2011-06-06  9:00 ` Arnd Bergmann
                     ` (3 preceding siblings ...)
  2011-06-06  9:29   ` James Bottomley
@ 2011-06-06 10:01   ` Geert Uytterhoeven
  2011-06-06 14:39   ` Grant Likely
  5 siblings, 0 replies; 28+ messages in thread
From: Geert Uytterhoeven @ 2011-06-06 10:01 UTC (permalink / raw)
  To: Arnd Bergmann
  Cc: Grant Likely, Stefan Richter, Jean Delvare (PC drivers, core),
	Ben Dooks (embedded platforms),
	James Bottomley, linux-pcmcia, Matt Porter, Alexandre Bounine,
	David S. Miller, Michael Buesch, Maciej W. Rozycki,
	Rusty Russell, Florian Fainelli, spi-devel-general, linux-kernel,
	Russell King

On Mon, Jun 6, 2011 at 11:00, Arnd Bergmann <arnd@arndb.de> wrote:
> I recently looked at the directory structure in drivers/ and found a lot
> of bus drivers with very few files, plus a few bus drivers with a lot
> of files in them besides directories for non-bus specific subsystems.
>
> I think it would be good to move them into a deeper directory drivers/bus/
> if we have support from the maintainers, and it's probably better if we
> only have to move the files once to reduce the amount of churn on the
> MAINTAINERS file and any out of tree patches.
>
> Specifically, I'd like to do these moves:
>
> drivers/{ => bus}/zorro

(if we go that way in general)

Acked-by: Geert Uytterhoeven <geert@linux-m68k.org>

Gr{oetje,eeting}s,

                        Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds

^ permalink raw reply	[flat|nested] 28+ messages in thread

* Re: [PATCH] spi: reorganize drivers
  2011-06-06  9:29   ` James Bottomley
@ 2011-06-06 11:21     ` Arnd Bergmann
  2011-06-06 12:16       ` Jean Delvare
  0 siblings, 1 reply; 28+ messages in thread
From: Arnd Bergmann @ 2011-06-06 11:21 UTC (permalink / raw)
  To: James Bottomley
  Cc: Grant Likely, Stefan Richter, Jean Delvare (PC drivers, core),
	Ben Dooks (embedded platforms),
	linux-pcmcia, Matt Porter, Alexandre Bounine, David S. Miller,
	Michael Buesch, Maciej W. Rozycki, Rusty Russell,
	Florian Fainelli, Geert Uytterhoeven, spi-devel-general,
	linux-kernel, Russell King

On Monday 06 June 2011, James Bottomley wrote:
> I'd say it only makes sense if we do it for all busses ... so USB and
> PCI would have to move too.  Logically, the bus code should move and we
> should be left with the drivers in both of those directories.  I'd also
> say that we don't have to deepen the tree: /bus would be fine.  That
> way, /drivers/<bus> would be only for <bus> specific drivers, with non
> bus specific drivers we just group them by function as now.

A top-level /bus would work for me, and I guess would also address Russell's
concern. Regarding bus-specific drivers, we're gradually moving those out
of the bus specific directories anyway, basically the only bus directory
that really has device driver in it is USB at this point. It makes some
sense to have a bus-specific low-level user space interface driver like
sg or uio in the bus directory, but everything else should really belong
into some other subsystem.

> What about the half busses (like SCSI)?

I think SCSI is a really special case, not just because of its size
of more than twice the code than everything else I would suggest to
move, but also because it contains mostly host drivers but very few
device drivers (sd, sr, osst, st, and sg). In that sense it's more
a class of devices than a bus and fits in the same category as
mmc and ata than a bus like pci or i2c that have a multitude of
device drivers.

> Finally, is there any real point (other than we can do it)?  what is
> actually helped by having the bus code obviously separated from the
> driver code (assuming we sort out what is bus and what is driver)?

Mostly I think the drivers/ subdirectory is getting a bit cluttered with
stuff that doesn't really fit together, and bus drivers are typically
directories with less than five files in them, apart from the few
exceptions that already came up.

This is about to get worse as we introduce new subsystems (e.g. iommu,
irq, clocksource, eeprom, nvram, ...) into which we are moving
code from arch/arm, drivers/char and drivers/misc. Having buses and
drivers in a separate hierarchy would make the drivers directory and
the respective menuconfig list more clearly structured IMHO.

	Arnd

^ permalink raw reply	[flat|nested] 28+ messages in thread

* Re: [PATCH] spi: reorganize drivers
  2011-06-06 11:21     ` Arnd Bergmann
@ 2011-06-06 12:16       ` Jean Delvare
  2011-06-06 12:35         ` Geert Uytterhoeven
  2011-06-06 12:57         ` Arnd Bergmann
  0 siblings, 2 replies; 28+ messages in thread
From: Jean Delvare @ 2011-06-06 12:16 UTC (permalink / raw)
  To: Arnd Bergmann
  Cc: James Bottomley, Grant Likely, Stefan Richter,
	Ben Dooks (embedded platforms),
	linux-pcmcia, Matt Porter, Alexandre Bounine, David S. Miller,
	Michael Buesch, Maciej W. Rozycki, Rusty Russell,
	Florian Fainelli, Geert Uytterhoeven, spi-devel-general,
	linux-kernel, Russell King

On Mon, 6 Jun 2011 13:21:07 +0200, Arnd Bergmann wrote:
> On Monday 06 June 2011, James Bottomley wrote:
> > I'd say it only makes sense if we do it for all busses ... so USB and
> > PCI would have to move too.  Logically, the bus code should move and we
> > should be left with the drivers in both of those directories.  I'd also
> > say that we don't have to deepen the tree: /bus would be fine.  That
> > way, /drivers/<bus> would be only for <bus> specific drivers, with non
> > bus specific drivers we just group them by function as now.
> 
> A top-level /bus would work for me, and I guess would also address Russell's
> concern. Regarding bus-specific drivers, we're gradually moving those out
> of the bus specific directories anyway, basically the only bus directory
> that really has device driver in it is USB at this point. It makes some
> sense to have a bus-specific low-level user space interface driver like
> sg or uio in the bus directory, but everything else should really belong
> into some other subsystem.

Err, what about I2C and SPI? Aren't drivers/i2c/busses and drivers/spi
full of "device drivers"? Or are these what you call "bus-specific
drivers"? Maybe we need to define all the terms before the discussion
continues further.

> (...)
> This is about to get worse as we introduce new subsystems (e.g. iommu,
> irq, clocksource, eeprom, nvram, ...) into which we are moving
> code from arch/arm, drivers/char and drivers/misc. Having buses and
> drivers in a separate hierarchy would make the drivers directory and
> the respective menuconfig list more clearly structured IMHO.

This gets interesting. Would you suggest for example that i2c-core.c
goes to bus/i2c, and drivers/i2c/busses becomes drivers/i2c? And that
CONFIG_I2C is somewhere in menuconfig, and the hardware driver
selection for drivers/i2c is in a totally different place?

While I am surprised, I am not necessarily objecting. But it seems that
you should better define what your actual plan is, before asking us if
we agree with it.

-- 
Jean Delvare

^ permalink raw reply	[flat|nested] 28+ messages in thread

* Re: [PATCH] spi: reorganize drivers
  2011-06-06 12:16       ` Jean Delvare
@ 2011-06-06 12:35         ` Geert Uytterhoeven
  2011-06-06 12:57         ` Arnd Bergmann
  1 sibling, 0 replies; 28+ messages in thread
From: Geert Uytterhoeven @ 2011-06-06 12:35 UTC (permalink / raw)
  To: Jean Delvare
  Cc: Arnd Bergmann, James Bottomley, Grant Likely, Stefan Richter,
	Ben Dooks (embedded platforms),
	linux-pcmcia, Matt Porter, Alexandre Bounine, David S. Miller,
	Michael Buesch, Maciej W. Rozycki, Rusty Russell,
	Florian Fainelli, spi-devel-general, linux-kernel, Russell King

On Mon, Jun 6, 2011 at 14:16, Jean Delvare <khali@linux-fr.org> wrote:
> On Mon, 6 Jun 2011 13:21:07 +0200, Arnd Bergmann wrote:
>> On Monday 06 June 2011, James Bottomley wrote:
>> > I'd say it only makes sense if we do it for all busses ... so USB and
>> > PCI would have to move too.  Logically, the bus code should move and we
>> > should be left with the drivers in both of those directories.  I'd also
>> > say that we don't have to deepen the tree: /bus would be fine.  That
>> > way, /drivers/<bus> would be only for <bus> specific drivers, with non
>> > bus specific drivers we just group them by function as now.
>>
>> A top-level /bus would work for me, and I guess would also address Russell's
>> concern. Regarding bus-specific drivers, we're gradually moving those out
>> of the bus specific directories anyway, basically the only bus directory
>> that really has device driver in it is USB at this point. It makes some
>> sense to have a bus-specific low-level user space interface driver like
>> sg or uio in the bus directory, but everything else should really belong
>> into some other subsystem.
>
> Err, what about I2C and SPI? Aren't drivers/i2c/busses and drivers/spi
> full of "device drivers"? Or are these what you call "bus-specific
> drivers"? Maybe we need to define all the terms before the discussion
> continues further.

Arnd did write:

| It does include i2c and spi, which stick out by being a lot larger
than most others.

>> (...)
>> This is about to get worse as we introduce new subsystems (e.g. iommu,
>> irq, clocksource, eeprom, nvram, ...) into which we are moving
>> code from arch/arm, drivers/char and drivers/misc. Having buses and
>> drivers in a separate hierarchy would make the drivers directory and
>> the respective menuconfig list more clearly structured IMHO.
>
> This gets interesting. Would you suggest for example that i2c-core.c
> goes to bus/i2c, and drivers/i2c/busses becomes drivers/i2c? And that
> CONFIG_I2C is somewhere in menuconfig, and the hardware driver
> selection for drivers/i2c is in a totally different place?
>
> While I am surprised, I am not necessarily objecting. But it seems that
> you should better define what your actual plan is, before asking us if
> we agree with it.

Most other drivers are located based use case, i.e. from the user's
point of view,
e.g. drivers/net/ and drivers/video.

Gr{oetje,eeting}s,

                        Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds

^ permalink raw reply	[flat|nested] 28+ messages in thread

* Re: [PATCH] spi: reorganize drivers
  2011-06-06 12:16       ` Jean Delvare
  2011-06-06 12:35         ` Geert Uytterhoeven
@ 2011-06-06 12:57         ` Arnd Bergmann
  2011-06-06 13:44           ` Stefan Richter
  1 sibling, 1 reply; 28+ messages in thread
From: Arnd Bergmann @ 2011-06-06 12:57 UTC (permalink / raw)
  To: Jean Delvare
  Cc: James Bottomley, Grant Likely, Stefan Richter,
	Ben Dooks (embedded platforms),
	linux-pcmcia, Matt Porter, Alexandre Bounine, David S. Miller,
	Michael Buesch, Maciej W. Rozycki, Rusty Russell,
	Florian Fainelli, Geert Uytterhoeven, spi-devel-general,
	linux-kernel, Russell King

On Monday 06 June 2011, Jean Delvare wrote:
> On Mon, 6 Jun 2011 13:21:07 +0200, Arnd Bergmann wrote:
> > A top-level /bus would work for me, and I guess would also address Russell's
> > concern. Regarding bus-specific drivers, we're gradually moving those out
> > of the bus specific directories anyway, basically the only bus directory
> > that really has device driver in it is USB at this point. It makes some
> > sense to have a bus-specific low-level user space interface driver like
> > sg or uio in the bus directory, but everything else should really belong
> > into some other subsystem.
> 
> Err, what about I2C and SPI? Aren't drivers/i2c/busses and drivers/spi
> full of "device drivers"? Or are these what you call "bus-specific
> drivers"? Maybe we need to define all the terms before the discussion
> continues further.

drivers/i2c/busses and drivers/spi are full of what I would call "bus
drivers" or "host drivers". They bind to a device from another bus
(platform, pci, ...) and export devices of their own type (i2c, spi, ...).
This is what all bus drivers do.

An i2c or spi device driver would in turn bind to that device and
provide a functionality not specific to that bus (e.g. hwmon, input,
leds, rtc or media).

> > (...)
> > This is about to get worse as we introduce new subsystems (e.g. iommu,
> > irq, clocksource, eeprom, nvram, ...) into which we are moving
> > code from arch/arm, drivers/char and drivers/misc. Having buses and
> > drivers in a separate hierarchy would make the drivers directory and
> > the respective menuconfig list more clearly structured IMHO.
> 
> This gets interesting. Would you suggest for example that i2c-core.c
> goes to bus/i2c, and drivers/i2c/busses becomes drivers/i2c? And that
> CONFIG_I2C is somewhere in menuconfig, and the hardware driver
> selection for drivers/i2c is in a totally different place?

No, all of drivers/i2c would go into bus/i2c or drivers/bus/i2c, there
is no point splitting that. The part that would no go there is the various
drivers that are already not under drivers/i2c but are for devices
connected to an i2c bus.

The confusion is probably that in case of drivers/scsi and drivers/usb,
both bus and device drivers are in the same subdirectories. If we move
drivers/usb to bus/usb, I would probably recommend to split
drivers/usb/{serial,storage,atm,misc} out of it and move it to
drivers/{tty/usb-serial,block/usb,net/usb/atm,misc/usb} though, to
make it look more like PCI or i2c that already have a clean split.

> While I am surprised, I am not necessarily objecting. But it seems that
> you should better define what your actual plan is, before asking us if
> we agree with it.

My original plan was to think this through a bit more, but Grant posted
the big spi reorganization, so I jumped in on that because it wouldn't
be nice to have to move all those drivers again.

	Arnd

^ permalink raw reply	[flat|nested] 28+ messages in thread

* Re: [PATCH] spi: reorganize drivers
  2011-06-06 12:57         ` Arnd Bergmann
@ 2011-06-06 13:44           ` Stefan Richter
  2011-06-06 15:04             ` Arnd Bergmann
  0 siblings, 1 reply; 28+ messages in thread
From: Stefan Richter @ 2011-06-06 13:44 UTC (permalink / raw)
  To: Arnd Bergmann
  Cc: Jean Delvare, James Bottomley, Grant Likely,
	Ben Dooks (embedded platforms),
	linux-pcmcia, Matt Porter, Alexandre Bounine, David S. Miller,
	Michael Buesch, Maciej W. Rozycki, Rusty Russell,
	Florian Fainelli, Geert Uytterhoeven, spi-devel-general,
	linux-kernel, Russell King

On Jun 06 Arnd Bergmann wrote:
> On Monday 06 June 2011, Jean Delvare wrote:
> > On Mon, 6 Jun 2011 13:21:07 +0200, Arnd Bergmann wrote:
> > > A top-level /bus would work for me, and I guess would also address Russell's
> > > concern. Regarding bus-specific drivers, we're gradually moving those out
> > > of the bus specific directories anyway, basically the only bus directory
> > > that really has device driver in it is USB at this point. It makes some
> > > sense to have a bus-specific low-level user space interface driver like
> > > sg or uio in the bus directory, but everything else should really belong
> > > into some other subsystem.
> > 
> > Err, what about I2C and SPI? Aren't drivers/i2c/busses and drivers/spi
> > full of "device drivers"? Or are these what you call "bus-specific
> > drivers"? Maybe we need to define all the terms before the discussion
> > continues further.
> 
> drivers/i2c/busses and drivers/spi are full of what I would call "bus
> drivers" or "host drivers". They bind to a device from another bus
> (platform, pci, ...) and export devices of their own type (i2c, spi, ...).
> This is what all bus drivers do.
> 
> An i2c or spi device driver would in turn bind to that device and
> provide a functionality not specific to that bus (e.g. hwmon, input,
> leds, rtc or media).
> 
> > > (...)
> > > This is about to get worse as we introduce new subsystems (e.g. iommu,
> > > irq, clocksource, eeprom, nvram, ...) into which we are moving
> > > code from arch/arm, drivers/char and drivers/misc. Having buses and
> > > drivers in a separate hierarchy would make the drivers directory and
> > > the respective menuconfig list more clearly structured IMHO.
> > 
> > This gets interesting. Would you suggest for example that i2c-core.c
> > goes to bus/i2c, and drivers/i2c/busses becomes drivers/i2c? And that
> > CONFIG_I2C is somewhere in menuconfig, and the hardware driver
> > selection for drivers/i2c is in a totally different place?
> 
> No, all of drivers/i2c would go into bus/i2c or drivers/bus/i2c, there
> is no point splitting that. The part that would no go there is the various
> drivers that are already not under drivers/i2c but are for devices
> connected to an i2c bus.
> 
> The confusion is probably that in case of drivers/scsi and drivers/usb,
> both bus and device drivers are in the same subdirectories. If we move
> drivers/usb to bus/usb, I would probably recommend to split
> drivers/usb/{serial,storage,atm,misc} out of it and move it to
> drivers/{tty/usb-serial,block/usb,net/usb/atm,misc/usb} though, to
> make it look more like PCI or i2c that already have a clean split.

On drivers/firewire/:

FireWire drivers are currently spread over drivers/firewire (three
link-layer controller drivers + the IEEE 1394 core + two IEEE 1394
application layer drivers), drivers/media/dvb/firewire/ (one 1394
application layer driver), sound/firewire/ (two 1394 application layer
drivers, more are planned to be added there).

>From the Linux driver model POV,
  1. the IEEE 1394 core driver implements the firewire bus,
  2. the link-layer controller drivers implement pci bus based devices,
  3. the IEEE 1394 application layer drivers implement firewire bus based
     devices.  The two of them that are located in drivers/firewire/
     expose a SCSI LLD (a transport in SCSI Architecture Model terms, but
     a host rather than a transport in Linux implementation terms) and a
     networking interface driver.

Number 2 is something one would expect to find in a hypothetical
drivers/bus/ directory.  But where do the others belong?

Would type 1 drivers be kept in drivers/bus/firewire/?  I understand your
above response to Jean that this is what you have in mind.

firewire-sbp2 could be moved into drivers/scsi/, and firewire-net could be
moved into drivers/net/.  But what about maintenance?  They could still be
maintained via linux1394-2.6.git because this worked so far, but then the
directory structure might irritate people who don't use
scripts/get_maintainer.pl all the time.  Well, I could actually picture
firewire-net to be maintained via the net development tree, but I do
wonder how well firewire-sbp2 maintenance through the scsi tree would work.

PS,
these are the same questions like with USB, only on a smaller scale.  (The
usb-storage driver is maintained through the usb tree as well, not the
scsi tree.  drivers/net/usb/ has got T: git .../gregkh/usb-2.6.git
assigned in MAINTAINERS but most of the commits there are actually done by
DaveM.)

PPS,
besides association of source files with development trees, there is also
the association with developer mailing lists and user mailing lists and
web resources, e.g. wiki.  How logical the directory layout is in this
sense could be approximately measured by means of the count of necessary
entries in MAINTAINERS.
-- 
Stefan Richter
-=====-==-== -==- --==-
http://arcgraph.de/sr/

^ permalink raw reply	[flat|nested] 28+ messages in thread

* Re: [PATCH] spi: reorganize drivers
  2011-06-06  9:00 ` Arnd Bergmann
                     ` (4 preceding siblings ...)
  2011-06-06 10:01   ` Geert Uytterhoeven
@ 2011-06-06 14:39   ` Grant Likely
  2011-06-06 15:15     ` Russell King - ARM Linux
  5 siblings, 1 reply; 28+ messages in thread
From: Grant Likely @ 2011-06-06 14:39 UTC (permalink / raw)
  To: Arnd Bergmann
  Cc: Stefan Richter, Jean Delvare (PC drivers, core),
	Ben Dooks (embedded platforms),
	James Bottomley, linux-pcmcia, Matt Porter, Alexandre Bounine,
	David S. Miller, Michael Buesch, Maciej W. Rozycki,
	Rusty Russell, Florian Fainelli, Geert Uytterhoeven,
	spi-devel-general, linux-kernel, Russell King

On Mon, Jun 6, 2011 at 3:00 AM, Arnd Bergmann <arnd@arndb.de> wrote:
> On Sunday 05 June 2011, Grant Likely wrote:
>>  rename drivers/spi/{omap2_mcspi.c => spi_omap2_mcspi.c} (100%)
>>  rename drivers/spi/{omap_spi_100k.c => spi_omap_100k.c} (100%)
>>  rename drivers/spi/{omap_uwire.c => spi_omap_uwire.c} (100%)
>>  rename drivers/spi/{orion_spi.c => spi_orion.c} (100%)
>>  rename drivers/spi/{amba-pl022.c => spi_pl022.c} (100%)
>>  rename drivers/spi/{pxa2xx_spi.c => spi_pxa2xx.c} (100%)
>>  rename drivers/spi/{pxa2xx_spi_pci.c => spi_pxa2xx_pci.c} (100%)
>>  rename drivers/spi/{ti-ssp-spi.c => spi_ti_ssp.c} (100%)
>>  rename drivers/spi/{tle62x0.c => spi_tle62x0.c} (100%)
>>  rename drivers/spi/{xilinx_spi.c => spi_xilinx.c} (100%)
>
> I recently looked at the directory structure in drivers/ and found a lot
> of bus drivers with very few files, plus a few bus drivers with a lot
> of files in them besides directories for non-bus specific subsystems.
>
> I think it would be good to move them into a deeper directory drivers/bus/
> if we have support from the maintainers, and it's probably better if we
> only have to move the files once to reduce the amount of churn on the
> MAINTAINERS file and any out of tree patches.

I had this thought too when I was looking at reorganizing the gpio and
spi directories, but ultimately I came to the conclusion that it
didn't really make much sense to move them.  Bus drivers are just
another kind of device driver.  In general, the organization of having
a directory (like spi or i2c) containing both the common bus
infrastructure and a set of drivers using it, and this isn't even
unlike what we do for non-bus drivers.  I don't see much need to move
these.

However, there are a number of bus types that have infrastructure, but
no actual drivers associated with them, like mca, amba and clk.  It
might make sense to move those bus types into drivers/base alongside
the platform_bus_type implementation.

g.

^ permalink raw reply	[flat|nested] 28+ messages in thread

* Re: [PATCH] spi: reorganize drivers
  2011-06-06 13:44           ` Stefan Richter
@ 2011-06-06 15:04             ` Arnd Bergmann
  0 siblings, 0 replies; 28+ messages in thread
From: Arnd Bergmann @ 2011-06-06 15:04 UTC (permalink / raw)
  To: Stefan Richter
  Cc: Jean Delvare, James Bottomley, Grant Likely,
	Ben Dooks (embedded platforms),
	linux-pcmcia, Matt Porter, Alexandre Bounine, David S. Miller,
	Michael Buesch, Maciej W. Rozycki, Rusty Russell,
	Florian Fainelli, Geert Uytterhoeven, spi-devel-general,
	linux-kernel, Russell King

On Monday 06 June 2011, Stefan Richter wrote:
> On Jun 06 Arnd Bergmann wrote:
> > On Monday 06 June 2011, Jean Delvare wrote:
> On drivers/firewire/:
> 
> FireWire drivers are currently spread over drivers/firewire (three
> link-layer controller drivers + the IEEE 1394 core + two IEEE 1394
> application layer drivers), drivers/media/dvb/firewire/ (one 1394
> application layer driver), sound/firewire/ (two 1394 application layer
> drivers, more are planned to be added there).
> 
> From the Linux driver model POV,
>   1. the IEEE 1394 core driver implements the firewire bus,
>   2. the link-layer controller drivers implement pci bus based devices,
>   3. the IEEE 1394 application layer drivers implement firewire bus based
>      devices.  The two of them that are located in drivers/firewire/
>      expose a SCSI LLD (a transport in SCSI Architecture Model terms, but
>      a host rather than a transport in Linux implementation terms) and a
>      networking interface driver.
> 
> Number 2 is something one would expect to find in a hypothetical
> drivers/bus/ directory.  But where do the others belong?
> 
> Would type 1 drivers be kept in drivers/bus/firewire/?  I understand your
> above response to Jean that this is what you have in mind.

Correct.

> firewire-sbp2 could be moved into drivers/scsi/, and firewire-net could be
> moved into drivers/net/.  But what about maintenance?  They could still be
> maintained via linux1394-2.6.git because this worked so far, but then the
> directory structure might irritate people who don't use
> scripts/get_maintainer.pl all the time.  Well, I could actually picture
> firewire-net to be maintained via the net development tree, but I do
> wonder how well firewire-sbp2 maintenance through the scsi tree would work.

I guess the real question is whether firewire should be considered a bus
like USB or a device class like SCSI, and it's abit of a grey area (SCSI
is too). If you declare it to be a bus, I'd suggest moving the sbp2 and
network drivers to drivers/scsi and drivers/net. If you like to think
of firewire as a closed subsystem instead, it's probably better to leave
all of it in drivers/firewire.

> PS,
> these are the same questions like with USB, only on a smaller scale.  (The
> usb-storage driver is maintained through the usb tree as well, not the
> scsi tree.  drivers/net/usb/ has got T: git .../gregkh/usb-2.6.git
> assigned in MAINTAINERS but most of the commits there are actually done by
> DaveM.)

The difference that I see with usb-storage is that this one is really
a set of different drivers for all sorts of devices, while the firewire sbp2
driver feels more like a single driver that includes a few special
cases. Also, USB is generally perceived as a generic interconnect, while
firewire is seen primarily as a way to attach disk drives.

The differences are of course gradual.

	Arnd

^ permalink raw reply	[flat|nested] 28+ messages in thread

* Re: [PATCH] spi: reorganize drivers
  2011-06-06 14:39   ` Grant Likely
@ 2011-06-06 15:15     ` Russell King - ARM Linux
  0 siblings, 0 replies; 28+ messages in thread
From: Russell King - ARM Linux @ 2011-06-06 15:15 UTC (permalink / raw)
  To: Grant Likely
  Cc: Arnd Bergmann, Stefan Richter, Jean Delvare (PC drivers, core),
	Ben Dooks (embedded platforms),
	James Bottomley, linux-pcmcia, Matt Porter, Alexandre Bounine,
	David S. Miller, Michael Buesch, Maciej W. Rozycki,
	Rusty Russell, Florian Fainelli, Geert Uytterhoeven,
	spi-devel-general, linux-kernel

On Mon, Jun 06, 2011 at 08:39:04AM -0600, Grant Likely wrote:
> However, there are a number of bus types that have infrastructure, but
> no actual drivers associated with them, like mca, amba and clk.  It
> might make sense to move those bus types into drivers/base alongside
> the platform_bus_type implementation.

More or less agreed - I'm not sure we should think about clk just yet
because we don't know what that'll end up looking like yet...

^ permalink raw reply	[flat|nested] 28+ messages in thread

* Re: [PATCH] spi: reorganize drivers
  2011-06-07  9:28 ` Linus Walleij
@ 2011-06-07 13:26   ` Grant Likely
  0 siblings, 0 replies; 28+ messages in thread
From: Grant Likely @ 2011-06-07 13:26 UTC (permalink / raw)
  To: Linus Walleij; +Cc: spi-devel-generl, linux-kernel

On Tue, Jun 7, 2011 at 3:28 AM, Linus Walleij <linus.walleij@linaro.org> wrote:
> On Sun, Jun 5, 2011 at 9:13 AM, Grant Likely <grant.likely@secretlab.ca> wrote:
>
>> Sort the SPI makefile and enforce the naming convention spi_*.c for
>> spi drivers.
> (...)
>>  rename drivers/spi/{amba-pl022.c => spi_pl022.c} (100%)
>
> Whatever the subsystem maintainer likes, that file was named like that
> since many other AMBA-based drivers are named like that.
>
> Acked-by: Linus Walleij <linus.walleij@linaro.org>
>
> I might have a few patches to that file next cycle, I guess I'll
> just base them on your tree FTM.

Sure, although file renames are not a big deal when picking up
patches.  I'm also okay with patches based on Linus' tree.

g.

^ permalink raw reply	[flat|nested] 28+ messages in thread

* Re: [PATCH] spi: reorganize drivers
  2011-06-05  7:13 Grant Likely
@ 2011-06-07  9:28 ` Linus Walleij
  2011-06-07 13:26   ` Grant Likely
  0 siblings, 1 reply; 28+ messages in thread
From: Linus Walleij @ 2011-06-07  9:28 UTC (permalink / raw)
  To: Grant Likely; +Cc: spi-devel-generl, linux-kernel

On Sun, Jun 5, 2011 at 9:13 AM, Grant Likely <grant.likely@secretlab.ca> wrote:

> Sort the SPI makefile and enforce the naming convention spi_*.c for
> spi drivers.
(...)
>  rename drivers/spi/{amba-pl022.c => spi_pl022.c} (100%)

Whatever the subsystem maintainer likes, that file was named like that
since many other AMBA-based drivers are named like that.

Acked-by: Linus Walleij <linus.walleij@linaro.org>

I might have a few patches to that file next cycle, I guess I'll
just base them on your tree FTM.

Yours,
Linus Walleij

^ permalink raw reply	[flat|nested] 28+ messages in thread

* [PATCH] spi: reorganize drivers
@ 2011-06-05  7:13 Grant Likely
  2011-06-07  9:28 ` Linus Walleij
  0 siblings, 1 reply; 28+ messages in thread
From: Grant Likely @ 2011-06-05  7:13 UTC (permalink / raw)
  To: spi-devel-generl, linux-kernel

Sort the SPI makefile and enforce the naming convention spi_*.c for
spi drivers.

This change also rolls the contents of atmel_spi.h into the .c file
since there is only one user of that particular include file.

Signed-off-by: Grant Likely <grant.likely@secretlab.ca>
---
 drivers/spi/Makefile            |   80 ++++++++-----------
 drivers/spi/atmel_spi.h         |  167 ---------------------------------------
 drivers/spi/spi_ath79.c         |    0 
 drivers/spi/spi_atmel.c         |  155 ++++++++++++++++++++++++++++++++++++
 drivers/spi/spi_au1550.c        |    0 
 drivers/spi/spi_coldfire_qspi.c |    0 
 drivers/spi/spi_davinci.c       |    0 
 drivers/spi/spi_dw.c            |    2 
 drivers/spi/spi_dw.h            |    0 
 drivers/spi/spi_dw_mid.c        |    2 
 drivers/spi/spi_dw_mmio.c       |    2 
 drivers/spi/spi_dw_pci.c        |    2 
 drivers/spi/spi_ep93xx.c        |    0 
 drivers/spi/spi_mpc512x_psc.c   |    0 
 drivers/spi/spi_mpc52xx.c       |    0 
 drivers/spi/spi_mpc52xx_psc.c   |    0 
 drivers/spi/spi_omap2_mcspi.c   |    0 
 drivers/spi/spi_omap_100k.c     |    0 
 drivers/spi/spi_omap_uwire.c    |    0 
 drivers/spi/spi_orion.c         |    0 
 drivers/spi/spi_pl022.c         |    0 
 drivers/spi/spi_pxa2xx.c        |    0 
 drivers/spi/spi_pxa2xx_pci.c    |    0 
 drivers/spi/spi_ti_ssp.c        |    0 
 drivers/spi/spi_tle62x0.c       |    0 
 drivers/spi/spi_xilinx.c        |    0 
 26 files changed, 192 insertions(+), 218 deletions(-)
 delete mode 100644 drivers/spi/atmel_spi.h
 rename drivers/spi/{ath79_spi.c => spi_ath79.c} (100%)
 rename drivers/spi/{atmel_spi.c => spi_atmel.c} (85%)
 rename drivers/spi/{au1550_spi.c => spi_au1550.c} (100%)
 rename drivers/spi/{coldfire_qspi.c => spi_coldfire_qspi.c} (100%)
 rename drivers/spi/{davinci_spi.c => spi_davinci.c} (100%)
 rename drivers/spi/{dw_spi.c => spi_dw.c} (99%)
 rename drivers/spi/{dw_spi.h => spi_dw.h} (100%)
 rename drivers/spi/{dw_spi_mid.c => spi_dw_mid.c} (99%)
 rename drivers/spi/{dw_spi_mmio.c => spi_dw_mmio.c} (99%)
 rename drivers/spi/{dw_spi_pci.c => spi_dw_pci.c} (99%)
 rename drivers/spi/{ep93xx_spi.c => spi_ep93xx.c} (100%)
 rename drivers/spi/{mpc512x_psc_spi.c => spi_mpc512x_psc.c} (100%)
 rename drivers/spi/{mpc52xx_spi.c => spi_mpc52xx.c} (100%)
 rename drivers/spi/{mpc52xx_psc_spi.c => spi_mpc52xx_psc.c} (100%)
 rename drivers/spi/{omap2_mcspi.c => spi_omap2_mcspi.c} (100%)
 rename drivers/spi/{omap_spi_100k.c => spi_omap_100k.c} (100%)
 rename drivers/spi/{omap_uwire.c => spi_omap_uwire.c} (100%)
 rename drivers/spi/{orion_spi.c => spi_orion.c} (100%)
 rename drivers/spi/{amba-pl022.c => spi_pl022.c} (100%)
 rename drivers/spi/{pxa2xx_spi.c => spi_pxa2xx.c} (100%)
 rename drivers/spi/{pxa2xx_spi_pci.c => spi_pxa2xx_pci.c} (100%)
 rename drivers/spi/{ti-ssp-spi.c => spi_ti_ssp.c} (100%)
 rename drivers/spi/{tle62x0.c => spi_tle62x0.c} (100%)
 rename drivers/spi/{xilinx_spi.c => spi_xilinx.c} (100%)

diff --git a/drivers/spi/Makefile b/drivers/spi/Makefile
index 0f8c69b..39ab8e3 100644
--- a/drivers/spi/Makefile
+++ b/drivers/spi/Makefile
@@ -7,68 +7,56 @@ ccflags-$(CONFIG_SPI_DEBUG) := -DDEBUG
 # small core, mostly translating board-specific
 # config declarations into driver model code
 obj-$(CONFIG_SPI_MASTER)		+= spi.o
+obj-$(CONFIG_SPI_SPIDEV)		+= spidev.o
 
 # SPI master controller drivers (bus)
 obj-$(CONFIG_SPI_ALTERA)		+= spi_altera.o
-obj-$(CONFIG_SPI_ATMEL)			+= atmel_spi.o
-obj-$(CONFIG_SPI_ATH79)			+= ath79_spi.o
+obj-$(CONFIG_SPI_ATMEL)			+= spi_atmel.o
+obj-$(CONFIG_SPI_ATH79)			+= spi_ath79.o
+obj-$(CONFIG_SPI_AU1550)		+= spi_au1550.o
 obj-$(CONFIG_SPI_BFIN)			+= spi_bfin5xx.o
 obj-$(CONFIG_SPI_BFIN_SPORT)		+= spi_bfin_sport.o
 obj-$(CONFIG_SPI_BITBANG)		+= spi_bitbang.o
-obj-$(CONFIG_SPI_AU1550)		+= au1550_spi.o
 obj-$(CONFIG_SPI_BUTTERFLY)		+= spi_butterfly.o
-obj-$(CONFIG_SPI_COLDFIRE_QSPI)		+= coldfire_qspi.o
-obj-$(CONFIG_SPI_DAVINCI)		+= davinci_spi.o
-obj-$(CONFIG_SPI_DESIGNWARE)		+= dw_spi.o
-obj-$(CONFIG_SPI_DW_PCI)		+= dw_spi_midpci.o
-dw_spi_midpci-objs			:= dw_spi_pci.o dw_spi_mid.o
-obj-$(CONFIG_SPI_DW_MMIO)		+= dw_spi_mmio.o
-obj-$(CONFIG_SPI_EP93XX)		+= ep93xx_spi.o
+obj-$(CONFIG_SPI_COLDFIRE_QSPI)		+= spi_coldfire_qspi.o
+obj-$(CONFIG_SPI_DAVINCI)		+= spi_davinci.o
+obj-$(CONFIG_SPI_DESIGNWARE)		+= spi_dw.o
+obj-$(CONFIG_SPI_DW_MMIO)		+= spi_dw_mmio.o
+obj-$(CONFIG_SPI_DW_PCI)		+= spi_dw_midpci.o
+spi_dw_midpci-objs			:= spi_dw_pci.o spi_dw_mid.o
+obj-$(CONFIG_SPI_EP93XX)		+= spi_ep93xx.o
+obj-$(CONFIG_SPI_FSL_LIB)		+= spi_fsl_lib.o
+obj-$(CONFIG_SPI_FSL_ESPI)		+= spi_fsl_espi.o
+obj-$(CONFIG_SPI_FSL_SPI)		+= spi_fsl_spi.o
 obj-$(CONFIG_SPI_GPIO)			+= spi_gpio.o
 obj-$(CONFIG_SPI_IMX)			+= spi_imx.o
 obj-$(CONFIG_SPI_LM70_LLP)		+= spi_lm70llp.o
-obj-$(CONFIG_SPI_PXA2XX)		+= pxa2xx_spi.o
-obj-$(CONFIG_SPI_PXA2XX_PCI)		+= pxa2xx_spi_pci.o
+obj-$(CONFIG_SPI_MPC512x_PSC)		+= spi_mpc512x_psc.o
+obj-$(CONFIG_SPI_MPC52xx_PSC)		+= spi_mpc52xx_psc.o
+obj-$(CONFIG_SPI_MPC52xx)		+= spi_mpc52xx.o
+obj-$(CONFIG_SPI_NUC900)		+= spi_nuc900.o
 obj-$(CONFIG_SPI_OC_TINY)		+= spi_oc_tiny.o
-obj-$(CONFIG_SPI_OMAP_UWIRE)		+= omap_uwire.o
-obj-$(CONFIG_SPI_OMAP24XX)		+= omap2_mcspi.o
-obj-$(CONFIG_SPI_OMAP_100K)		+= omap_spi_100k.o
-obj-$(CONFIG_SPI_ORION)			+= orion_spi.o
-obj-$(CONFIG_SPI_PL022)			+= amba-pl022.o
-obj-$(CONFIG_SPI_MPC512x_PSC)		+= mpc512x_psc_spi.o
-obj-$(CONFIG_SPI_MPC52xx_PSC)		+= mpc52xx_psc_spi.o
-obj-$(CONFIG_SPI_MPC52xx)		+= mpc52xx_spi.o
-obj-$(CONFIG_SPI_FSL_LIB)		+= spi_fsl_lib.o
-obj-$(CONFIG_SPI_FSL_ESPI)		+= spi_fsl_espi.o
-obj-$(CONFIG_SPI_FSL_SPI)		+= spi_fsl_spi.o
+obj-$(CONFIG_SPI_OMAP_UWIRE)		+= spi_omap_uwire.o
+obj-$(CONFIG_SPI_OMAP_100K)		+= spi_omap_100k.o
+obj-$(CONFIG_SPI_OMAP24XX)		+= spi_omap2_mcspi.o
+obj-$(CONFIG_SPI_ORION)			+= spi_orion.o
+obj-$(CONFIG_SPI_PL022)			+= spi_pl022.o
 obj-$(CONFIG_SPI_PPC4xx)		+= spi_ppc4xx.o
+obj-$(CONFIG_SPI_PXA2XX)		+= spi_pxa2xx.o
+obj-$(CONFIG_SPI_PXA2XX_PCI)		+= spi_pxa2xx_pci.o
 obj-$(CONFIG_SPI_S3C24XX_GPIO)		+= spi_s3c24xx_gpio.o
 obj-$(CONFIG_SPI_S3C24XX)		+= spi_s3c24xx_hw.o
+spi_s3c24xx_hw-y			:= spi_s3c24xx.o
+spi_s3c24xx_hw-$(CONFIG_SPI_S3C24XX_FIQ) += spi_s3c24xx_fiq.o
 obj-$(CONFIG_SPI_S3C64XX)		+= spi_s3c64xx.o
-obj-$(CONFIG_SPI_TEGRA)			+= spi_tegra.o
-obj-$(CONFIG_SPI_TI_SSP)		+= ti-ssp-spi.o
-obj-$(CONFIG_SPI_TOPCLIFF_PCH)		+= spi_topcliff_pch.o
-obj-$(CONFIG_SPI_TXX9)			+= spi_txx9.o
-obj-$(CONFIG_SPI_XILINX)		+= xilinx_spi.o
 obj-$(CONFIG_SPI_SH)			+= spi_sh.o
-obj-$(CONFIG_SPI_SH_SCI)		+= spi_sh_sci.o
 obj-$(CONFIG_SPI_SH_MSIOF)		+= spi_sh_msiof.o
+obj-$(CONFIG_SPI_SH_SCI)		+= spi_sh_sci.o
 obj-$(CONFIG_SPI_STMP3XXX)		+= spi_stmp.o
-obj-$(CONFIG_SPI_NUC900)		+= spi_nuc900.o
-
-# special build for s3c24xx spi driver with fiq support
-spi_s3c24xx_hw-y			:= spi_s3c24xx.o
-spi_s3c24xx_hw-$(CONFIG_SPI_S3C24XX_FIQ) += spi_s3c24xx_fiq.o
-
-# 	... add above this line ...
-
-# SPI protocol drivers (device/link on bus)
-obj-$(CONFIG_SPI_SPIDEV)	+= spidev.o
-obj-$(CONFIG_SPI_TLE62X0)	+= tle62x0.o
-# 	... add above this line ...
-
-# SPI slave controller drivers (upstream link)
-# 	... add above this line ...
+obj-$(CONFIG_SPI_TEGRA)			+= spi_tegra.o
+obj-$(CONFIG_SPI_TI_SSP)		+= spi_ti_ssp.o
+obj-$(CONFIG_SPI_TLE62X0)	+= spi_tle62x0.o
+obj-$(CONFIG_SPI_TOPCLIFF_PCH)		+= spi_topcliff_pch.o
+obj-$(CONFIG_SPI_TXX9)			+= spi_txx9.o
+obj-$(CONFIG_SPI_XILINX)		+= spi_xilinx.o
 
-# SPI slave drivers (protocol for that link)
-# 	... add above this line ...
diff --git a/drivers/spi/atmel_spi.h b/drivers/spi/atmel_spi.h
deleted file mode 100644
index 6e06b6a..0000000
--- a/drivers/spi/atmel_spi.h
+++ /dev/null
@@ -1,167 +0,0 @@
-/*
- * Register definitions for Atmel Serial Peripheral Interface (SPI)
- *
- * Copyright (C) 2006 Atmel Corporation
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
- * published by the Free Software Foundation.
- */
-#ifndef __ATMEL_SPI_H__
-#define __ATMEL_SPI_H__
-
-/* SPI register offsets */
-#define SPI_CR					0x0000
-#define SPI_MR					0x0004
-#define SPI_RDR					0x0008
-#define SPI_TDR					0x000c
-#define SPI_SR					0x0010
-#define SPI_IER					0x0014
-#define SPI_IDR					0x0018
-#define SPI_IMR					0x001c
-#define SPI_CSR0				0x0030
-#define SPI_CSR1				0x0034
-#define SPI_CSR2				0x0038
-#define SPI_CSR3				0x003c
-#define SPI_RPR					0x0100
-#define SPI_RCR					0x0104
-#define SPI_TPR					0x0108
-#define SPI_TCR					0x010c
-#define SPI_RNPR				0x0110
-#define SPI_RNCR				0x0114
-#define SPI_TNPR				0x0118
-#define SPI_TNCR				0x011c
-#define SPI_PTCR				0x0120
-#define SPI_PTSR				0x0124
-
-/* Bitfields in CR */
-#define SPI_SPIEN_OFFSET			0
-#define SPI_SPIEN_SIZE				1
-#define SPI_SPIDIS_OFFSET			1
-#define SPI_SPIDIS_SIZE				1
-#define SPI_SWRST_OFFSET			7
-#define SPI_SWRST_SIZE				1
-#define SPI_LASTXFER_OFFSET			24
-#define SPI_LASTXFER_SIZE			1
-
-/* Bitfields in MR */
-#define SPI_MSTR_OFFSET				0
-#define SPI_MSTR_SIZE				1
-#define SPI_PS_OFFSET				1
-#define SPI_PS_SIZE				1
-#define SPI_PCSDEC_OFFSET			2
-#define SPI_PCSDEC_SIZE				1
-#define SPI_FDIV_OFFSET				3
-#define SPI_FDIV_SIZE				1
-#define SPI_MODFDIS_OFFSET			4
-#define SPI_MODFDIS_SIZE			1
-#define SPI_LLB_OFFSET				7
-#define SPI_LLB_SIZE				1
-#define SPI_PCS_OFFSET				16
-#define SPI_PCS_SIZE				4
-#define SPI_DLYBCS_OFFSET			24
-#define SPI_DLYBCS_SIZE				8
-
-/* Bitfields in RDR */
-#define SPI_RD_OFFSET				0
-#define SPI_RD_SIZE				16
-
-/* Bitfields in TDR */
-#define SPI_TD_OFFSET				0
-#define SPI_TD_SIZE				16
-
-/* Bitfields in SR */
-#define SPI_RDRF_OFFSET				0
-#define SPI_RDRF_SIZE				1
-#define SPI_TDRE_OFFSET				1
-#define SPI_TDRE_SIZE				1
-#define SPI_MODF_OFFSET				2
-#define SPI_MODF_SIZE				1
-#define SPI_OVRES_OFFSET			3
-#define SPI_OVRES_SIZE				1
-#define SPI_ENDRX_OFFSET			4
-#define SPI_ENDRX_SIZE				1
-#define SPI_ENDTX_OFFSET			5
-#define SPI_ENDTX_SIZE				1
-#define SPI_RXBUFF_OFFSET			6
-#define SPI_RXBUFF_SIZE				1
-#define SPI_TXBUFE_OFFSET			7
-#define SPI_TXBUFE_SIZE				1
-#define SPI_NSSR_OFFSET				8
-#define SPI_NSSR_SIZE				1
-#define SPI_TXEMPTY_OFFSET			9
-#define SPI_TXEMPTY_SIZE			1
-#define SPI_SPIENS_OFFSET			16
-#define SPI_SPIENS_SIZE				1
-
-/* Bitfields in CSR0 */
-#define SPI_CPOL_OFFSET				0
-#define SPI_CPOL_SIZE				1
-#define SPI_NCPHA_OFFSET			1
-#define SPI_NCPHA_SIZE				1
-#define SPI_CSAAT_OFFSET			3
-#define SPI_CSAAT_SIZE				1
-#define SPI_BITS_OFFSET				4
-#define SPI_BITS_SIZE				4
-#define SPI_SCBR_OFFSET				8
-#define SPI_SCBR_SIZE				8
-#define SPI_DLYBS_OFFSET			16
-#define SPI_DLYBS_SIZE				8
-#define SPI_DLYBCT_OFFSET			24
-#define SPI_DLYBCT_SIZE				8
-
-/* Bitfields in RCR */
-#define SPI_RXCTR_OFFSET			0
-#define SPI_RXCTR_SIZE				16
-
-/* Bitfields in TCR */
-#define SPI_TXCTR_OFFSET			0
-#define SPI_TXCTR_SIZE				16
-
-/* Bitfields in RNCR */
-#define SPI_RXNCR_OFFSET			0
-#define SPI_RXNCR_SIZE				16
-
-/* Bitfields in TNCR */
-#define SPI_TXNCR_OFFSET			0
-#define SPI_TXNCR_SIZE				16
-
-/* Bitfields in PTCR */
-#define SPI_RXTEN_OFFSET			0
-#define SPI_RXTEN_SIZE				1
-#define SPI_RXTDIS_OFFSET			1
-#define SPI_RXTDIS_SIZE				1
-#define SPI_TXTEN_OFFSET			8
-#define SPI_TXTEN_SIZE				1
-#define SPI_TXTDIS_OFFSET			9
-#define SPI_TXTDIS_SIZE				1
-
-/* Constants for BITS */
-#define SPI_BITS_8_BPT				0
-#define SPI_BITS_9_BPT				1
-#define SPI_BITS_10_BPT				2
-#define SPI_BITS_11_BPT				3
-#define SPI_BITS_12_BPT				4
-#define SPI_BITS_13_BPT				5
-#define SPI_BITS_14_BPT				6
-#define SPI_BITS_15_BPT				7
-#define SPI_BITS_16_BPT				8
-
-/* Bit manipulation macros */
-#define SPI_BIT(name) \
-	(1 << SPI_##name##_OFFSET)
-#define SPI_BF(name,value) \
-	(((value) & ((1 << SPI_##name##_SIZE) - 1)) << SPI_##name##_OFFSET)
-#define SPI_BFEXT(name,value) \
-	(((value) >> SPI_##name##_OFFSET) & ((1 << SPI_##name##_SIZE) - 1))
-#define SPI_BFINS(name,value,old) \
-	( ((old) & ~(((1 << SPI_##name##_SIZE) - 1) << SPI_##name##_OFFSET)) \
-	  | SPI_BF(name,value))
-
-/* Register access macros */
-#define spi_readl(port,reg) \
-	__raw_readl((port)->regs + SPI_##reg)
-#define spi_writel(port,reg,value) \
-	__raw_writel((value), (port)->regs + SPI_##reg)
-
-#endif /* __ATMEL_SPI_H__ */
diff --git a/drivers/spi/ath79_spi.c b/drivers/spi/spi_ath79.c
similarity index 100%
rename from drivers/spi/ath79_spi.c
rename to drivers/spi/spi_ath79.c
diff --git a/drivers/spi/atmel_spi.c b/drivers/spi/spi_atmel.c
similarity index 85%
rename from drivers/spi/atmel_spi.c
rename to drivers/spi/spi_atmel.c
index 08711e9..82dee9a 100644
--- a/drivers/spi/atmel_spi.c
+++ b/drivers/spi/spi_atmel.c
@@ -25,7 +25,160 @@
 #include <mach/gpio.h>
 #include <mach/cpu.h>
 
-#include "atmel_spi.h"
+/* SPI register offsets */
+#define SPI_CR					0x0000
+#define SPI_MR					0x0004
+#define SPI_RDR					0x0008
+#define SPI_TDR					0x000c
+#define SPI_SR					0x0010
+#define SPI_IER					0x0014
+#define SPI_IDR					0x0018
+#define SPI_IMR					0x001c
+#define SPI_CSR0				0x0030
+#define SPI_CSR1				0x0034
+#define SPI_CSR2				0x0038
+#define SPI_CSR3				0x003c
+#define SPI_RPR					0x0100
+#define SPI_RCR					0x0104
+#define SPI_TPR					0x0108
+#define SPI_TCR					0x010c
+#define SPI_RNPR				0x0110
+#define SPI_RNCR				0x0114
+#define SPI_TNPR				0x0118
+#define SPI_TNCR				0x011c
+#define SPI_PTCR				0x0120
+#define SPI_PTSR				0x0124
+
+/* Bitfields in CR */
+#define SPI_SPIEN_OFFSET			0
+#define SPI_SPIEN_SIZE				1
+#define SPI_SPIDIS_OFFSET			1
+#define SPI_SPIDIS_SIZE				1
+#define SPI_SWRST_OFFSET			7
+#define SPI_SWRST_SIZE				1
+#define SPI_LASTXFER_OFFSET			24
+#define SPI_LASTXFER_SIZE			1
+
+/* Bitfields in MR */
+#define SPI_MSTR_OFFSET				0
+#define SPI_MSTR_SIZE				1
+#define SPI_PS_OFFSET				1
+#define SPI_PS_SIZE				1
+#define SPI_PCSDEC_OFFSET			2
+#define SPI_PCSDEC_SIZE				1
+#define SPI_FDIV_OFFSET				3
+#define SPI_FDIV_SIZE				1
+#define SPI_MODFDIS_OFFSET			4
+#define SPI_MODFDIS_SIZE			1
+#define SPI_LLB_OFFSET				7
+#define SPI_LLB_SIZE				1
+#define SPI_PCS_OFFSET				16
+#define SPI_PCS_SIZE				4
+#define SPI_DLYBCS_OFFSET			24
+#define SPI_DLYBCS_SIZE				8
+
+/* Bitfields in RDR */
+#define SPI_RD_OFFSET				0
+#define SPI_RD_SIZE				16
+
+/* Bitfields in TDR */
+#define SPI_TD_OFFSET				0
+#define SPI_TD_SIZE				16
+
+/* Bitfields in SR */
+#define SPI_RDRF_OFFSET				0
+#define SPI_RDRF_SIZE				1
+#define SPI_TDRE_OFFSET				1
+#define SPI_TDRE_SIZE				1
+#define SPI_MODF_OFFSET				2
+#define SPI_MODF_SIZE				1
+#define SPI_OVRES_OFFSET			3
+#define SPI_OVRES_SIZE				1
+#define SPI_ENDRX_OFFSET			4
+#define SPI_ENDRX_SIZE				1
+#define SPI_ENDTX_OFFSET			5
+#define SPI_ENDTX_SIZE				1
+#define SPI_RXBUFF_OFFSET			6
+#define SPI_RXBUFF_SIZE				1
+#define SPI_TXBUFE_OFFSET			7
+#define SPI_TXBUFE_SIZE				1
+#define SPI_NSSR_OFFSET				8
+#define SPI_NSSR_SIZE				1
+#define SPI_TXEMPTY_OFFSET			9
+#define SPI_TXEMPTY_SIZE			1
+#define SPI_SPIENS_OFFSET			16
+#define SPI_SPIENS_SIZE				1
+
+/* Bitfields in CSR0 */
+#define SPI_CPOL_OFFSET				0
+#define SPI_CPOL_SIZE				1
+#define SPI_NCPHA_OFFSET			1
+#define SPI_NCPHA_SIZE				1
+#define SPI_CSAAT_OFFSET			3
+#define SPI_CSAAT_SIZE				1
+#define SPI_BITS_OFFSET				4
+#define SPI_BITS_SIZE				4
+#define SPI_SCBR_OFFSET				8
+#define SPI_SCBR_SIZE				8
+#define SPI_DLYBS_OFFSET			16
+#define SPI_DLYBS_SIZE				8
+#define SPI_DLYBCT_OFFSET			24
+#define SPI_DLYBCT_SIZE				8
+
+/* Bitfields in RCR */
+#define SPI_RXCTR_OFFSET			0
+#define SPI_RXCTR_SIZE				16
+
+/* Bitfields in TCR */
+#define SPI_TXCTR_OFFSET			0
+#define SPI_TXCTR_SIZE				16
+
+/* Bitfields in RNCR */
+#define SPI_RXNCR_OFFSET			0
+#define SPI_RXNCR_SIZE				16
+
+/* Bitfields in TNCR */
+#define SPI_TXNCR_OFFSET			0
+#define SPI_TXNCR_SIZE				16
+
+/* Bitfields in PTCR */
+#define SPI_RXTEN_OFFSET			0
+#define SPI_RXTEN_SIZE				1
+#define SPI_RXTDIS_OFFSET			1
+#define SPI_RXTDIS_SIZE				1
+#define SPI_TXTEN_OFFSET			8
+#define SPI_TXTEN_SIZE				1
+#define SPI_TXTDIS_OFFSET			9
+#define SPI_TXTDIS_SIZE				1
+
+/* Constants for BITS */
+#define SPI_BITS_8_BPT				0
+#define SPI_BITS_9_BPT				1
+#define SPI_BITS_10_BPT				2
+#define SPI_BITS_11_BPT				3
+#define SPI_BITS_12_BPT				4
+#define SPI_BITS_13_BPT				5
+#define SPI_BITS_14_BPT				6
+#define SPI_BITS_15_BPT				7
+#define SPI_BITS_16_BPT				8
+
+/* Bit manipulation macros */
+#define SPI_BIT(name) \
+	(1 << SPI_##name##_OFFSET)
+#define SPI_BF(name,value) \
+	(((value) & ((1 << SPI_##name##_SIZE) - 1)) << SPI_##name##_OFFSET)
+#define SPI_BFEXT(name,value) \
+	(((value) >> SPI_##name##_OFFSET) & ((1 << SPI_##name##_SIZE) - 1))
+#define SPI_BFINS(name,value,old) \
+	( ((old) & ~(((1 << SPI_##name##_SIZE) - 1) << SPI_##name##_OFFSET)) \
+	  | SPI_BF(name,value))
+
+/* Register access macros */
+#define spi_readl(port,reg) \
+	__raw_readl((port)->regs + SPI_##reg)
+#define spi_writel(port,reg,value) \
+	__raw_writel((value), (port)->regs + SPI_##reg)
+
 
 /*
  * The core SPI transfer engine just talks to a register bank to set up
diff --git a/drivers/spi/au1550_spi.c b/drivers/spi/spi_au1550.c
similarity index 100%
rename from drivers/spi/au1550_spi.c
rename to drivers/spi/spi_au1550.c
diff --git a/drivers/spi/coldfire_qspi.c b/drivers/spi/spi_coldfire_qspi.c
similarity index 100%
rename from drivers/spi/coldfire_qspi.c
rename to drivers/spi/spi_coldfire_qspi.c
diff --git a/drivers/spi/davinci_spi.c b/drivers/spi/spi_davinci.c
similarity index 100%
rename from drivers/spi/davinci_spi.c
rename to drivers/spi/spi_davinci.c
diff --git a/drivers/spi/dw_spi.c b/drivers/spi/spi_dw.c
similarity index 99%
rename from drivers/spi/dw_spi.c
rename to drivers/spi/spi_dw.c
index 919fa9d..33b2b76 100644
--- a/drivers/spi/dw_spi.c
+++ b/drivers/spi/spi_dw.c
@@ -24,7 +24,7 @@
 #include <linux/slab.h>
 #include <linux/spi/spi.h>
 
-#include "dw_spi.h"
+#include "spi_dw.h"
 
 #ifdef CONFIG_DEBUG_FS
 #include <linux/debugfs.h>
diff --git a/drivers/spi/dw_spi.h b/drivers/spi/spi_dw.h
similarity index 100%
rename from drivers/spi/dw_spi.h
rename to drivers/spi/spi_dw.h
diff --git a/drivers/spi/dw_spi_mid.c b/drivers/spi/spi_dw_mid.c
similarity index 99%
rename from drivers/spi/dw_spi_mid.c
rename to drivers/spi/spi_dw_mid.c
index 4891782..83311f8 100644
--- a/drivers/spi/dw_spi_mid.c
+++ b/drivers/spi/spi_dw_mid.c
@@ -23,7 +23,7 @@
 #include <linux/slab.h>
 #include <linux/spi/spi.h>
 
-#include "dw_spi.h"
+#include "spi_dw.h"
 
 #ifdef CONFIG_SPI_DW_MID_DMA
 #include <linux/intel_mid_dma.h>
diff --git a/drivers/spi/dw_spi_mmio.c b/drivers/spi/spi_dw_mmio.c
similarity index 99%
rename from drivers/spi/dw_spi_mmio.c
rename to drivers/spi/spi_dw_mmio.c
index e0e813d..9f0a2ce 100644
--- a/drivers/spi/dw_spi_mmio.c
+++ b/drivers/spi/spi_dw_mmio.c
@@ -16,7 +16,7 @@
 #include <linux/spi/spi.h>
 #include <linux/scatterlist.h>
 
-#include "dw_spi.h"
+#include "spi_dw.h"
 
 #define DRIVER_NAME "dw_spi_mmio"
 
diff --git a/drivers/spi/dw_spi_pci.c b/drivers/spi/spi_dw_pci.c
similarity index 99%
rename from drivers/spi/dw_spi_pci.c
rename to drivers/spi/spi_dw_pci.c
index ad260aa..4877d1a 100644
--- a/drivers/spi/dw_spi_pci.c
+++ b/drivers/spi/spi_dw_pci.c
@@ -22,7 +22,7 @@
 #include <linux/slab.h>
 #include <linux/spi/spi.h>
 
-#include "dw_spi.h"
+#include "spi_dw.h"
 
 #define DRIVER_NAME "dw_spi_pci"
 
diff --git a/drivers/spi/ep93xx_spi.c b/drivers/spi/spi_ep93xx.c
similarity index 100%
rename from drivers/spi/ep93xx_spi.c
rename to drivers/spi/spi_ep93xx.c
diff --git a/drivers/spi/mpc512x_psc_spi.c b/drivers/spi/spi_mpc512x_psc.c
similarity index 100%
rename from drivers/spi/mpc512x_psc_spi.c
rename to drivers/spi/spi_mpc512x_psc.c
diff --git a/drivers/spi/mpc52xx_spi.c b/drivers/spi/spi_mpc52xx.c
similarity index 100%
rename from drivers/spi/mpc52xx_spi.c
rename to drivers/spi/spi_mpc52xx.c
diff --git a/drivers/spi/mpc52xx_psc_spi.c b/drivers/spi/spi_mpc52xx_psc.c
similarity index 100%
rename from drivers/spi/mpc52xx_psc_spi.c
rename to drivers/spi/spi_mpc52xx_psc.c
diff --git a/drivers/spi/omap2_mcspi.c b/drivers/spi/spi_omap2_mcspi.c
similarity index 100%
rename from drivers/spi/omap2_mcspi.c
rename to drivers/spi/spi_omap2_mcspi.c
diff --git a/drivers/spi/omap_spi_100k.c b/drivers/spi/spi_omap_100k.c
similarity index 100%
rename from drivers/spi/omap_spi_100k.c
rename to drivers/spi/spi_omap_100k.c
diff --git a/drivers/spi/omap_uwire.c b/drivers/spi/spi_omap_uwire.c
similarity index 100%
rename from drivers/spi/omap_uwire.c
rename to drivers/spi/spi_omap_uwire.c
diff --git a/drivers/spi/orion_spi.c b/drivers/spi/spi_orion.c
similarity index 100%
rename from drivers/spi/orion_spi.c
rename to drivers/spi/spi_orion.c
diff --git a/drivers/spi/amba-pl022.c b/drivers/spi/spi_pl022.c
similarity index 100%
rename from drivers/spi/amba-pl022.c
rename to drivers/spi/spi_pl022.c
diff --git a/drivers/spi/pxa2xx_spi.c b/drivers/spi/spi_pxa2xx.c
similarity index 100%
rename from drivers/spi/pxa2xx_spi.c
rename to drivers/spi/spi_pxa2xx.c
diff --git a/drivers/spi/pxa2xx_spi_pci.c b/drivers/spi/spi_pxa2xx_pci.c
similarity index 100%
rename from drivers/spi/pxa2xx_spi_pci.c
rename to drivers/spi/spi_pxa2xx_pci.c
diff --git a/drivers/spi/ti-ssp-spi.c b/drivers/spi/spi_ti_ssp.c
similarity index 100%
rename from drivers/spi/ti-ssp-spi.c
rename to drivers/spi/spi_ti_ssp.c
diff --git a/drivers/spi/tle62x0.c b/drivers/spi/spi_tle62x0.c
similarity index 100%
rename from drivers/spi/tle62x0.c
rename to drivers/spi/spi_tle62x0.c
diff --git a/drivers/spi/xilinx_spi.c b/drivers/spi/spi_xilinx.c
similarity index 100%
rename from drivers/spi/xilinx_spi.c
rename to drivers/spi/spi_xilinx.c


^ permalink raw reply related	[flat|nested] 28+ messages in thread

end of thread, other threads:[~2011-06-07 13:26 UTC | newest]

Thread overview: 28+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-06-05  7:18 [PATCH] spi: reorganize drivers Grant Likely
2011-06-05  7:43 ` Jassi Brar
2011-06-05  7:54   ` Baruch Siach
2011-06-05 11:49     ` Geert Uytterhoeven
2011-06-05 13:08       ` Stefan Richter
2011-06-05 20:55       ` Grant Likely
2011-06-05 21:19         ` Jassi Brar
2011-06-05 13:12     ` Jassi Brar
2011-06-05 20:57       ` Grant Likely
2011-06-05  8:13 ` Mika Westerberg
2011-06-05 14:37   ` Grant Likely
2011-06-06  9:00 ` Arnd Bergmann
2011-06-06  9:08   ` Dominik Brodowski
2011-06-06  9:08   ` Russell King - ARM Linux
2011-06-06  9:17   ` Jean Delvare
2011-06-06  9:29   ` James Bottomley
2011-06-06 11:21     ` Arnd Bergmann
2011-06-06 12:16       ` Jean Delvare
2011-06-06 12:35         ` Geert Uytterhoeven
2011-06-06 12:57         ` Arnd Bergmann
2011-06-06 13:44           ` Stefan Richter
2011-06-06 15:04             ` Arnd Bergmann
2011-06-06 10:01   ` Geert Uytterhoeven
2011-06-06 14:39   ` Grant Likely
2011-06-06 15:15     ` Russell King - ARM Linux
  -- strict thread matches above, loose matches on Subject: below --
2011-06-05  7:13 Grant Likely
2011-06-07  9:28 ` Linus Walleij
2011-06-07 13:26   ` Grant Likely

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).