forked from ~ljy/RK356X_SDK_RELEASE

hc
2023-12-06 08f87f769b595151be1afeff53e144f543faa614
kernel/arch/powerpc/platforms/ps3/system-bus.c
....@@ -1,27 +1,15 @@
1
+// SPDX-License-Identifier: GPL-2.0-only
12 /*
23 * PS3 system bus driver.
34 *
45 * Copyright (C) 2006 Sony Computer Entertainment Inc.
56 * Copyright 2006 Sony Corp.
6
- *
7
- * This program is free software; you can redistribute it and/or modify
8
- * it under the terms of the GNU General Public License as published by
9
- * the Free Software Foundation; version 2 of the License.
10
- *
11
- * This program is distributed in the hope that it will be useful,
12
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
13
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
- * GNU General Public License for more details.
15
- *
16
- * You should have received a copy of the GNU General Public License
17
- * along with this program; if not, write to the Free Software
18
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
197 */
208
219 #include <linux/kernel.h>
2210 #include <linux/init.h>
2311 #include <linux/export.h>
24
-#include <linux/dma-mapping.h>
12
+#include <linux/dma-map-ops.h>
2513 #include <linux/err.h>
2614 #include <linux/slab.h>
2715
....@@ -37,12 +25,12 @@
3725 };
3826
3927 /* FIXME: need device usage counters! */
40
-struct {
28
+static struct {
4129 struct mutex mutex;
4230 int sb_11; /* usb 0 */
4331 int sb_12; /* usb 0 */
4432 int gpu;
45
-} static usage_hack;
33
+} usage_hack;
4634
4735 static int ps3_is_device(struct ps3_system_bus_device *dev, u64 bus_id,
4836 u64 dev_id)
....@@ -698,20 +686,18 @@
698686 return mask >= DMA_BIT_MASK(32);
699687 }
700688
701
-static u64 ps3_dma_get_required_mask(struct device *_dev)
702
-{
703
- return DMA_BIT_MASK(32);
704
-}
705
-
706689 static const struct dma_map_ops ps3_sb_dma_ops = {
707690 .alloc = ps3_alloc_coherent,
708691 .free = ps3_free_coherent,
709692 .map_sg = ps3_sb_map_sg,
710693 .unmap_sg = ps3_sb_unmap_sg,
711694 .dma_supported = ps3_dma_supported,
712
- .get_required_mask = ps3_dma_get_required_mask,
713695 .map_page = ps3_sb_map_page,
714696 .unmap_page = ps3_unmap_page,
697
+ .mmap = dma_common_mmap,
698
+ .get_sgtable = dma_common_get_sgtable,
699
+ .alloc_pages = dma_common_alloc_pages,
700
+ .free_pages = dma_common_free_pages,
715701 };
716702
717703 static const struct dma_map_ops ps3_ioc0_dma_ops = {
....@@ -720,9 +706,12 @@
720706 .map_sg = ps3_ioc0_map_sg,
721707 .unmap_sg = ps3_ioc0_unmap_sg,
722708 .dma_supported = ps3_dma_supported,
723
- .get_required_mask = ps3_dma_get_required_mask,
724709 .map_page = ps3_ioc0_map_page,
725710 .unmap_page = ps3_unmap_page,
711
+ .mmap = dma_common_mmap,
712
+ .get_sgtable = dma_common_get_sgtable,
713
+ .alloc_pages = dma_common_alloc_pages,
714
+ .free_pages = dma_common_free_pages,
726715 };
727716
728717 /**