| .. | .. |
|---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-only |
|---|
| 1 | 2 | /* |
|---|
| 2 | 3 | * Keystone2 based boards and SOC related code. |
|---|
| 3 | 4 | * |
|---|
| 4 | 5 | * Copyright 2013 Texas Instruments, Inc. |
|---|
| 5 | 6 | * Cyril Chemparathy <cyril@ti.com> |
|---|
| 6 | 7 | * Santosh Shilimkar <santosh.shillimkar@ti.com> |
|---|
| 7 | | - * |
|---|
| 8 | | - * This program is free software; you can redistribute it and/or modify it |
|---|
| 9 | | - * under the terms and conditions of the GNU General Public License, |
|---|
| 10 | | - * version 2, as published by the Free Software Foundation. |
|---|
| 11 | 8 | */ |
|---|
| 12 | 9 | #include <linux/io.h> |
|---|
| 13 | 10 | #include <linux/of.h> |
|---|
| 11 | +#include <linux/dma-mapping.h> |
|---|
| 14 | 12 | #include <linux/init.h> |
|---|
| 15 | 13 | #include <linux/of_platform.h> |
|---|
| 16 | 14 | #include <linux/of_address.h> |
|---|
| .. | .. |
|---|
| 27 | 25 | |
|---|
| 28 | 26 | #include "keystone.h" |
|---|
| 29 | 27 | |
|---|
| 30 | | -static unsigned long keystone_dma_pfn_offset __read_mostly; |
|---|
| 31 | | - |
|---|
| 28 | +#ifdef CONFIG_ARM_LPAE |
|---|
| 32 | 29 | static int keystone_platform_notifier(struct notifier_block *nb, |
|---|
| 33 | 30 | unsigned long event, void *data) |
|---|
| 34 | 31 | { |
|---|
| .. | .. |
|---|
| 41 | 38 | return NOTIFY_BAD; |
|---|
| 42 | 39 | |
|---|
| 43 | 40 | if (!dev->of_node) { |
|---|
| 44 | | - dev->dma_pfn_offset = keystone_dma_pfn_offset; |
|---|
| 45 | | - dev_err(dev, "set dma_pfn_offset%08lx\n", |
|---|
| 46 | | - dev->dma_pfn_offset); |
|---|
| 41 | + int ret = dma_direct_set_offset(dev, KEYSTONE_HIGH_PHYS_START, |
|---|
| 42 | + KEYSTONE_LOW_PHYS_START, |
|---|
| 43 | + KEYSTONE_HIGH_PHYS_SIZE); |
|---|
| 44 | + dev_err(dev, "set dma_offset%08llx%s\n", |
|---|
| 45 | + KEYSTONE_HIGH_PHYS_START - KEYSTONE_LOW_PHYS_START, |
|---|
| 46 | + ret ? " failed" : ""); |
|---|
| 47 | 47 | } |
|---|
| 48 | 48 | return NOTIFY_OK; |
|---|
| 49 | 49 | } |
|---|
| .. | .. |
|---|
| 51 | 51 | static struct notifier_block platform_nb = { |
|---|
| 52 | 52 | .notifier_call = keystone_platform_notifier, |
|---|
| 53 | 53 | }; |
|---|
| 54 | +#endif /* CONFIG_ARM_LPAE */ |
|---|
| 54 | 55 | |
|---|
| 55 | 56 | static void __init keystone_init(void) |
|---|
| 56 | 57 | { |
|---|
| 57 | | - if (PHYS_OFFSET >= KEYSTONE_HIGH_PHYS_START) { |
|---|
| 58 | | - keystone_dma_pfn_offset = PFN_DOWN(KEYSTONE_HIGH_PHYS_START - |
|---|
| 59 | | - KEYSTONE_LOW_PHYS_START); |
|---|
| 58 | +#ifdef CONFIG_ARM_LPAE |
|---|
| 59 | + if (PHYS_OFFSET >= KEYSTONE_HIGH_PHYS_START) |
|---|
| 60 | 60 | bus_register_notifier(&platform_bus_type, &platform_nb); |
|---|
| 61 | | - } |
|---|
| 61 | +#endif |
|---|
| 62 | 62 | keystone_pm_runtime_init(); |
|---|
| 63 | 63 | } |
|---|
| 64 | 64 | |
|---|