Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 9 Dec 2019 17:34:41 +0000 (UTC)
From:      Kyle Evans <kevans@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r355563 - head/sys/arm/broadcom/bcm2835
Message-ID:  <201912091734.xB9HYfoa061478@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: kevans
Date: Mon Dec  9 17:34:40 2019
New Revision: 355563
URL: https://svnweb.freebsd.org/changeset/base/355563

Log:
  RPI: Fix DMA/SDHCI on the BCM2836 (Raspberry Pi 2)
  
  r354875 pushed VCBUS <-> ARMC translations to runtime determination, but
  incorrectly mapped addresses for the BCM2836 -- SOC_BCM2835 and SOC_BCM2836
  are actually mutually exclusive, so the BCM2836 config (GENERIC) would have
  taken the latter path in the header and used 0x3f000000 as peripheral start.
  
  Easily fixed -- split out the BCM2836 into its own memmap config and use
  that instead if SOC_BCM2836 is included. With this, we get back to userland
  again.
  
  Reported by:	Marek Zarychta <zarychtam@plan-b.pwste.edu.pl>

Modified:
  head/sys/arm/broadcom/bcm2835/bcm2835_vcbus.c
  head/sys/arm/broadcom/bcm2835/bcm2835_vcbus.h

Modified: head/sys/arm/broadcom/bcm2835/bcm2835_vcbus.c
==============================================================================
--- head/sys/arm/broadcom/bcm2835/bcm2835_vcbus.c	Mon Dec  9 17:14:43 2019	(r355562)
+++ head/sys/arm/broadcom/bcm2835/bcm2835_vcbus.c	Mon Dec  9 17:34:40 2019	(r355563)
@@ -67,7 +67,7 @@ struct bcm283x_memory_mapping {
 	vm_paddr_t	vcbus_start;
 };
 
-#if defined(SOC_BCM2835) || defined(SOC_BCM2836)
+#ifdef SOC_BCM2835
 static struct bcm283x_memory_mapping bcm2835_memmap[] = {
 	{
 		/* SDRAM */
@@ -85,6 +85,24 @@ static struct bcm283x_memory_mapping bcm2835_memmap[] 
 };
 #endif
 
+#ifdef SOC_BCM2836
+static struct bcm283x_memory_mapping bcm2836_memmap[] = {
+	{
+		/* SDRAM */
+		.armc_start = 0x00000000,
+		.armc_size = BCM2836_ARM_IO_BASE,
+		.vcbus_start = BCM2836_VCBUS_SDRAM_BASE,
+	},
+	{
+		/* Peripherals */
+		.armc_start = BCM2836_ARM_IO_BASE,
+		.armc_size  = BCM28XX_ARM_IO_SIZE,
+		.vcbus_start = BCM2836_VCBUS_IO_BASE,
+	},
+	{ 0, 0, 0 },
+};
+#endif
+
 #ifdef SOC_BRCM_BCM2837
 static struct bcm283x_memory_mapping bcm2837_memmap[] = {
 	{
@@ -142,7 +160,7 @@ static struct bcm283x_memory_soc_cfg {
 #endif
 #ifdef SOC_BCM2836
 	{
-		.memmap = bcm2835_memmap,
+		.memmap = bcm2836_memmap,
 		.soc_compat = "brcm,bcm2836",
 		.busdma_lowaddr = BUS_SPACE_MAXADDR_32BIT,
 	},

Modified: head/sys/arm/broadcom/bcm2835/bcm2835_vcbus.h
==============================================================================
--- head/sys/arm/broadcom/bcm2835/bcm2835_vcbus.h	Mon Dec  9 17:14:43 2019	(r355562)
+++ head/sys/arm/broadcom/bcm2835/bcm2835_vcbus.h	Mon Dec  9 17:34:40 2019	(r355563)
@@ -42,7 +42,11 @@
 #define	BCM2835_VCBUS_IO_BASE		0x7E000000
 #define	BCM2835_VCBUS_SDRAM_BASE	BCM2835_VCBUS_SDRAM_CACHED
 
-#define	BCM2837_ARM_IO_BASE		0x3f000000
+#define	BCM2836_ARM_IO_BASE		0x3f000000
+#define	BCM2836_VCBUS_IO_BASE		BCM2835_VCBUS_IO_BASE
+#define	BCM2836_VCBUS_SDRAM_BASE	BCM2835_VCBUS_SDRAM_UNCACHED
+
+#define	BCM2837_ARM_IO_BASE		BCM2836_ARM_IO_BASE
 #define	BCM2837_VCBUS_IO_BASE		BCM2835_VCBUS_IO_BASE
 #define	BCM2837_VCBUS_SDRAM_BASE	BCM2835_VCBUS_SDRAM_UNCACHED
 



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201912091734.xB9HYfoa061478>