From: Becky Bruce <beckyb@kernel.crashing.org>
To: linuxppc-dev@ozlabs.org
Cc: fujita.tomonori@lab.ntt.co.jp
Subject: [PATCH V2 3/3] powerpc: Add 86xx support for SWIOTLB
Date: Thu, 14 May 2009 17:42:29 -0500 [thread overview]
Message-ID: <1242340949-16369-3-git-send-email-beckyb@kernel.crashing.org> (raw)
In-Reply-To: <1242340949-16369-2-git-send-email-beckyb@kernel.crashing.org>
This is the final bit of code to allow enabling swiotlb on
mpc86xx. The platform-specific code is very small and consists
of enabling SWIOTLB in the config file, registering the
swiotlb_setup_bus_notifier initcall, and setting pci_dma_ops
to point to swiotlb_pci_dma_ops if we have more memory than
can be mapped by the inbound PCI windows.
Signed-off-by: Becky Bruce <beckyb@kernel.crashing.org>
---
arch/powerpc/platforms/86xx/Kconfig | 1 +
arch/powerpc/platforms/86xx/mpc86xx_hpcn.c | 15 +++++++++++++++
2 files changed, 16 insertions(+), 0 deletions(-)
diff --git a/arch/powerpc/platforms/86xx/Kconfig b/arch/powerpc/platforms/86xx/Kconfig
index fdaf4dd..9c7b64a 100644
--- a/arch/powerpc/platforms/86xx/Kconfig
+++ b/arch/powerpc/platforms/86xx/Kconfig
@@ -15,6 +15,7 @@ config MPC8641_HPCN
select DEFAULT_UIMAGE
select FSL_ULI1575
select HAS_RAPIDIO
+ select SWIOTLB
help
This option enables support for the MPC8641 HPCN board.
diff --git a/arch/powerpc/platforms/86xx/mpc86xx_hpcn.c b/arch/powerpc/platforms/86xx/mpc86xx_hpcn.c
index 7e9e83c..6632702 100644
--- a/arch/powerpc/platforms/86xx/mpc86xx_hpcn.c
+++ b/arch/powerpc/platforms/86xx/mpc86xx_hpcn.c
@@ -19,6 +19,7 @@
#include <linux/delay.h>
#include <linux/seq_file.h>
#include <linux/of_platform.h>
+#include <linux/lmb.h>
#include <asm/system.h>
#include <asm/time.h>
@@ -27,6 +28,7 @@
#include <asm/prom.h>
#include <mm/mmu_decl.h>
#include <asm/udbg.h>
+#include <asm/swiotlb.h>
#include <asm/mpic.h>
@@ -70,7 +72,9 @@ mpc86xx_hpcn_setup_arch(void)
{
#ifdef CONFIG_PCI
struct device_node *np;
+ struct pci_controller *hose;
#endif
+ dma_addr_t max = 0xffffffff;
if (ppc_md.progress)
ppc_md.progress("mpc86xx_hpcn_setup_arch()", 0);
@@ -83,6 +87,9 @@ mpc86xx_hpcn_setup_arch(void)
fsl_add_bridge(np, 1);
else
fsl_add_bridge(np, 0);
+ hose = pci_find_hose_for_OF_device(np);
+ max = min(max, hose->dma_window_base_cur +
+ hose->dma_window_size);
}
ppc_md.pci_exclude_device = mpc86xx_exclude_device;
@@ -94,6 +101,13 @@ mpc86xx_hpcn_setup_arch(void)
#ifdef CONFIG_SMP
mpc86xx_smp_init();
#endif
+
+#ifdef CONFIG_SWIOTLB
+ if (lmb_end_of_DRAM() > max) {
+ ppc_swiotlb_enable = 1;
+ set_pci_dma_ops(&swiotlb_pci_dma_ops);
+ }
+#endif
}
@@ -158,6 +172,7 @@ static int __init declare_of_platform_devices(void)
return 0;
}
machine_device_initcall(mpc86xx_hpcn, declare_of_platform_devices);
+machine_arch_initcall(mpc86xx_hpcn, swiotlb_setup_bus_notifier);
define_machine(mpc86xx_hpcn) {
.name = "MPC86xx HPCN",
--
1.6.0.6
next prev parent reply other threads:[~2009-05-14 22:42 UTC|newest]
Thread overview: 30+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-05-14 22:42 [PATCH V2 1/3] powerpc: Use sg->dma_length in sg_dma_len() macro on 32-bit Becky Bruce
2009-05-14 22:42 ` [PATCH V2 2/3] powerpc: Add support for swiotlb " Becky Bruce
2009-05-14 22:42 ` Becky Bruce [this message]
2009-05-15 4:49 ` Kumar Gala
2009-05-18 4:49 ` Benjamin Herrenschmidt
2009-05-18 13:25 ` Kumar Gala
2009-05-18 21:49 ` Benjamin Herrenschmidt
2009-05-19 13:04 ` Kumar Gala
2009-05-19 20:06 ` Becky Bruce
2009-05-28 4:42 ` Kumar Gala
2009-05-28 6:11 ` Benjamin Herrenschmidt
2009-05-28 13:06 ` Kumar Gala
2009-05-19 5:27 ` FUJITA Tomonori
2009-05-19 20:57 ` Becky Bruce
2009-05-21 17:43 ` Jeremy Fitzhardinge
2009-05-21 18:27 ` Becky Bruce
2009-05-21 19:01 ` Ian Campbell
2009-05-22 10:51 ` FUJITA Tomonori
2009-05-21 20:18 ` Jeremy Fitzhardinge
2009-05-21 22:08 ` Ian Campbell
2009-05-22 10:51 ` FUJITA Tomonori
2009-05-27 19:05 ` Becky Bruce
2009-05-22 11:11 ` Ian Campbell
2009-05-22 23:55 ` Jeremy Fitzhardinge
2009-05-23 22:59 ` Leon Woestenberg
2009-05-26 12:51 ` Ian Campbell
2009-05-27 19:11 ` Becky Bruce
2009-05-27 19:05 ` Becky Bruce
2009-05-27 20:29 ` Ian Campbell
2009-05-27 22:11 ` Becky Bruce
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1242340949-16369-3-git-send-email-beckyb@kernel.crashing.org \
--to=beckyb@kernel.crashing.org \
--cc=fujita.tomonori@lab.ntt.co.jp \
--cc=linuxppc-dev@ozlabs.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).