blob: fc7816126a401074e8983341b3d58e9fd95726dc [file] [log] [blame]
David Brazdil0f672f62019-12-10 10:32:29 +00001// SPDX-License-Identifier: GPL-2.0-or-later
Andrew Scullb4b6d4a2019-01-02 15:54:55 +00002/*
3 * Contains routines needed to support swiotlb for ppc.
4 *
5 * Copyright (C) 2009-2010 Freescale Semiconductor, Inc.
6 * Author: Becky Bruce
Andrew Scullb4b6d4a2019-01-02 15:54:55 +00007 */
Andrew Scullb4b6d4a2019-01-02 15:54:55 +00008#include <linux/memblock.h>
Andrew Scullb4b6d4a2019-01-02 15:54:55 +00009#include <asm/machdep.h>
10#include <asm/swiotlb.h>
Andrew Scullb4b6d4a2019-01-02 15:54:55 +000011
12unsigned int ppc_swiotlb_enable;
13
Andrew Scullb4b6d4a2019-01-02 15:54:55 +000014void __init swiotlb_detect_4g(void)
15{
David Brazdil0f672f62019-12-10 10:32:29 +000016 if ((memblock_end_of_DRAM() - 1) > 0xffffffff)
Andrew Scullb4b6d4a2019-01-02 15:54:55 +000017 ppc_swiotlb_enable = 1;
Andrew Scullb4b6d4a2019-01-02 15:54:55 +000018}
19
20static int __init check_swiotlb_enabled(void)
21{
22 if (ppc_swiotlb_enable)
23 swiotlb_print_info();
24 else
25 swiotlb_exit();
26
27 return 0;
28}
29subsys_initcall(check_swiotlb_enabled);