Commit 2997e487 authored by Miquel Raynal's avatar Miquel Raynal
Browse files

Merge tag 'memory-controller-drv-omap-5.17' into nand/next



Memory controller drivers for v5.17 - OMAP GPMC

1. Add support for AM64 SoC.
2. Minor improvement: use platform_get_irq().

[miquel.raynal@bootlin.com: A first commit introduced a new omap
compatible and another moved the IDs to a header which created a
conflict: moving the new ID as well in the header fixed it.]

Signed-off-by: default avatarMiquel Raynal <miquel.raynal@bootlin.com>
parents ecb78b29 dbcb124a
Loading
Loading
Loading
Loading
+22 −1
Original line number Diff line number Diff line
@@ -23,13 +23,20 @@ properties:
    items:
      - enum:
          - ti,am3352-gpmc
          - ti,am64-gpmc
          - ti,omap2420-gpmc
          - ti,omap2430-gpmc
          - ti,omap3430-gpmc
          - ti,omap4430-gpmc

  reg:
    maxItems: 1
    minItems: 1
    maxItems: 2

  reg-names:
    items:
      - const: cfg
      - const: data

  interrupts:
    maxItems: 1
@@ -44,6 +51,9 @@ properties:
    items:
      - const: fck

  power-domains:
    maxItems: 1

  dmas:
    items:
      - description: DMA channel for GPMC NAND prefetch
@@ -133,6 +143,17 @@ required:
  - "#address-cells"
  - "#size-cells"

allOf:
  - if:
      properties:
        compatible:
          contains:
            const: ti,am64-gpmc
    then:
      required:
        - reg-names
        - power-domains

additionalProperties: false

examples:
+33 −17
Original line number Diff line number Diff line
@@ -237,6 +237,7 @@ struct gpmc_device {
	struct omap3_gpmc_regs context;
	int nirqs;
	unsigned int is_suspended:1;
	struct resource *data;
};

static struct irq_domain *gpmc_irq_domain;
@@ -1456,12 +1457,18 @@ static void gpmc_mem_exit(void)
	}
}

static void gpmc_mem_init(void)
static void gpmc_mem_init(struct gpmc_device *gpmc)
{
	int cs;

	if (!gpmc->data) {
		/* All legacy devices have same data IO window */
		gpmc_mem_root.start = GPMC_MEM_START;
		gpmc_mem_root.end = GPMC_MEM_END;
	} else {
		gpmc_mem_root.start = gpmc->data->start;
		gpmc_mem_root.end = gpmc->data->end;
	}

	/* Reserve all regions that has been set up by bootloader */
	for (cs = 0; cs < gpmc_cs_num; cs++) {
@@ -1888,6 +1895,7 @@ static const struct of_device_id gpmc_dt_ids[] = {
	{ .compatible = "ti,omap3430-gpmc" },	/* omap3430 & omap3630 */
	{ .compatible = "ti,omap4430-gpmc" },	/* omap4430 & omap4460 & omap543x */
	{ .compatible = "ti,am3352-gpmc" },	/* am335x devices */
	{ .compatible = "ti,am64-gpmc" },
	{ }
};

@@ -2175,7 +2183,7 @@ static int gpmc_probe_generic_child(struct platform_device *pdev,
		}
	}

	if (of_device_is_compatible(child, "ti,omap2-nand")) {
	if (of_match_node(omap_nand_ids, child)) {
		/* NAND specific setup */
		val = 8;
		of_property_read_u32(child, "nand-bus-width", &val);
@@ -2502,21 +2510,29 @@ static int gpmc_probe(struct platform_device *pdev)
	gpmc->dev = &pdev->dev;
	platform_set_drvdata(pdev, gpmc);

	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
	if (!res)
		return -ENOENT;

	res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "cfg");
	if (!res) {
		/* legacy DT */
		gpmc_base = devm_platform_ioremap_resource(pdev, 0);
		if (IS_ERR(gpmc_base))
			return PTR_ERR(gpmc_base);
	} else {
		gpmc_base = devm_ioremap_resource(&pdev->dev, res);
		if (IS_ERR(gpmc_base))
			return PTR_ERR(gpmc_base);

	res = platform_get_resource(pdev, IORESOURCE_IRQ, 0);
		res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "data");
		if (!res) {
		dev_err(&pdev->dev, "Failed to get resource: irq\n");
			dev_err(&pdev->dev, "couldn't get data reg resource\n");
			return -ENOENT;
		}

	gpmc->irq = res->start;
		gpmc->data = res;
	}

	gpmc->irq = platform_get_irq(pdev, 0);
	if (gpmc->irq < 0)
		return gpmc->irq;

	gpmc_l3_clk = devm_clk_get(&pdev->dev, "fck");
	if (IS_ERR(gpmc_l3_clk)) {
@@ -2562,7 +2578,7 @@ static int gpmc_probe(struct platform_device *pdev)
	dev_info(gpmc->dev, "GPMC revision %d.%d\n", GPMC_REVISION_MAJOR(l),
		 GPMC_REVISION_MINOR(l));

	gpmc_mem_init();
	gpmc_mem_init(gpmc);
	rc = gpmc_gpio_init(gpmc);
	if (rc)
		goto gpio_init_failed;
+1 −0
Original line number Diff line number Diff line
@@ -42,6 +42,7 @@ config MTD_NAND_OMAP2
	tristate "OMAP2, OMAP3, OMAP4 and Keystone NAND controller"
	depends on ARCH_OMAP2PLUS || ARCH_KEYSTONE || ARCH_K3 || COMPILE_TEST
	depends on HAS_IOMEM
	select OMAP_GPMC if ARCH_K3
	help
	  Support for NAND flash on Texas Instruments OMAP2, OMAP3, OMAP4
	  and Keystone platforms.
+1 −5
Original line number Diff line number Diff line
@@ -2290,11 +2290,7 @@ static int omap_nand_remove(struct platform_device *pdev)
	return ret;
}

static const struct of_device_id omap_nand_ids[] = {
	{ .compatible = "ti,omap2-nand", },
	{ .compatible = "ti,am64-nand", },
	{},
};
/* omap_nand_ids defined in linux/platform_data/mtd-nand-omap2.h */
MODULE_DEVICE_TABLE(of, omap_nand_ids);

static struct platform_driver omap_nand_driver = {
+9 −1
Original line number Diff line number Diff line
@@ -7,6 +7,7 @@
#define	_MTD_NAND_OMAP2_H

#include <linux/mtd/partitions.h>
#include <linux/mod_devicetable.h>

#define	GPMC_BCH_NUM_REMAINDER	8

@@ -61,4 +62,11 @@ struct gpmc_nand_regs {
	void __iomem	*gpmc_bch_result5[GPMC_BCH_NUM_REMAINDER];
	void __iomem	*gpmc_bch_result6[GPMC_BCH_NUM_REMAINDER];
};
#endif

static const struct of_device_id omap_nand_ids[] = {
	{ .compatible = "ti,omap2-nand", },
	{ .compatible = "ti,am64-nand", },
	{},
};

#endif /* _MTD_NAND_OMAP2_H */