mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2026-09-18 23:09:29 +02:00
Defining a static array in a header results in each .c file that includes the header (here: drivers/memory/omap-gpmc.c and drivers/mtd/nand/raw/omap2.c) to contain a copy of that array when compiled to an object file. With sizeof(struct of_device_id[3]) ≥ 588 having omap_nand_ids[] twice just to do two string comparisons is quite some bloat. So move omap_nand_ids[] to the nand driver which actually needs that array for its module meta data and do the compatible check by hand. bloat-o-meter reports for drivers/memory/omap-gpmc.o (ARCH=arm): add/remove: 1/2 grow/shrink: 1/0 up/down: 28/-588 (-560) Function old new delta gpmc_probe_generic_child 2108 2136 +28 omap_nand_ids 588 - -588 Total: Before=18114, After=17554, chg -3.09% (drivers/mtd/nand/raw/omap2.o doesn't change). This allows to drop <linux/mod_devicetable.h> from include/linux/platform_data/mtd-nand-omap2.h (which is my original motivation for this change). Note that this header isn't needed in the two drivers because omap-gpmc.c doesn't use any device id struct and for the nand driver omap2.c of_device_id is already provided via <linux/platform_device.h>. Signed-off-by: Uwe Kleine-König (The Capable Hub) <u.kleine-koenig@baylibre.com> Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
66 lines
2.0 KiB
C
66 lines
2.0 KiB
C
/* SPDX-License-Identifier: GPL-2.0-only */
|
|
/*
|
|
* Copyright (C) 2006 Micron Technology Inc.
|
|
*/
|
|
|
|
#ifndef _MTD_NAND_OMAP2_H
|
|
#define _MTD_NAND_OMAP2_H
|
|
|
|
#include <linux/mtd/partitions.h>
|
|
|
|
#define GPMC_BCH_NUM_REMAINDER 8
|
|
|
|
enum nand_io {
|
|
NAND_OMAP_PREFETCH_POLLED = 0, /* prefetch polled mode, default */
|
|
NAND_OMAP_POLLED, /* polled mode, without prefetch */
|
|
NAND_OMAP_PREFETCH_DMA, /* prefetch enabled sDMA mode */
|
|
NAND_OMAP_PREFETCH_IRQ /* prefetch enabled irq mode */
|
|
};
|
|
|
|
enum omap_ecc {
|
|
/*
|
|
* 1-bit ECC: calculation and correction by SW
|
|
* ECC stored at end of spare area
|
|
*/
|
|
OMAP_ECC_HAM1_CODE_SW = 0,
|
|
|
|
/*
|
|
* 1-bit ECC: calculation by GPMC, Error detection by Software
|
|
* ECC layout compatible with ROM code layout
|
|
*/
|
|
OMAP_ECC_HAM1_CODE_HW,
|
|
/* 4-bit ECC calculation by GPMC, Error detection by Software */
|
|
OMAP_ECC_BCH4_CODE_HW_DETECTION_SW,
|
|
/* 4-bit ECC calculation by GPMC, Error detection by ELM */
|
|
OMAP_ECC_BCH4_CODE_HW,
|
|
/* 8-bit ECC calculation by GPMC, Error detection by Software */
|
|
OMAP_ECC_BCH8_CODE_HW_DETECTION_SW,
|
|
/* 8-bit ECC calculation by GPMC, Error detection by ELM */
|
|
OMAP_ECC_BCH8_CODE_HW,
|
|
/* 16-bit ECC calculation by GPMC, Error detection by ELM */
|
|
OMAP_ECC_BCH16_CODE_HW,
|
|
};
|
|
|
|
struct gpmc_nand_regs {
|
|
void __iomem *gpmc_nand_command;
|
|
void __iomem *gpmc_nand_address;
|
|
void __iomem *gpmc_nand_data;
|
|
void __iomem *gpmc_prefetch_config1;
|
|
void __iomem *gpmc_prefetch_config2;
|
|
void __iomem *gpmc_prefetch_control;
|
|
void __iomem *gpmc_prefetch_status;
|
|
void __iomem *gpmc_ecc_config;
|
|
void __iomem *gpmc_ecc_control;
|
|
void __iomem *gpmc_ecc_size_config;
|
|
void __iomem *gpmc_ecc1_result;
|
|
void __iomem *gpmc_bch_result0[GPMC_BCH_NUM_REMAINDER];
|
|
void __iomem *gpmc_bch_result1[GPMC_BCH_NUM_REMAINDER];
|
|
void __iomem *gpmc_bch_result2[GPMC_BCH_NUM_REMAINDER];
|
|
void __iomem *gpmc_bch_result3[GPMC_BCH_NUM_REMAINDER];
|
|
void __iomem *gpmc_bch_result4[GPMC_BCH_NUM_REMAINDER];
|
|
void __iomem *gpmc_bch_result5[GPMC_BCH_NUM_REMAINDER];
|
|
void __iomem *gpmc_bch_result6[GPMC_BCH_NUM_REMAINDER];
|
|
};
|
|
|
|
#endif /* _MTD_NAND_OMAP2_H */
|