Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 10 Jul 2017 03:38:18 +0000 (UTC)
From:      Warner Losh <imp@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r320858 - head/sys/dev/sdhci
Message-ID:  <201707100338.v6A3cIbn058831@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: imp
Date: Mon Jul 10 03:38:17 2017
New Revision: 320858
URL: https://svnweb.freebsd.org/changeset/base/320858

Log:
  Better contain MMCCAM parts of this file
  Remove some useless to the general user debugs
  Put debugs under sdhci_debug.
  Fix some style(9) regressions
  
  Submitted by: marius@

Modified:
  head/sys/dev/sdhci/sdhci.c
  head/sys/dev/sdhci/sdhci.h

Modified: head/sys/dev/sdhci/sdhci.c
==============================================================================
--- head/sys/dev/sdhci/sdhci.c	Mon Jul 10 03:38:12 2017	(r320857)
+++ head/sys/dev/sdhci/sdhci.c	Mon Jul 10 03:38:17 2017	(r320858)
@@ -91,6 +91,7 @@ static void sdhci_start_data(struct sdhci_slot *slot, 
 static void sdhci_card_poll(void *);
 static void sdhci_card_task(void *, int);
 
+#ifdef MMCCAM
 /* CAM-related */
 int sdhci_cam_get_possible_host_clock(struct sdhci_slot *slot, int proposed_clock);
 static int sdhci_cam_update_ios(struct sdhci_slot *slot);
@@ -98,6 +99,7 @@ static int sdhci_cam_request(struct sdhci_slot *slot, 
 static void sdhci_cam_action(struct cam_sim *sim, union ccb *ccb);
 static void sdhci_cam_poll(struct cam_sim *sim);
 static int sdhci_cam_settran_settings(struct sdhci_slot *slot, union ccb *ccb);
+#endif
 
 /* helper routines */
 static void sdhci_dumpregs(struct sdhci_slot *slot);
@@ -1021,10 +1023,6 @@ sdhci_generic_update_ios(device_t brdev, device_t reqd
 	struct sdhci_slot *slot = device_get_ivars(reqdev);
 	struct mmc_ios *ios = &slot->host.ios;
 
-	device_printf(brdev,  "This is a bridge device\n");
-	device_printf(reqdev, "This is a request device\n");
-
-	slot_printf(slot, " <--- The locking slot is this\n");
 	SDHCI_LOCK(slot);
 	/* Do full reset on bus power down to clear from any state. */
 	if (ios->power_mode == power_off) {
@@ -1121,8 +1119,9 @@ static void
 sdhci_req_done(struct sdhci_slot *slot)
 {
         union ccb *ccb;
+
 	if (sdhci_debug > 1)
-		slot_printf(slot, "sdhci_req_done()\n");
+		slot_printf(slot, "%s\n", __func__);
 	if (slot->ccb != NULL && slot->curcmd != NULL) {
 		callout_stop(&slot->timeout_callout);
                 ccb = slot->ccb;
@@ -1139,7 +1138,7 @@ sdhci_req_done(struct sdhci_slot *slot)
 	}
 }
 #else
-static void 
+static void
 sdhci_req_done(struct sdhci_slot *slot)
 {
 	struct mmc_request *req;
@@ -1320,7 +1319,7 @@ sdhci_finish_command(struct sdhci_slot *slot)
 
 	if (sdhci_debug > 1)
 		slot_printf(slot, "%s: called, err %d flags %d\n",
-			    __func__, slot->curcmd->error, slot->curcmd->flags);
+		    __func__, slot->curcmd->error, slot->curcmd->flags);
 	slot->cmd_done = 1;
 	/*
 	 * Interrupt aggregation: Restore command interrupt.
@@ -1356,8 +1355,8 @@ sdhci_finish_command(struct sdhci_slot *slot)
 	}
 	if (sdhci_debug > 1)
 		printf("Resp: %02x %02x %02x %02x\n",
-		       slot->curcmd->resp[0], slot->curcmd->resp[1],
-		       slot->curcmd->resp[2], slot->curcmd->resp[3]);
+		    slot->curcmd->resp[0], slot->curcmd->resp[1],
+		    slot->curcmd->resp[2], slot->curcmd->resp[3]);
 
 	/* If data ready - finish. */
 	if (slot->data_done)
@@ -1441,8 +1440,8 @@ sdhci_start_data(struct sdhci_slot *slot, struct mmc_d
 	WR2(slot, SDHCI_BLOCK_COUNT, (data->len + 511) / 512);
 
 	if (sdhci_debug > 1)
-		slot_printf(slot, "Block size: %02x, count %lu\n", (unsigned int)
-		    SDHCI_MAKE_BLKSZ(DMA_BOUNDARY, (data->len < 512)?data->len:512),
+		slot_printf(slot, "Block size: %02x, count %lu\n",
+		    (unsigned int)SDHCI_MAKE_BLKSZ(DMA_BOUNDARY, (data->len < 512) ? data->len : 512),
 		    (unsigned long)(data->len + 511) / 512);
 }
 
@@ -1657,6 +1656,7 @@ static void
 sdhci_data_irq(struct sdhci_slot *slot, uint32_t intmask)
 {
 	struct mmc_data *data;
+	size_t left;
 
 	if (!slot->curcmd) {
 		slot_printf(slot, "Got data interrupt 0x%08x, but "
@@ -1702,7 +1702,6 @@ sdhci_data_irq(struct sdhci_slot *slot, uint32_t intma
 	/* Handle DMA border. */
 	if (intmask & SDHCI_INT_DMA_END) {
 		data = slot->curcmd->data;
-		size_t left;
 
 		/* Unload DMA buffer ... */
 		left = data->len - slot->offset;
@@ -1910,7 +1909,8 @@ sdhci_generic_write_ivar(device_t bus, device_t child,
 	uint32_t clock, max_clock;
 	int i;
 
-	slot_printf(slot, "sdhci_generic_write_ivar, var=%d\n", which);
+	if (sdhci_debug > 1)
+		slot_printf(slot, "%s: var=%d\n", __func__, which);
 	switch (which) {
 	default:
 		return (EINVAL);
@@ -1976,6 +1976,7 @@ sdhci_generic_write_ivar(device_t bus, device_t child,
 	return (0);
 }
 
+#ifdef MMCCAM
 /* CAM-related functions */
 #include <cam/cam.h>
 #include <cam/cam_ccb.h>
@@ -2294,5 +2295,6 @@ sdhci_cam_request(struct sdhci_slot *slot, union ccb *
 	}
 	return (0);
 }
+#endif /* MMCCAM */
 
 MODULE_VERSION(sdhci, 1);

Modified: head/sys/dev/sdhci/sdhci.h
==============================================================================
--- head/sys/dev/sdhci/sdhci.h	Mon Jul 10 03:38:12 2017	(r320857)
+++ head/sys/dev/sdhci/sdhci.h	Mon Jul 10 03:38:17 2017	(r320858)
@@ -28,6 +28,8 @@
 #ifndef	__SDHCI_H__
 #define	__SDHCI_H__
 
+#include "opt_mmccam.h"
+
 #define	DMA_BLOCK_SIZE	4096
 #define	DMA_BOUNDARY	0	/* DMA reload every 4K */
 
@@ -368,12 +370,14 @@ struct sdhci_slot {
 #define	PLATFORM_DATA_STARTED	8	/* Data xfer is handled by platform */
 	struct mtx	mtx;		/* Slot mutex */
 
+#ifdef MMCCAM
 	/* CAM stuff */
 	union ccb	*ccb;
 	struct cam_devq		*devq;
 	struct cam_sim		*sim;
 	struct mtx		sim_mtx;
 	u_char			card_present; /* XXX Maybe derive this from elsewhere? */
+#endif
 };
 
 int sdhci_generic_read_ivar(device_t bus, device_t child, int which,
@@ -400,6 +404,9 @@ bool sdhci_generic_get_card_present(device_t brdev, st
 void sdhci_generic_set_uhs_timing(device_t brdev, struct sdhci_slot *slot);
 void sdhci_handle_card_present(struct sdhci_slot *slot, bool is_present);
 
+#ifdef MMCCAM
 /* CAM-related */
 void sdhci_cam_start_slot(struct sdhci_slot *slot);
+#endif
+
 #endif	/* __SDHCI_H__ */



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