Lines Matching refs:gpmc

32 #include <linux/omap-gpmc.h>
38 #define DEVICE_NAME "omap-gpmc"
206 /* Structure to save gpmc cs context */
219 * Structure to save/restore gpmc context
425 * @name: DTS node name, w/o "gpmc,"
429 * raw format: gpmc,name = <value>
430 * tick format: gpmc,name = <value> /&zwj;* x ns -- y ns; x ticks *&zwj;/
470 pr_info("gpmc,%s = <%u>; /* %u ns - %u ns; %i ticks%s*/\n",
475 pr_info("gpmc,%s = <%u>;%s\n", name, l,
502 pr_info("gpmc cs%i %s:\n", cs, desc);
512 * Note that gpmc,wait-pin handing wrongly assumes bit 8 is available,
519 pr_info("gpmc cs%i access configuration:\n", cs);
532 GPMC_GET_RAW_BOOL(GPMC_CS_CONFIG1, 29, 29, "gpmc,sync-read");
546 pr_info("gpmc cs%i timings configuration:\n", cs);
716 * Calculate GPMCFCLKDIVIDER independent of gpmc,sync-clk-ps in DT for
921 struct gpmc_cs_data *gpmc = &gpmc_cs[cs];
923 gpmc->flags |= GPMC_CS_RESERVED;
928 struct gpmc_cs_data *gpmc = &gpmc_cs[cs];
930 return gpmc->flags & GPMC_CS_RESERVED;
949 struct gpmc_cs_data *gpmc = &gpmc_cs[cs];
950 struct resource *res = &gpmc->mem;
965 struct gpmc_cs_data *gpmc = &gpmc_cs[cs];
966 struct resource *res = &gpmc->mem;
980 struct gpmc_cs_data *gpmc = &gpmc_cs[cs];
981 struct resource *res = &gpmc->mem;
1026 struct gpmc_cs_data *gpmc;
1035 gpmc = &gpmc_cs[cs];
1036 res = &gpmc->mem;
1051 static int gpmc_alloc_waitpin(struct gpmc_device *gpmc,
1061 waitpin = &gpmc->waitpins[p->wait_pin];
1068 waitpin_desc = gpiochip_request_own_desc(&gpmc->gpio_chip,
1085 dev_err(gpmc->dev,
1089 dev_info(gpmc->dev, "shared wait-pin: %d\n", waitpin->pin);
1095 static void gpmc_free_waitpin(struct gpmc_device *gpmc,
1099 gpiochip_free_own_desc(gpmc->waitpins[wait_pin].desc);
1103 * gpmc_configure - write request to configure gpmc
1405 struct gpmc_device *gpmc = d->host_data;
1407 irq_set_chip_data(virq, gpmc);
1410 irq_set_chip_and_handler(virq, &gpmc->irq_chip,
1413 irq_set_chip_and_handler(virq, &gpmc->irq_chip,
1429 struct gpmc_device *gpmc = data;
1437 for (hwirq = 0; hwirq < gpmc->nirqs; hwirq++) {
1445 dev_warn(gpmc->dev,
1459 static int gpmc_setup_irq(struct gpmc_device *gpmc)
1471 gpmc->irq_chip.name = "gpmc";
1472 gpmc->irq_chip.irq_enable = gpmc_irq_enable;
1473 gpmc->irq_chip.irq_disable = gpmc_irq_disable;
1474 gpmc->irq_chip.irq_ack = gpmc_irq_ack;
1475 gpmc->irq_chip.irq_mask = gpmc_irq_mask;
1476 gpmc->irq_chip.irq_unmask = gpmc_irq_unmask;
1477 gpmc->irq_chip.irq_set_type = gpmc_irq_set_type;
1479 gpmc_irq_domain = irq_domain_add_linear(gpmc->dev->of_node,
1480 gpmc->nirqs,
1482 gpmc);
1484 dev_err(gpmc->dev, "IRQ domain add failed\n");
1488 rc = request_irq(gpmc->irq, gpmc_handle_irq, 0, "gpmc", gpmc);
1490 dev_err(gpmc->dev, "failed to request irq %d: %d\n",
1491 gpmc->irq, rc);
1499 static int gpmc_free_irq(struct gpmc_device *gpmc)
1503 free_irq(gpmc->irq, gpmc);
1505 for (hwirq = 0; hwirq < gpmc->nirqs; hwirq++)
1525 static void gpmc_mem_init(struct gpmc_device *gpmc)
1529 if (!gpmc->data) {
1534 gpmc_mem_root.start = gpmc->data->start;
1535 gpmc_mem_root.end = gpmc->data->end;
1971 struct gpmc_cs_data *gpmc = &gpmc_cs[cs];
1973 gpmc->name = name;
1978 struct gpmc_cs_data *gpmc = &gpmc_cs[cs];
1980 return gpmc->name;
2027 * gpmc_read_settings_dt - read gpmc settings from device-tree
2028 * @np: pointer to device-tree node for a gpmc child device
2029 * @p: pointer to gpmc settings structure
2040 p->sync_read = of_property_read_bool(np, "gpmc,sync-read");
2041 p->sync_write = of_property_read_bool(np, "gpmc,sync-write");
2042 of_property_read_u32(np, "gpmc,device-width", &p->device_width);
2043 of_property_read_u32(np, "gpmc,mux-add-data", &p->mux_add_data);
2045 if (!of_property_read_u32(np, "gpmc,burst-length", &p->burst_len)) {
2046 p->burst_wrap = of_property_read_bool(np, "gpmc,burst-wrap");
2047 p->burst_read = of_property_read_bool(np, "gpmc,burst-read");
2048 p->burst_write = of_property_read_bool(np, "gpmc,burst-write");
2057 if (!of_property_read_u32(np, "gpmc,wait-pin", &p->wait_pin)) {
2074 "gpmc,wait-on-read");
2076 "gpmc,wait-on-write");
2094 of_property_read_u32(np, "gpmc,sync-clk-ps", &gpmc_t->sync_clk);
2097 of_property_read_u32(np, "gpmc,cs-on-ns", &gpmc_t->cs_on);
2098 of_property_read_u32(np, "gpmc,cs-rd-off-ns", &gpmc_t->cs_rd_off);
2099 of_property_read_u32(np, "gpmc,cs-wr-off-ns", &gpmc_t->cs_wr_off);
2102 of_property_read_u32(np, "gpmc,adv-on-ns", &gpmc_t->adv_on);
2103 of_property_read_u32(np, "gpmc,adv-rd-off-ns", &gpmc_t->adv_rd_off);
2104 of_property_read_u32(np, "gpmc,adv-wr-off-ns", &gpmc_t->adv_wr_off);
2105 of_property_read_u32(np, "gpmc,adv-aad-mux-on-ns",
2107 of_property_read_u32(np, "gpmc,adv-aad-mux-rd-off-ns",
2109 of_property_read_u32(np, "gpmc,adv-aad-mux-wr-off-ns",
2113 of_property_read_u32(np, "gpmc,we-on-ns", &gpmc_t->we_on);
2114 of_property_read_u32(np, "gpmc,we-off-ns", &gpmc_t->we_off);
2117 of_property_read_u32(np, "gpmc,oe-on-ns", &gpmc_t->oe_on);
2118 of_property_read_u32(np, "gpmc,oe-off-ns", &gpmc_t->oe_off);
2119 of_property_read_u32(np, "gpmc,oe-aad-mux-on-ns",
2121 of_property_read_u32(np, "gpmc,oe-aad-mux-off-ns",
2125 of_property_read_u32(np, "gpmc,page-burst-access-ns",
2127 of_property_read_u32(np, "gpmc,access-ns", &gpmc_t->access);
2128 of_property_read_u32(np, "gpmc,rd-cycle-ns", &gpmc_t->rd_cycle);
2129 of_property_read_u32(np, "gpmc,wr-cycle-ns", &gpmc_t->wr_cycle);
2130 of_property_read_u32(np, "gpmc,bus-turnaround-ns",
2132 of_property_read_u32(np, "gpmc,cycle2cycle-delay-ns",
2134 of_property_read_u32(np, "gpmc,wait-monitoring-ns",
2136 of_property_read_u32(np, "gpmc,clk-activation-ns",
2140 of_property_read_u32(np, "gpmc,wr-access-ns", &gpmc_t->wr_access);
2141 of_property_read_u32(np, "gpmc,wr-data-mux-bus-ns",
2148 of_property_read_bool(np, "gpmc,cycle2cycle-diffcsen");
2150 of_property_read_bool(np, "gpmc,cycle2cycle-samecsen");
2151 p->we_extra_delay = of_property_read_bool(np, "gpmc,we-extra-delay");
2152 p->oe_extra_delay = of_property_read_bool(np, "gpmc,oe-extra-delay");
2153 p->adv_extra_delay = of_property_read_bool(np, "gpmc,adv-extra-delay");
2154 p->cs_extra_delay = of_property_read_bool(np, "gpmc,cs-extra-delay");
2156 of_property_read_bool(np, "gpmc,time-para-granularity");
2160 * gpmc_probe_generic_child - configures the gpmc for a child device
2161 * @pdev: pointer to gpmc platform device
2177 struct gpmc_device *gpmc = platform_get_drvdata(pdev);
2223 /* CS must be disabled while making changes to gpmc configuration */
2228 * location in the gpmc address space. When booting with
2296 "%pOF has no 'gpmc,device-width' property\n",
2304 ret = gpmc_alloc_waitpin(gpmc, &gpmc_s);
2317 dev_err(&pdev->dev, "failed to set gpmc timings for: %pOFn\n",
2344 dev_err(&pdev->dev, "failed to create gpmc child %pOFn\n", child);
2348 gpmc_free_waitpin(gpmc, gpmc_s.wait_pin);
2366 ret = of_property_read_u32(pdev->dev.of_node, "gpmc,num-cs",
2380 ret = of_property_read_u32(pdev->dev.of_node, "gpmc,num-waitpins",
2451 static int gpmc_gpio_init(struct gpmc_device *gpmc)
2455 gpmc->gpio_chip.parent = gpmc->dev;
2456 gpmc->gpio_chip.owner = THIS_MODULE;
2457 gpmc->gpio_chip.label = DEVICE_NAME;
2458 gpmc->gpio_chip.ngpio = gpmc_nr_waitpins;
2459 gpmc->gpio_chip.get_direction = gpmc_gpio_get_direction;
2460 gpmc->gpio_chip.direction_input = gpmc_gpio_direction_input;
2461 gpmc->gpio_chip.direction_output = gpmc_gpio_direction_output;
2462 gpmc->gpio_chip.set = gpmc_gpio_set;
2463 gpmc->gpio_chip.get = gpmc_gpio_get;
2464 gpmc->gpio_chip.base = -1;
2466 ret = devm_gpiochip_add_data(gpmc->dev, &gpmc->gpio_chip, NULL);
2468 dev_err(gpmc->dev, "could not register gpio chip: %d\n", ret);
2475 static void omap3_gpmc_save_context(struct gpmc_device *gpmc)
2480 if (!gpmc || !gpmc_base)
2483 gpmc_context = &gpmc->context;
2513 static void omap3_gpmc_restore_context(struct gpmc_device *gpmc)
2518 if (!gpmc || !gpmc_base)
2521 gpmc_context = &gpmc->context;
2555 struct gpmc_device *gpmc;
2557 gpmc = container_of(nb, struct gpmc_device, nb);
2558 if (gpmc->is_suspended || pm_runtime_suspended(gpmc->dev))
2563 omap3_gpmc_save_context(gpmc);
2568 omap3_gpmc_restore_context(gpmc);
2580 struct gpmc_device *gpmc;
2582 gpmc = devm_kzalloc(&pdev->dev, sizeof(*gpmc), GFP_KERNEL);
2583 if (!gpmc)
2586 gpmc->dev = &pdev->dev;
2587 platform_set_drvdata(pdev, gpmc);
2606 gpmc->data = res;
2609 gpmc->irq = platform_get_irq(pdev, 0);
2610 if (gpmc->irq < 0)
2611 return gpmc->irq;
2633 gpmc->waitpins = devm_kzalloc(&pdev->dev,
2636 if (!gpmc->waitpins)
2640 gpmc->waitpins[i].pin = GPMC_WAITPIN_INVALID;
2663 dev_info(gpmc->dev, "GPMC revision %d.%d\n", GPMC_REVISION_MAJOR(l),
2666 gpmc_mem_init(gpmc);
2667 rc = gpmc_gpio_init(gpmc);
2671 gpmc->nirqs = GPMC_NR_NAND_IRQS + gpmc_nr_waitpins;
2672 rc = gpmc_setup_irq(gpmc);
2674 dev_err(gpmc->dev, "gpmc_setup_irq failed\n");
2680 gpmc->nb.notifier_call = omap_gpmc_context_notifier;
2681 cpu_pm_register_notifier(&gpmc->nb);
2696 struct gpmc_device *gpmc = platform_get_drvdata(pdev);
2698 cpu_pm_unregister_notifier(&gpmc->nb);
2700 gpmc_free_waitpin(gpmc, i);
2701 gpmc_free_irq(gpmc);
2710 struct gpmc_device *gpmc = dev_get_drvdata(dev);
2712 omap3_gpmc_save_context(gpmc);
2714 gpmc->is_suspended = 1;
2721 struct gpmc_device *gpmc = dev_get_drvdata(dev);
2724 omap3_gpmc_restore_context(gpmc);
2725 gpmc->is_suspended = 0;
2735 { .compatible = "ti,omap2420-gpmc" },
2736 { .compatible = "ti,omap2430-gpmc" },
2737 { .compatible = "ti,omap3430-gpmc" }, /* omap3430 & omap3630 */
2738 { .compatible = "ti,omap4430-gpmc" }, /* omap4430 & omap4460 & omap543x */
2739 { .compatible = "ti,am3352-gpmc" }, /* am335x devices */
2740 { .compatible = "ti,am64-gpmc" },