mirror of
https://github.com/AuxXxilium/linux_dsm_epyc7002.git
synced 2024-12-28 11:18:45 +07:00
44c916d58b
This merge window brings a good size of cleanups on various platforms. Among the bigger ones: * Removal of Samsung s5pc100 and s5p64xx platforms. Both of these have lacked active support for quite a while, and after asking around nobody showed interest in keeping them around. If needed, they could be resurrected in the future but it's more likely that we would prefer reintroduction of them as DT and multiplatform-enabled platforms instead. * OMAP4 controller code register define diet. They defined a lot of registers that were never actually used, etc. * Move of some of the Tegra platform code (PMC, APBIO, fuse, powergate) to drivers/soc so it can be shared with 64-bit code. This also converts them over to traditional driver models where possible. * Removal of legacy gpio-samsung driver, since the last users have been removed (moved to pinctrl) Plus a bunch of smaller changes for various platforms that sort of dissapear in the diffstat for the above. clps711x cleanups, shmobile header file refactoring/moves for multiplatform friendliness, some misc cleanups, etc. -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.14 (GNU/Linux) iQIcBAABAgAGBQJT5DYPAAoJEIwa5zzehBx37egQAIiatNiLLqZnfo3rwGADRz/a POfPovktj68aPcobyzoyhFtToMqGvi9PpysyFTIQD2HJFG+5BtiIAuqtg0875zDe EpBWgsfugrm0YktJWAtUerj60oAmNPbKfaEm1cOOWuM2lb2mV+QkRrwSTAgsqkT7 927BzMXKKBRPOVLL0RYhoF8EXa0Eg8kCqAHP8fJrzVYkRp+UrZJDnGiUP1XmWJN+ VXQMu5SEjcPMtqT7+tfX455RfREHJfBcJ1ZN/dPF8HMWDwClQG0lyc6hifh1MxwO 8DjIZNkfZeKqgDqVyC17re7pc7p8md5HL8WXbrKpK0A9vQ5bRexbPHxcwJ1T/C2Y 465H+st5XXbuzV1gbMwjK1/ycsH0tCyffckk8Yl/2e1Fs7GgPNbAELtTdl+5vV1Y xmDXkyo/9WlRM3LQ23IGKwW7VzN86EfWVuShssfro0fO7xDdb4OOYLdQI+4bCG+h ytQYun1vU32OEyNik5RVNQuZaMrv2c93a3bID4owwuPHPmYOPVUQaqnRX/0E51eA aHZYbk2GlUOV3Kq5aSS4iyLg1Yj+I9/NeH9U+A4nc+PQ5FlgGToaVSCuYuw4DqbP AAG+sqQHbkBMvDPobQz/yd1qZbAb4eLhGy11XK1t5S65rApWI55GwNXnvbyxqt8x wpmxJTASGxcfuZZgKXm7 =gbcE -----END PGP SIGNATURE----- Merge tag 'cleanup-for-3.17' of git://git.kernel.org/pub/scm/linux/kernel/git/arm/arm-soc Pull ARM SoC cleanups from Olof Johansson: "This merge window brings a good size of cleanups on various platforms. Among the bigger ones: - Removal of Samsung s5pc100 and s5p64xx platforms. Both of these have lacked active support for quite a while, and after asking around nobody showed interest in keeping them around. If needed, they could be resurrected in the future but it's more likely that we would prefer reintroduction of them as DT and multiplatform-enabled platforms instead. - OMAP4 controller code register define diet. They defined a lot of registers that were never actually used, etc. - Move of some of the Tegra platform code (PMC, APBIO, fuse, powergate) to drivers/soc so it can be shared with 64-bit code. This also converts them over to traditional driver models where possible. - Removal of legacy gpio-samsung driver, since the last users have been removed (moved to pinctrl) Plus a bunch of smaller changes for various platforms that sort of dissapear in the diffstat for the above. clps711x cleanups, shmobile header file refactoring/moves for multiplatform friendliness, some misc cleanups, etc" * tag 'cleanup-for-3.17' of git://git.kernel.org/pub/scm/linux/kernel/git/arm/arm-soc: (117 commits) drivers: CCI: Correct use of ! and & video: clcd-versatile: Depend on ARM video: fix up versatile CLCD helper move MAINTAINERS: Add sdhci-st file to ARCH/STI architecture ARM: EXYNOS: Fix build breakge with PM_SLEEP=n MAINTAINERS: Remove Kirkwood ARM: tegra: Convert PMC to a driver soc/tegra: fuse: Set up in early initcall ARM: tegra: Always lock the CPU reset vector ARM: tegra: Setup CPU hotplug in a pure initcall soc/tegra: Implement runtime check for Tegra SoCs soc/tegra: fuse: fix dummy functions soc/tegra: fuse: move APB DMA into Tegra20 fuse driver soc/tegra: Add efuse and apbmisc bindings soc/tegra: Add efuse driver for Tegra ARM: tegra: move fuse exports to soc/tegra/fuse.h ARM: tegra: export apb dma readl/writel ARM: tegra: Use a function to get the chip ID ARM: tegra: Sort includes alphabetically ARM: tegra: Move includes to include/soc/tegra ...
158 lines
4.0 KiB
C
158 lines
4.0 KiB
C
/*
|
|
* gpmc-nand.c
|
|
*
|
|
* Copyright (C) 2009 Texas Instruments
|
|
* Vimal Singh <vimalsingh@ti.com>
|
|
*
|
|
* 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.
|
|
*/
|
|
|
|
#include <linux/kernel.h>
|
|
#include <linux/platform_device.h>
|
|
#include <linux/io.h>
|
|
#include <linux/mtd/nand.h>
|
|
#include <linux/platform_data/mtd-nand-omap2.h>
|
|
|
|
#include <asm/mach/flash.h>
|
|
|
|
#include "gpmc.h"
|
|
#include "soc.h"
|
|
#include "gpmc-nand.h"
|
|
|
|
/* minimum size for IO mapping */
|
|
#define NAND_IO_SIZE 4
|
|
|
|
static bool gpmc_hwecc_bch_capable(enum omap_ecc ecc_opt)
|
|
{
|
|
/* platforms which support all ECC schemes */
|
|
if (soc_is_am33xx() || soc_is_am43xx() || cpu_is_omap44xx() ||
|
|
soc_is_omap54xx() || soc_is_dra7xx())
|
|
return 1;
|
|
|
|
if (ecc_opt == OMAP_ECC_BCH4_CODE_HW_DETECTION_SW ||
|
|
ecc_opt == OMAP_ECC_BCH8_CODE_HW_DETECTION_SW) {
|
|
if (cpu_is_omap24xx())
|
|
return 0;
|
|
else if (cpu_is_omap3630() && (GET_OMAP_REVISION() == 0))
|
|
return 0;
|
|
else
|
|
return 1;
|
|
}
|
|
|
|
/* OMAP3xxx do not have ELM engine, so cannot support ECC schemes
|
|
* which require H/W based ECC error detection */
|
|
if ((cpu_is_omap34xx() || cpu_is_omap3630()) &&
|
|
((ecc_opt == OMAP_ECC_BCH4_CODE_HW) ||
|
|
(ecc_opt == OMAP_ECC_BCH8_CODE_HW)))
|
|
return 0;
|
|
|
|
/* legacy platforms support only HAM1 (1-bit Hamming) ECC scheme */
|
|
if (ecc_opt == OMAP_ECC_HAM1_CODE_HW)
|
|
return 1;
|
|
else
|
|
return 0;
|
|
}
|
|
|
|
/* This function will go away once the device-tree convertion is complete */
|
|
static void gpmc_set_legacy(struct omap_nand_platform_data *gpmc_nand_data,
|
|
struct gpmc_settings *s)
|
|
{
|
|
/* Enable RD PIN Monitoring Reg */
|
|
if (gpmc_nand_data->dev_ready) {
|
|
s->wait_on_read = true;
|
|
s->wait_on_write = true;
|
|
}
|
|
|
|
if (gpmc_nand_data->devsize == NAND_BUSWIDTH_16)
|
|
s->device_width = GPMC_DEVWIDTH_16BIT;
|
|
else
|
|
s->device_width = GPMC_DEVWIDTH_8BIT;
|
|
}
|
|
|
|
int gpmc_nand_init(struct omap_nand_platform_data *gpmc_nand_data,
|
|
struct gpmc_timings *gpmc_t)
|
|
{
|
|
int err = 0;
|
|
struct gpmc_settings s;
|
|
struct platform_device *pdev;
|
|
struct resource gpmc_nand_res[] = {
|
|
{ .flags = IORESOURCE_MEM, },
|
|
{ .flags = IORESOURCE_IRQ, },
|
|
{ .flags = IORESOURCE_IRQ, },
|
|
};
|
|
|
|
BUG_ON(gpmc_nand_data->cs >= GPMC_CS_NUM);
|
|
|
|
err = gpmc_cs_request(gpmc_nand_data->cs, NAND_IO_SIZE,
|
|
(unsigned long *)&gpmc_nand_res[0].start);
|
|
if (err < 0) {
|
|
pr_err("omap2-gpmc: Cannot request GPMC CS %d, error %d\n",
|
|
gpmc_nand_data->cs, err);
|
|
return err;
|
|
}
|
|
gpmc_nand_res[0].end = gpmc_nand_res[0].start + NAND_IO_SIZE - 1;
|
|
gpmc_nand_res[1].start = gpmc_get_client_irq(GPMC_IRQ_FIFOEVENTENABLE);
|
|
gpmc_nand_res[2].start = gpmc_get_client_irq(GPMC_IRQ_COUNT_EVENT);
|
|
|
|
if (gpmc_t) {
|
|
err = gpmc_cs_set_timings(gpmc_nand_data->cs, gpmc_t);
|
|
if (err < 0) {
|
|
pr_err("omap2-gpmc: Unable to set gpmc timings: %d\n", err);
|
|
return err;
|
|
}
|
|
}
|
|
|
|
memset(&s, 0, sizeof(struct gpmc_settings));
|
|
if (gpmc_nand_data->of_node)
|
|
gpmc_read_settings_dt(gpmc_nand_data->of_node, &s);
|
|
else
|
|
gpmc_set_legacy(gpmc_nand_data, &s);
|
|
|
|
s.device_nand = true;
|
|
err = gpmc_cs_program_settings(gpmc_nand_data->cs, &s);
|
|
if (err < 0)
|
|
goto out_free_cs;
|
|
|
|
err = gpmc_configure(GPMC_CONFIG_WP, 0);
|
|
if (err < 0)
|
|
goto out_free_cs;
|
|
|
|
gpmc_update_nand_reg(&gpmc_nand_data->reg, gpmc_nand_data->cs);
|
|
|
|
if (!gpmc_hwecc_bch_capable(gpmc_nand_data->ecc_opt)) {
|
|
pr_err("omap2-nand: Unsupported NAND ECC scheme selected\n");
|
|
err = -EINVAL;
|
|
goto out_free_cs;
|
|
}
|
|
|
|
|
|
pdev = platform_device_alloc("omap2-nand", gpmc_nand_data->cs);
|
|
if (pdev) {
|
|
err = platform_device_add_resources(pdev, gpmc_nand_res,
|
|
ARRAY_SIZE(gpmc_nand_res));
|
|
if (!err)
|
|
pdev->dev.platform_data = gpmc_nand_data;
|
|
} else {
|
|
err = -ENOMEM;
|
|
}
|
|
if (err)
|
|
goto out_free_pdev;
|
|
|
|
err = platform_device_add(pdev);
|
|
if (err) {
|
|
dev_err(&pdev->dev, "Unable to register NAND device\n");
|
|
goto out_free_pdev;
|
|
}
|
|
|
|
return 0;
|
|
|
|
out_free_pdev:
|
|
platform_device_put(pdev);
|
|
out_free_cs:
|
|
gpmc_cs_free(gpmc_nand_data->cs);
|
|
|
|
return err;
|
|
}
|