linux-mtd.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 00/11] ARM: sa1100, mmp: drop unused board files
@ 2022-10-21 15:49 Arnd Bergmann
  2022-10-21 15:49 ` [PATCH 06/11] mtd: remove lart flash driver Arnd Bergmann
  0 siblings, 1 reply; 3+ messages in thread
From: Arnd Bergmann @ 2022-10-21 15:49 UTC (permalink / raw)
  To: linux-arm-kernel, Russell King, Linus Walleij, Lubomir Rintel
  Cc: linux-kernel, Arnd Bergmann, Rafael J. Wysocki, Alan Stern,
	Dominik Brodowski, Greg Kroah-Hartman, Helge Deller, Lee Jones,
	Miquel Raynal, Peter Chubb, Richard Weinberger,
	Stefan Eletzhofer, Vignesh Raghavendra, Vinod Koul, Viresh Kumar,
	linux-pm, dmaengine, linux-mtd, linux-usb, linux-fbdev,
	dri-devel

From: Arnd Bergmann <arnd@arndb.de>

A number of board files were marked as 'unused' in 2022 and can
get removed in linux-6.2 at the beginning of 2023.
I wanted to group these two platforms with the PXA series, but
that one is already too big.

MMP is now DT-only, which allows removing most of the platform
specific source code.

On SA1100, four boards that have no apparent users get removed,
while another four boards each had one person saying they would
like to keep it around.

Arnd Bergmann (11):
  ARM: sa1100: un-deprecate jornada720
  ARM: sa1100: remove unused board files
  ARM: sa1100: remove irda references
  ARM: sa1100: make cpufreq driver build standalone
  cpufreq: remove sa1100 driver
  mtd: remove lart flash driver
  ARM: mmp: select specific CPU implementation
  ARM: mmp: remove all board files
  ARM: mmp: remove custom sram code
  ARM: mmp: remove device definitions
  ARM: mmp: remove old PM support

Cc: "Rafael J. Wysocki" <rafael@kernel.org>
Cc: Alan Stern <stern@rowland.harvard.edu>
Cc: Dominik Brodowski <linux@dominikbrodowski.net>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: Helge Deller <deller@gmx.de>
Cc: Lee Jones <lee@kernel.org>
Cc: Lubomir Rintel <lkundrak@v3.sk>
Cc: Miquel Raynal <miquel.raynal@bootlin.com>
Cc: Peter Chubb <peter.chubb@unsw.edu.au>
Cc: Richard Weinberger <richard@nod.at>
Cc: Russell King <linux@armlinux.org.uk>
Cc: Stefan Eletzhofer <stefan.eletzhofer@eletztrick.de>
Cc: Vignesh Raghavendra <vigneshr@ti.com>
Cc: Vinod Koul <vkoul@kernel.org>
Cc: Viresh Kumar <viresh.kumar@linaro.org>
Cc: linux-kernel@vger.kernel.org
Cc: linux-arm-kernel@lists.infradead.org
Cc: linux-pm@vger.kernel.org
Cc: dmaengine@vger.kernel.org
Cc: linux-mtd@lists.infradead.org
Cc: linux-usb@vger.kernel.org
Cc: linux-fbdev@vger.kernel.org
Cc: dri-devel@lists.freedesktop.org

 MAINTAINERS                                   |  11 -
 arch/arm/Kconfig                              |   6 -
 arch/arm/boot/compressed/head-sa1100.S        |   4 -
 arch/arm/configs/badge4_defconfig             | 105 ---
 arch/arm/configs/cerfcube_defconfig           |  73 --
 arch/arm/configs/hackkit_defconfig            |  48 --
 arch/arm/configs/jornada720_defconfig         |   1 -
 arch/arm/configs/lart_defconfig               |  64 --
 arch/arm/configs/pleb_defconfig               |  53 --
 arch/arm/configs/pxa168_defconfig             |   3 -
 arch/arm/configs/pxa910_defconfig             |   2 -
 arch/arm/configs/shannon_defconfig            |  45 --
 arch/arm/configs/simpad_defconfig             | 100 ---
 arch/arm/mach-mmp/Kconfig                     |  96 ---
 arch/arm/mach-mmp/Makefile                    |  21 +-
 arch/arm/mach-mmp/aspenite.c                  | 284 --------
 arch/arm/mach-mmp/avengers_lite.c             |  55 --
 arch/arm/mach-mmp/brownstone.c                | 237 ------
 arch/arm/mach-mmp/common.c                    |   5 -
 arch/arm/mach-mmp/common.h                    |   2 -
 arch/arm/mach-mmp/devices.c                   | 359 ---------
 arch/arm/mach-mmp/devices.h                   |  57 --
 arch/arm/mach-mmp/flint.c                     | 131 ----
 arch/arm/mach-mmp/gplugd.c                    | 206 ------
 arch/arm/mach-mmp/irqs.h                      | 240 ------
 arch/arm/mach-mmp/jasper.c                    | 185 -----
 arch/arm/mach-mmp/mfp-mmp2.h                  | 396 ----------
 arch/arm/mach-mmp/mfp-pxa168.h                | 355 ---------
 arch/arm/mach-mmp/mfp-pxa910.h                | 170 -----
 arch/arm/mach-mmp/mfp.h                       |  35 -
 arch/arm/mach-mmp/mmp2.c                      | 175 -----
 arch/arm/mach-mmp/mmp2.h                      | 104 ---
 arch/arm/mach-mmp/pm-mmp2.c                   | 248 -------
 arch/arm/mach-mmp/pm-mmp2.h                   |  59 --
 arch/arm/mach-mmp/pm-pxa910.c                 | 272 -------
 arch/arm/mach-mmp/pm-pxa910.h                 |  75 --
 arch/arm/mach-mmp/pxa168.c                    | 175 -----
 arch/arm/mach-mmp/pxa168.h                    | 139 ----
 arch/arm/mach-mmp/pxa910.c                    | 190 -----
 arch/arm/mach-mmp/pxa910.h                    |  90 ---
 arch/arm/mach-mmp/regs-apbc.h                 |  19 -
 arch/arm/mach-mmp/regs-apmu.h                 |  28 -
 arch/arm/mach-mmp/regs-icu.h                  |  69 --
 arch/arm/mach-mmp/regs-timers.h               |   5 -
 arch/arm/mach-mmp/regs-usb.h                  | 155 ----
 arch/arm/mach-mmp/sram.c                      | 167 -----
 arch/arm/mach-mmp/teton_bga.c                 | 100 ---
 arch/arm/mach-mmp/teton_bga.h                 |  22 -
 arch/arm/mach-mmp/time.c                      |   9 +-
 arch/arm/mach-mmp/ttc_dkb.c                   | 315 --------
 arch/arm/mach-sa1100/Kconfig                  | 112 ---
 arch/arm/mach-sa1100/Makefile                 |  21 -
 arch/arm/mach-sa1100/assabet.c                |   1 -
 arch/arm/mach-sa1100/badge4.c                 | 338 ---------
 arch/arm/mach-sa1100/cerf.c                   | 181 -----
 arch/arm/mach-sa1100/collie.c                 |   1 -
 arch/arm/mach-sa1100/generic.c                |  32 -
 arch/arm/mach-sa1100/generic.h                |   4 -
 arch/arm/mach-sa1100/h3100.c                  | 140 ----
 arch/arm/mach-sa1100/h3600.c                  |   1 -
 arch/arm/mach-sa1100/hackkit.c                | 184 -----
 arch/arm/mach-sa1100/include/mach/badge4.h    |  71 --
 arch/arm/mach-sa1100/include/mach/cerf.h      |  20 -
 arch/arm/mach-sa1100/include/mach/generic.h   |   1 -
 .../arm/mach-sa1100/include/mach/nanoengine.h |  48 --
 arch/arm/mach-sa1100/include/mach/shannon.h   |  40 -
 arch/arm/mach-sa1100/include/mach/simpad.h    | 159 ----
 arch/arm/mach-sa1100/lart.c                   | 177 -----
 arch/arm/mach-sa1100/nanoengine.c             | 136 ----
 arch/arm/mach-sa1100/pci-nanoengine.c         | 191 -----
 arch/arm/mach-sa1100/pleb.c                   | 148 ----
 arch/arm/mach-sa1100/shannon.c                | 157 ----
 arch/arm/mach-sa1100/simpad.c                 | 423 -----------
 drivers/cpufreq/Kconfig                       |   2 +-
 drivers/cpufreq/Kconfig.arm                   |   3 -
 drivers/cpufreq/Makefile                      |   1 -
 drivers/cpufreq/sa1100-cpufreq.c              | 206 ------
 drivers/cpufreq/sa1110-cpufreq.c              |  38 +-
 drivers/dma/mmp_tdma.c                        |   7 +-
 drivers/mfd/Kconfig                           |   2 +-
 drivers/mtd/devices/Kconfig                   |   8 -
 drivers/mtd/devices/Makefile                  |   1 -
 drivers/mtd/devices/lart.c                    | 682 ------------------
 drivers/pcmcia/sa1100_generic.c               |   5 +-
 drivers/pcmcia/sa1100_h3600.c                 |   2 +-
 drivers/pcmcia/sa1111_generic.c               |   4 -
 drivers/usb/host/ohci-sa1111.c                |   5 +-
 drivers/video/fbdev/sa1100fb.c                |   1 -
 include/linux/platform_data/dma-mmp_tdma.h    |  36 -
 include/linux/platform_data/irda-sa11x0.h     |  17 -
 include/linux/soc/mmp/cputype.h               |  24 +-
 91 files changed, 43 insertions(+), 9352 deletions(-)
 delete mode 100644 arch/arm/configs/badge4_defconfig
 delete mode 100644 arch/arm/configs/cerfcube_defconfig
 delete mode 100644 arch/arm/configs/hackkit_defconfig
 delete mode 100644 arch/arm/configs/lart_defconfig
 delete mode 100644 arch/arm/configs/pleb_defconfig
 delete mode 100644 arch/arm/configs/shannon_defconfig
 delete mode 100644 arch/arm/configs/simpad_defconfig
 delete mode 100644 arch/arm/mach-mmp/aspenite.c
 delete mode 100644 arch/arm/mach-mmp/avengers_lite.c
 delete mode 100644 arch/arm/mach-mmp/brownstone.c
 delete mode 100644 arch/arm/mach-mmp/devices.c
 delete mode 100644 arch/arm/mach-mmp/devices.h
 delete mode 100644 arch/arm/mach-mmp/flint.c
 delete mode 100644 arch/arm/mach-mmp/gplugd.c
 delete mode 100644 arch/arm/mach-mmp/irqs.h
 delete mode 100644 arch/arm/mach-mmp/jasper.c
 delete mode 100644 arch/arm/mach-mmp/mfp-mmp2.h
 delete mode 100644 arch/arm/mach-mmp/mfp-pxa168.h
 delete mode 100644 arch/arm/mach-mmp/mfp-pxa910.h
 delete mode 100644 arch/arm/mach-mmp/mfp.h
 delete mode 100644 arch/arm/mach-mmp/mmp2.c
 delete mode 100644 arch/arm/mach-mmp/mmp2.h
 delete mode 100644 arch/arm/mach-mmp/pm-mmp2.c
 delete mode 100644 arch/arm/mach-mmp/pm-mmp2.h
 delete mode 100644 arch/arm/mach-mmp/pm-pxa910.c
 delete mode 100644 arch/arm/mach-mmp/pm-pxa910.h
 delete mode 100644 arch/arm/mach-mmp/pxa168.c
 delete mode 100644 arch/arm/mach-mmp/pxa168.h
 delete mode 100644 arch/arm/mach-mmp/pxa910.c
 delete mode 100644 arch/arm/mach-mmp/pxa910.h
 delete mode 100644 arch/arm/mach-mmp/regs-apbc.h
 delete mode 100644 arch/arm/mach-mmp/regs-apmu.h
 delete mode 100644 arch/arm/mach-mmp/regs-icu.h
 delete mode 100644 arch/arm/mach-mmp/regs-usb.h
 delete mode 100644 arch/arm/mach-mmp/sram.c
 delete mode 100644 arch/arm/mach-mmp/teton_bga.c
 delete mode 100644 arch/arm/mach-mmp/teton_bga.h
 delete mode 100644 arch/arm/mach-mmp/ttc_dkb.c
 delete mode 100644 arch/arm/mach-sa1100/badge4.c
 delete mode 100644 arch/arm/mach-sa1100/cerf.c
 delete mode 100644 arch/arm/mach-sa1100/h3100.c
 delete mode 100644 arch/arm/mach-sa1100/hackkit.c
 delete mode 100644 arch/arm/mach-sa1100/include/mach/badge4.h
 delete mode 100644 arch/arm/mach-sa1100/include/mach/cerf.h
 delete mode 100644 arch/arm/mach-sa1100/include/mach/generic.h
 delete mode 100644 arch/arm/mach-sa1100/include/mach/nanoengine.h
 delete mode 100644 arch/arm/mach-sa1100/include/mach/shannon.h
 delete mode 100644 arch/arm/mach-sa1100/include/mach/simpad.h
 delete mode 100644 arch/arm/mach-sa1100/lart.c
 delete mode 100644 arch/arm/mach-sa1100/nanoengine.c
 delete mode 100644 arch/arm/mach-sa1100/pci-nanoengine.c
 delete mode 100644 arch/arm/mach-sa1100/pleb.c
 delete mode 100644 arch/arm/mach-sa1100/shannon.c
 delete mode 100644 arch/arm/mach-sa1100/simpad.c
 delete mode 100644 drivers/cpufreq/sa1100-cpufreq.c
 delete mode 100644 drivers/mtd/devices/lart.c
 delete mode 100644 include/linux/platform_data/dma-mmp_tdma.h
 delete mode 100644 include/linux/platform_data/irda-sa11x0.h

-- 
2.29.2


______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/

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

* [PATCH 06/11] mtd: remove lart flash driver
  2022-10-21 15:49 [PATCH 00/11] ARM: sa1100, mmp: drop unused board files Arnd Bergmann
@ 2022-10-21 15:49 ` Arnd Bergmann
  2022-11-07 16:22   ` Miquel Raynal
  0 siblings, 1 reply; 3+ messages in thread
From: Arnd Bergmann @ 2022-10-21 15:49 UTC (permalink / raw)
  To: linux-arm-kernel, Russell King, Linus Walleij, Lubomir Rintel,
	Miquel Raynal, Richard Weinberger, Vignesh Raghavendra
  Cc: linux-kernel, Arnd Bergmann, linux-mtd

From: Arnd Bergmann <arnd@arndb.de>

The sa1100 lart platform was removed, so its flash driver is
no longer useful.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
 drivers/mtd/devices/Kconfig  |   8 -
 drivers/mtd/devices/Makefile |   1 -
 drivers/mtd/devices/lart.c   | 682 -----------------------------------
 3 files changed, 691 deletions(-)
 delete mode 100644 drivers/mtd/devices/lart.c

diff --git a/drivers/mtd/devices/Kconfig b/drivers/mtd/devices/Kconfig
index 79cb981ececc..ff2f9e55ef28 100644
--- a/drivers/mtd/devices/Kconfig
+++ b/drivers/mtd/devices/Kconfig
@@ -136,14 +136,6 @@ config MTD_PHRAM
 	  doesn't have access to, memory beyond the mem=xxx limit, nvram,
 	  memory on the video card, etc...
 
-config MTD_LART
-	tristate "28F160xx flash driver for LART"
-	depends on SA1100_LART
-	help
-	  This enables the flash driver for LART. Please note that you do
-	  not need any mapping/chip driver for LART. This one does it all
-	  for you, so go disable all of those if you enabled some of them (:
-
 config MTD_MTDRAM
 	tristate "Test driver using RAM"
 	help
diff --git a/drivers/mtd/devices/Makefile b/drivers/mtd/devices/Makefile
index 0362cf6bdc67..d11eb2b8b6f8 100644
--- a/drivers/mtd/devices/Makefile
+++ b/drivers/mtd/devices/Makefile
@@ -9,7 +9,6 @@ obj-$(CONFIG_MTD_PHRAM)		+= phram.o
 obj-$(CONFIG_MTD_PMC551)	+= pmc551.o
 obj-$(CONFIG_MTD_MS02NV)	+= ms02-nv.o
 obj-$(CONFIG_MTD_MTDRAM)	+= mtdram.o
-obj-$(CONFIG_MTD_LART)		+= lart.o
 obj-$(CONFIG_MTD_BLOCK2MTD)	+= block2mtd.o
 obj-$(CONFIG_MTD_DATAFLASH)	+= mtd_dataflash.o
 obj-$(CONFIG_MTD_MCHP23K256)	+= mchp23k256.o
diff --git a/drivers/mtd/devices/lart.c b/drivers/mtd/devices/lart.c
deleted file mode 100644
index aecd441e4183..000000000000
--- a/drivers/mtd/devices/lart.c
+++ /dev/null
@@ -1,682 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0-only
-
-/*
- * MTD driver for the 28F160F3 Flash Memory (non-CFI) on LART.
- *
- * Author: Abraham vd Merwe <abraham@2d3d.co.za>
- *
- * Copyright (c) 2001, 2d3D, Inc.
- *
- * References:
- *
- *    [1] 3 Volt Fast Boot Block Flash Memory" Intel Datasheet
- *           - Order Number: 290644-005
- *           - January 2000
- *
- *    [2] MTD internal API documentation
- *           - http://www.linux-mtd.infradead.org/ 
- *
- * Limitations:
- *
- *    Even though this driver is written for 3 Volt Fast Boot
- *    Block Flash Memory, it is rather specific to LART. With
- *    Minor modifications, notably the without data/address line
- *    mangling and different bus settings, etc. it should be
- *    trivial to adapt to other platforms.
- *
- *    If somebody would sponsor me a different board, I'll
- *    adapt the driver (:
- */
-
-/* debugging */
-//#define LART_DEBUG
-
-#include <linux/kernel.h>
-#include <linux/module.h>
-#include <linux/types.h>
-#include <linux/init.h>
-#include <linux/errno.h>
-#include <linux/string.h>
-#include <linux/mtd/mtd.h>
-#include <linux/mtd/partitions.h>
-
-#ifndef CONFIG_SA1100_LART
-#error This is for LART architecture only
-#endif
-
-static char module_name[] = "lart";
-
-/*
- * These values is specific to 28Fxxxx3 flash memory.
- * See section 2.3.1 in "3 Volt Fast Boot Block Flash Memory" Intel Datasheet
- */
-#define FLASH_BLOCKSIZE_PARAM		(4096 * BUSWIDTH)
-#define FLASH_NUMBLOCKS_16m_PARAM	8
-#define FLASH_NUMBLOCKS_8m_PARAM	8
-
-/*
- * These values is specific to 28Fxxxx3 flash memory.
- * See section 2.3.2 in "3 Volt Fast Boot Block Flash Memory" Intel Datasheet
- */
-#define FLASH_BLOCKSIZE_MAIN		(32768 * BUSWIDTH)
-#define FLASH_NUMBLOCKS_16m_MAIN	31
-#define FLASH_NUMBLOCKS_8m_MAIN		15
-
-/*
- * These values are specific to LART
- */
-
-/* general */
-#define BUSWIDTH			4				/* don't change this - a lot of the code _will_ break if you change this */
-#define FLASH_OFFSET		0xe8000000		/* see linux/arch/arm/mach-sa1100/lart.c */
-
-/* blob */
-#define NUM_BLOB_BLOCKS		FLASH_NUMBLOCKS_16m_PARAM
-#define PART_BLOB_START		0x00000000
-#define PART_BLOB_LEN		(NUM_BLOB_BLOCKS * FLASH_BLOCKSIZE_PARAM)
-
-/* kernel */
-#define NUM_KERNEL_BLOCKS	7
-#define PART_KERNEL_START	(PART_BLOB_START + PART_BLOB_LEN)
-#define PART_KERNEL_LEN		(NUM_KERNEL_BLOCKS * FLASH_BLOCKSIZE_MAIN)
-
-/* initial ramdisk */
-#define NUM_INITRD_BLOCKS	24
-#define PART_INITRD_START	(PART_KERNEL_START + PART_KERNEL_LEN)
-#define PART_INITRD_LEN		(NUM_INITRD_BLOCKS * FLASH_BLOCKSIZE_MAIN)
-
-/*
- * See section 4.0 in "3 Volt Fast Boot Block Flash Memory" Intel Datasheet
- */
-#define READ_ARRAY			0x00FF00FF		/* Read Array/Reset */
-#define READ_ID_CODES		0x00900090		/* Read Identifier Codes */
-#define ERASE_SETUP			0x00200020		/* Block Erase */
-#define ERASE_CONFIRM		0x00D000D0		/* Block Erase and Program Resume */
-#define PGM_SETUP			0x00400040		/* Program */
-#define STATUS_READ			0x00700070		/* Read Status Register */
-#define STATUS_CLEAR		0x00500050		/* Clear Status Register */
-#define STATUS_BUSY			0x00800080		/* Write State Machine Status (WSMS) */
-#define STATUS_ERASE_ERR	0x00200020		/* Erase Status (ES) */
-#define STATUS_PGM_ERR		0x00100010		/* Program Status (PS) */
-
-/*
- * See section 4.2 in "3 Volt Fast Boot Block Flash Memory" Intel Datasheet
- */
-#define FLASH_MANUFACTURER			0x00890089
-#define FLASH_DEVICE_8mbit_TOP		0x88f188f1
-#define FLASH_DEVICE_8mbit_BOTTOM	0x88f288f2
-#define FLASH_DEVICE_16mbit_TOP		0x88f388f3
-#define FLASH_DEVICE_16mbit_BOTTOM	0x88f488f4
-
-/***************************************************************************************************/
-
-/*
- * The data line mapping on LART is as follows:
- *
- *   	 U2  CPU |   U3  CPU
- *   	 -------------------
- *   	  0  20  |   0   12
- *   	  1  22  |   1   14
- *   	  2  19  |   2   11
- *   	  3  17  |   3   9
- *   	  4  24  |   4   0
- *   	  5  26  |   5   2
- *   	  6  31  |   6   7
- *   	  7  29  |   7   5
- *   	  8  21  |   8   13
- *   	  9  23  |   9   15
- *   	  10 18  |   10  10
- *   	  11 16  |   11  8
- *   	  12 25  |   12  1
- *   	  13 27  |   13  3
- *   	  14 30  |   14  6
- *   	  15 28  |   15  4
- */
-
-/* Mangle data (x) */
-#define DATA_TO_FLASH(x)				\
-	(									\
-		(((x) & 0x08009000) >> 11)	+	\
-		(((x) & 0x00002000) >> 10)	+	\
-		(((x) & 0x04004000) >> 8)	+	\
-		(((x) & 0x00000010) >> 4)	+	\
-		(((x) & 0x91000820) >> 3)	+	\
-		(((x) & 0x22080080) >> 2)	+	\
-		((x) & 0x40000400)			+	\
-		(((x) & 0x00040040) << 1)	+	\
-		(((x) & 0x00110000) << 4)	+	\
-		(((x) & 0x00220100) << 5)	+	\
-		(((x) & 0x00800208) << 6)	+	\
-		(((x) & 0x00400004) << 9)	+	\
-		(((x) & 0x00000001) << 12)	+	\
-		(((x) & 0x00000002) << 13)		\
-	)
-
-/* Unmangle data (x) */
-#define FLASH_TO_DATA(x)				\
-	(									\
-		(((x) & 0x00010012) << 11)	+	\
-		(((x) & 0x00000008) << 10)	+	\
-		(((x) & 0x00040040) << 8)	+	\
-		(((x) & 0x00000001) << 4)	+	\
-		(((x) & 0x12200104) << 3)	+	\
-		(((x) & 0x08820020) << 2)	+	\
-		((x) & 0x40000400)			+	\
-		(((x) & 0x00080080) >> 1)	+	\
-		(((x) & 0x01100000) >> 4)	+	\
-		(((x) & 0x04402000) >> 5)	+	\
-		(((x) & 0x20008200) >> 6)	+	\
-		(((x) & 0x80000800) >> 9)	+	\
-		(((x) & 0x00001000) >> 12)	+	\
-		(((x) & 0x00004000) >> 13)		\
-	)
-
-/*
- * The address line mapping on LART is as follows:
- *
- *   	 U3  CPU |   U2  CPU
- *   	 -------------------
- *   	  0  2   |   0   2
- *   	  1  3   |   1   3
- *   	  2  9   |   2   9
- *   	  3  13  |   3   8
- *   	  4  8   |   4   7
- *   	  5  12  |   5   6
- *   	  6  11  |   6   5
- *   	  7  10  |   7   4
- *   	  8  4   |   8   10
- *   	  9  5   |   9   11
- *   	 10  6   |   10  12
- *   	 11  7   |   11  13
- *
- *   	 BOOT BLOCK BOUNDARY
- *
- *   	 12  15  |   12  15
- *   	 13  14  |   13  14
- *   	 14  16  |   14  16
- *
- *   	 MAIN BLOCK BOUNDARY
- *
- *   	 15  17  |   15  18
- *   	 16  18  |   16  17
- *   	 17  20  |   17  20
- *   	 18  19  |   18  19
- *   	 19  21  |   19  21
- *
- * As we can see from above, the addresses aren't mangled across
- * block boundaries, so we don't need to worry about address
- * translations except for sending/reading commands during
- * initialization
- */
-
-/* Mangle address (x) on chip U2 */
-#define ADDR_TO_FLASH_U2(x)				\
-	(									\
-		(((x) & 0x00000f00) >> 4)	+	\
-		(((x) & 0x00042000) << 1)	+	\
-		(((x) & 0x0009c003) << 2)	+	\
-		(((x) & 0x00021080) << 3)	+	\
-		(((x) & 0x00000010) << 4)	+	\
-		(((x) & 0x00000040) << 5)	+	\
-		(((x) & 0x00000024) << 7)	+	\
-		(((x) & 0x00000008) << 10)		\
-	)
-
-/* Unmangle address (x) on chip U2 */
-#define FLASH_U2_TO_ADDR(x)				\
-	(									\
-		(((x) << 4) & 0x00000f00)	+	\
-		(((x) >> 1) & 0x00042000)	+	\
-		(((x) >> 2) & 0x0009c003)	+	\
-		(((x) >> 3) & 0x00021080)	+	\
-		(((x) >> 4) & 0x00000010)	+	\
-		(((x) >> 5) & 0x00000040)	+	\
-		(((x) >> 7) & 0x00000024)	+	\
-		(((x) >> 10) & 0x00000008)		\
-	)
-
-/* Mangle address (x) on chip U3 */
-#define ADDR_TO_FLASH_U3(x)				\
-	(									\
-		(((x) & 0x00000080) >> 3)	+	\
-		(((x) & 0x00000040) >> 1)	+	\
-		(((x) & 0x00052020) << 1)	+	\
-		(((x) & 0x00084f03) << 2)	+	\
-		(((x) & 0x00029010) << 3)	+	\
-		(((x) & 0x00000008) << 5)	+	\
-		(((x) & 0x00000004) << 7)		\
-	)
-
-/* Unmangle address (x) on chip U3 */
-#define FLASH_U3_TO_ADDR(x)				\
-	(									\
-		(((x) << 3) & 0x00000080)	+	\
-		(((x) << 1) & 0x00000040)	+	\
-		(((x) >> 1) & 0x00052020)	+	\
-		(((x) >> 2) & 0x00084f03)	+	\
-		(((x) >> 3) & 0x00029010)	+	\
-		(((x) >> 5) & 0x00000008)	+	\
-		(((x) >> 7) & 0x00000004)		\
-	)
-
-/***************************************************************************************************/
-
-static __u8 read8 (__u32 offset)
-{
-   volatile __u8 *data = (__u8 *) (FLASH_OFFSET + offset);
-#ifdef LART_DEBUG
-   printk (KERN_DEBUG "%s(): 0x%.8x -> 0x%.2x\n", __func__, offset, *data);
-#endif
-   return (*data);
-}
-
-static __u32 read32 (__u32 offset)
-{
-   volatile __u32 *data = (__u32 *) (FLASH_OFFSET + offset);
-#ifdef LART_DEBUG
-   printk (KERN_DEBUG "%s(): 0x%.8x -> 0x%.8x\n", __func__, offset, *data);
-#endif
-   return (*data);
-}
-
-static void write32 (__u32 x,__u32 offset)
-{
-   volatile __u32 *data = (__u32 *) (FLASH_OFFSET + offset);
-   *data = x;
-#ifdef LART_DEBUG
-   printk (KERN_DEBUG "%s(): 0x%.8x <- 0x%.8x\n", __func__, offset, *data);
-#endif
-}
-
-/***************************************************************************************************/
-
-/*
- * Probe for 16mbit flash memory on a LART board without doing
- * too much damage. Since we need to write 1 dword to memory,
- * we're f**cked if this happens to be DRAM since we can't
- * restore the memory (otherwise we might exit Read Array mode).
- *
- * Returns 1 if we found 16mbit flash memory on LART, 0 otherwise.
- */
-static int flash_probe (void)
-{
-   __u32 manufacturer,devtype;
-
-   /* setup "Read Identifier Codes" mode */
-   write32 (DATA_TO_FLASH (READ_ID_CODES),0x00000000);
-
-   /* probe U2. U2/U3 returns the same data since the first 3
-	* address lines is mangled in the same way */
-   manufacturer = FLASH_TO_DATA (read32 (ADDR_TO_FLASH_U2 (0x00000000)));
-   devtype = FLASH_TO_DATA (read32 (ADDR_TO_FLASH_U2 (0x00000001)));
-
-   /* put the flash back into command mode */
-   write32 (DATA_TO_FLASH (READ_ARRAY),0x00000000);
-
-   return (manufacturer == FLASH_MANUFACTURER && (devtype == FLASH_DEVICE_16mbit_TOP || devtype == FLASH_DEVICE_16mbit_BOTTOM));
-}
-
-/*
- * Erase one block of flash memory at offset ``offset'' which is any
- * address within the block which should be erased.
- *
- * Returns 1 if successful, 0 otherwise.
- */
-static inline int erase_block (__u32 offset)
-{
-   __u32 status;
-
-#ifdef LART_DEBUG
-   printk (KERN_DEBUG "%s(): 0x%.8x\n", __func__, offset);
-#endif
-
-   /* erase and confirm */
-   write32 (DATA_TO_FLASH (ERASE_SETUP),offset);
-   write32 (DATA_TO_FLASH (ERASE_CONFIRM),offset);
-
-   /* wait for block erase to finish */
-   do
-	 {
-		write32 (DATA_TO_FLASH (STATUS_READ),offset);
-		status = FLASH_TO_DATA (read32 (offset));
-	 }
-   while ((~status & STATUS_BUSY) != 0);
-
-   /* put the flash back into command mode */
-   write32 (DATA_TO_FLASH (READ_ARRAY),offset);
-
-   /* was the erase successful? */
-   if ((status & STATUS_ERASE_ERR))
-	 {
-		printk (KERN_WARNING "%s: erase error at address 0x%.8x.\n",module_name,offset);
-		return (0);
-	 }
-
-   return (1);
-}
-
-static int flash_erase (struct mtd_info *mtd,struct erase_info *instr)
-{
-   __u32 addr,len;
-   int i,first;
-
-#ifdef LART_DEBUG
-   printk (KERN_DEBUG "%s(addr = 0x%.8x, len = %d)\n", __func__, instr->addr, instr->len);
-#endif
-
-   /*
-	* check that both start and end of the requested erase are
-	* aligned with the erasesize at the appropriate addresses.
-	*
-	* skip all erase regions which are ended before the start of
-	* the requested erase. Actually, to save on the calculations,
-	* we skip to the first erase region which starts after the
-	* start of the requested erase, and then go back one.
-	*/
-   for (i = 0; i < mtd->numeraseregions && instr->addr >= mtd->eraseregions[i].offset; i++) ;
-   i--;
-
-   /*
-	* ok, now i is pointing at the erase region in which this
-	* erase request starts. Check the start of the requested
-	* erase range is aligned with the erase size which is in
-	* effect here.
-	*/
-   if (i < 0 || (instr->addr & (mtd->eraseregions[i].erasesize - 1)))
-      return -EINVAL;
-
-   /* Remember the erase region we start on */
-   first = i;
-
-   /*
-	* next, check that the end of the requested erase is aligned
-	* with the erase region at that address.
-	*
-	* as before, drop back one to point at the region in which
-	* the address actually falls
-	*/
-   for (; i < mtd->numeraseregions && instr->addr + instr->len >= mtd->eraseregions[i].offset; i++) ;
-   i--;
-
-   /* is the end aligned on a block boundary? */
-   if (i < 0 || ((instr->addr + instr->len) & (mtd->eraseregions[i].erasesize - 1)))
-      return -EINVAL;
-
-   addr = instr->addr;
-   len = instr->len;
-
-   i = first;
-
-   /* now erase those blocks */
-   while (len)
-	 {
-		if (!erase_block (addr))
-			 return (-EIO);
-
-		addr += mtd->eraseregions[i].erasesize;
-		len -= mtd->eraseregions[i].erasesize;
-
-		if (addr == mtd->eraseregions[i].offset + (mtd->eraseregions[i].erasesize * mtd->eraseregions[i].numblocks)) i++;
-	 }
-
-   return (0);
-}
-
-static int flash_read (struct mtd_info *mtd,loff_t from,size_t len,size_t *retlen,u_char *buf)
-{
-#ifdef LART_DEBUG
-   printk (KERN_DEBUG "%s(from = 0x%.8x, len = %d)\n", __func__, (__u32)from, len);
-#endif
-
-   /* we always read len bytes */
-   *retlen = len;
-
-   /* first, we read bytes until we reach a dword boundary */
-   if (from & (BUSWIDTH - 1))
-	 {
-		int gap = BUSWIDTH - (from & (BUSWIDTH - 1));
-
-		while (len && gap--) {
-			*buf++ = read8 (from++);
-			len--;
-		}
-	 }
-
-   /* now we read dwords until we reach a non-dword boundary */
-   while (len >= BUSWIDTH)
-	 {
-		*((__u32 *) buf) = read32 (from);
-
-		buf += BUSWIDTH;
-		from += BUSWIDTH;
-		len -= BUSWIDTH;
-	 }
-
-   /* top up the last unaligned bytes */
-   if (len & (BUSWIDTH - 1))
-	 while (len--) *buf++ = read8 (from++);
-
-   return (0);
-}
-
-/*
- * Write one dword ``x'' to flash memory at offset ``offset''. ``offset''
- * must be 32 bits, i.e. it must be on a dword boundary.
- *
- * Returns 1 if successful, 0 otherwise.
- */
-static inline int write_dword (__u32 offset,__u32 x)
-{
-   __u32 status;
-
-#ifdef LART_DEBUG
-   printk (KERN_DEBUG "%s(): 0x%.8x <- 0x%.8x\n", __func__, offset, x);
-#endif
-
-   /* setup writing */
-   write32 (DATA_TO_FLASH (PGM_SETUP),offset);
-
-   /* write the data */
-   write32 (x,offset);
-
-   /* wait for the write to finish */
-   do
-	 {
-		write32 (DATA_TO_FLASH (STATUS_READ),offset);
-		status = FLASH_TO_DATA (read32 (offset));
-	 }
-   while ((~status & STATUS_BUSY) != 0);
-
-   /* put the flash back into command mode */
-   write32 (DATA_TO_FLASH (READ_ARRAY),offset);
-
-   /* was the write successful? */
-   if ((status & STATUS_PGM_ERR) || read32 (offset) != x)
-	 {
-		printk (KERN_WARNING "%s: write error at address 0x%.8x.\n",module_name,offset);
-		return (0);
-	 }
-
-   return (1);
-}
-
-static int flash_write (struct mtd_info *mtd,loff_t to,size_t len,size_t *retlen,const u_char *buf)
-{
-   __u8 tmp[4];
-   int i,n;
-
-#ifdef LART_DEBUG
-   printk (KERN_DEBUG "%s(to = 0x%.8x, len = %d)\n", __func__, (__u32)to, len);
-#endif
-
-   /* sanity checks */
-   if (!len) return (0);
-
-   /* first, we write a 0xFF.... padded byte until we reach a dword boundary */
-   if (to & (BUSWIDTH - 1))
-	 {
-		__u32 aligned = to & ~(BUSWIDTH - 1);
-		int gap = to - aligned;
-
-		i = n = 0;
-
-		while (gap--) tmp[i++] = 0xFF;
-		while (len && i < BUSWIDTH) {
-			tmp[i++] = buf[n++];
-			len--;
-		}
-		while (i < BUSWIDTH) tmp[i++] = 0xFF;
-
-		if (!write_dword (aligned,*((__u32 *) tmp))) return (-EIO);
-
-		to += n;
-		buf += n;
-		*retlen += n;
-	 }
-
-   /* now we write dwords until we reach a non-dword boundary */
-   while (len >= BUSWIDTH)
-	 {
-		if (!write_dword (to,*((__u32 *) buf))) return (-EIO);
-
-		to += BUSWIDTH;
-		buf += BUSWIDTH;
-		*retlen += BUSWIDTH;
-		len -= BUSWIDTH;
-	 }
-
-   /* top up the last unaligned bytes, padded with 0xFF.... */
-   if (len & (BUSWIDTH - 1))
-	 {
-		i = n = 0;
-
-		while (len--) tmp[i++] = buf[n++];
-		while (i < BUSWIDTH) tmp[i++] = 0xFF;
-
-		if (!write_dword (to,*((__u32 *) tmp))) return (-EIO);
-
-		*retlen += n;
-	 }
-
-   return (0);
-}
-
-/***************************************************************************************************/
-
-static struct mtd_info mtd;
-
-static struct mtd_erase_region_info erase_regions[] = {
-	/* parameter blocks */
-	{
-		.offset		= 0x00000000,
-		.erasesize	= FLASH_BLOCKSIZE_PARAM,
-		.numblocks	= FLASH_NUMBLOCKS_16m_PARAM,
-	},
-	/* main blocks */
-	{
-		.offset	 = FLASH_BLOCKSIZE_PARAM * FLASH_NUMBLOCKS_16m_PARAM,
-		.erasesize	= FLASH_BLOCKSIZE_MAIN,
-		.numblocks	= FLASH_NUMBLOCKS_16m_MAIN,
-	}
-};
-
-static const struct mtd_partition lart_partitions[] = {
-	/* blob */
-	{
-		.name	= "blob",
-		.offset	= PART_BLOB_START,
-		.size	= PART_BLOB_LEN,
-	},
-	/* kernel */
-	{
-		.name	= "kernel",
-		.offset	= PART_KERNEL_START,	/* MTDPART_OFS_APPEND */
-		.size	= PART_KERNEL_LEN,
-	},
-	/* initial ramdisk / file system */
-	{
-		.name	= "file system",
-		.offset	= PART_INITRD_START,	/* MTDPART_OFS_APPEND */
-		.size	= PART_INITRD_LEN,	/* MTDPART_SIZ_FULL */
-	}
-};
-#define NUM_PARTITIONS ARRAY_SIZE(lart_partitions)
-
-static int __init lart_flash_init (void)
-{
-   int result;
-   memset (&mtd,0,sizeof (mtd));
-   printk ("MTD driver for LART. Written by Abraham vd Merwe <abraham@2d3d.co.za>\n");
-   printk ("%s: Probing for 28F160x3 flash on LART...\n",module_name);
-   if (!flash_probe ())
-	 {
-		printk (KERN_WARNING "%s: Found no LART compatible flash device\n",module_name);
-		return (-ENXIO);
-	 }
-   printk ("%s: This looks like a LART board to me.\n",module_name);
-   mtd.name = module_name;
-   mtd.type = MTD_NORFLASH;
-   mtd.writesize = 1;
-   mtd.writebufsize = 4;
-   mtd.flags = MTD_CAP_NORFLASH;
-   mtd.size = FLASH_BLOCKSIZE_PARAM * FLASH_NUMBLOCKS_16m_PARAM + FLASH_BLOCKSIZE_MAIN * FLASH_NUMBLOCKS_16m_MAIN;
-   mtd.erasesize = FLASH_BLOCKSIZE_MAIN;
-   mtd.numeraseregions = ARRAY_SIZE(erase_regions);
-   mtd.eraseregions = erase_regions;
-   mtd._erase = flash_erase;
-   mtd._read = flash_read;
-   mtd._write = flash_write;
-   mtd.owner = THIS_MODULE;
-
-#ifdef LART_DEBUG
-   printk (KERN_DEBUG
-		   "mtd.name = %s\n"
-		   "mtd.size = 0x%.8x (%uM)\n"
-		   "mtd.erasesize = 0x%.8x (%uK)\n"
-		   "mtd.numeraseregions = %d\n",
-		   mtd.name,
-		   mtd.size,mtd.size / (1024*1024),
-		   mtd.erasesize,mtd.erasesize / 1024,
-		   mtd.numeraseregions);
-
-   if (mtd.numeraseregions)
-	 for (result = 0; result < mtd.numeraseregions; result++)
-	   printk (KERN_DEBUG
-			   "\n\n"
-			   "mtd.eraseregions[%d].offset = 0x%.8x\n"
-			   "mtd.eraseregions[%d].erasesize = 0x%.8x (%uK)\n"
-			   "mtd.eraseregions[%d].numblocks = %d\n",
-			   result,mtd.eraseregions[result].offset,
-			   result,mtd.eraseregions[result].erasesize,mtd.eraseregions[result].erasesize / 1024,
-			   result,mtd.eraseregions[result].numblocks);
-
-   printk ("\npartitions = %d\n", ARRAY_SIZE(lart_partitions));
-
-   for (result = 0; result < ARRAY_SIZE(lart_partitions); result++)
-	 printk (KERN_DEBUG
-			 "\n\n"
-			 "lart_partitions[%d].name = %s\n"
-			 "lart_partitions[%d].offset = 0x%.8x\n"
-			 "lart_partitions[%d].size = 0x%.8x (%uK)\n",
-			 result,lart_partitions[result].name,
-			 result,lart_partitions[result].offset,
-			 result,lart_partitions[result].size,lart_partitions[result].size / 1024);
-#endif
-
-   result = mtd_device_register(&mtd, lart_partitions,
-                                ARRAY_SIZE(lart_partitions));
-
-   return (result);
-}
-
-static void __exit lart_flash_exit (void)
-{
-   mtd_device_unregister(&mtd);
-}
-
-module_init (lart_flash_init);
-module_exit (lart_flash_exit);
-
-MODULE_LICENSE("GPL");
-MODULE_AUTHOR("Abraham vd Merwe <abraham@2d3d.co.za>");
-MODULE_DESCRIPTION("MTD driver for Intel 28F160F3 on LART board");
-- 
2.29.2


______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/

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

* Re: [PATCH 06/11] mtd: remove lart flash driver
  2022-10-21 15:49 ` [PATCH 06/11] mtd: remove lart flash driver Arnd Bergmann
@ 2022-11-07 16:22   ` Miquel Raynal
  0 siblings, 0 replies; 3+ messages in thread
From: Miquel Raynal @ 2022-11-07 16:22 UTC (permalink / raw)
  To: Arnd Bergmann, linux-arm-kernel, Russell King, Linus Walleij,
	Lubomir Rintel, Miquel Raynal, Richard Weinberger,
	Vignesh Raghavendra
  Cc: linux-kernel, Arnd Bergmann, linux-mtd

On Fri, 2022-10-21 at 15:49:36 UTC, Arnd Bergmann wrote:
> From: Arnd Bergmann <arnd@arndb.de>
> 
> The sa1100 lart platform was removed, so its flash driver is
> no longer useful.
> 
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>

Applied to https://git.kernel.org/pub/scm/linux/kernel/git/mtd/linux.git mtd/next, thanks.

Miquel

______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/

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

end of thread, other threads:[~2022-11-07 16:35 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-10-21 15:49 [PATCH 00/11] ARM: sa1100, mmp: drop unused board files Arnd Bergmann
2022-10-21 15:49 ` [PATCH 06/11] mtd: remove lart flash driver Arnd Bergmann
2022-11-07 16:22   ` Miquel Raynal

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).