Mon Aug 5 21:55:47 2013 UTC ()
fix a bug in obiosdhc_bus_clock where SYSCTL_CEN bit wasnt being cleared or set properly, from Rui Paulo


(jmcneill)
diff -r1.12 -r1.13 src/sys/arch/arm/omap/omap3_sdhc.c

cvs diff -r1.12 -r1.13 src/sys/arch/arm/omap/Attic/omap3_sdhc.c (expand / switch to unified diff)

--- src/sys/arch/arm/omap/Attic/omap3_sdhc.c 2013/06/28 00:50:22 1.12
+++ src/sys/arch/arm/omap/Attic/omap3_sdhc.c 2013/08/05 21:55:47 1.13
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: omap3_sdhc.c,v 1.12 2013/06/28 00:50:22 matt Exp $ */ 1/* $NetBSD: omap3_sdhc.c,v 1.13 2013/08/05 21:55:47 jmcneill Exp $ */
2/*- 2/*-
3 * Copyright (c) 2011 The NetBSD Foundation, Inc. 3 * Copyright (c) 2011 The NetBSD Foundation, Inc.
4 * All rights reserved. 4 * All rights reserved.
5 * 5 *
6 * This code is derived from software contributed to The NetBSD Foundation 6 * This code is derived from software contributed to The NetBSD Foundation
7 * by Matt Thomas of 3am Software Foundry. 7 * by Matt Thomas of 3am Software Foundry.
8 * 8 *
9 * Redistribution and use in source and binary forms, with or without 9 * Redistribution and use in source and binary forms, with or without
10 * modification, are permitted provided that the following conditions 10 * modification, are permitted provided that the following conditions
11 * are met: 11 * are met:
12 * 1. Redistributions of source code must retain the above copyright 12 * 1. Redistributions of source code must retain the above copyright
13 * notice, this list of conditions and the following disclaimer. 13 * notice, this list of conditions and the following disclaimer.
14 * 2. Redistributions in binary form must reproduce the above copyright 14 * 2. Redistributions in binary form must reproduce the above copyright
@@ -19,27 +19,27 @@ @@ -19,27 +19,27 @@
19 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED 19 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
20 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 20 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
21 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS 21 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
22 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 22 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
23 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 23 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
24 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 24 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
25 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 25 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
26 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 26 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
27 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 27 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
28 * POSSIBILITY OF SUCH DAMAGE. 28 * POSSIBILITY OF SUCH DAMAGE.
29 */ 29 */
30 30
31#include <sys/cdefs.h> 31#include <sys/cdefs.h>
32__KERNEL_RCSID(0, "$NetBSD: omap3_sdhc.c,v 1.12 2013/06/28 00:50:22 matt Exp $"); 32__KERNEL_RCSID(0, "$NetBSD: omap3_sdhc.c,v 1.13 2013/08/05 21:55:47 jmcneill Exp $");
33 33
34#include "opt_omap.h" 34#include "opt_omap.h"
35 35
36#include <sys/param.h> 36#include <sys/param.h>
37#include <sys/systm.h> 37#include <sys/systm.h>
38#include <sys/device.h> 38#include <sys/device.h>
39#include <sys/kernel.h> 39#include <sys/kernel.h>
40#include <sys/proc.h> 40#include <sys/proc.h>
41#include <sys/queue.h> 41#include <sys/queue.h>
42 42
43#include <sys/bus.h> 43#include <sys/bus.h>
44 44
45#include <arm/omap/omap2_obiovar.h> 45#include <arm/omap/omap2_obiovar.h>
@@ -362,21 +362,21 @@ obiosdhc_card_detect(struct sdhc_softc * @@ -362,21 +362,21 @@ obiosdhc_card_detect(struct sdhc_softc *
362 362
363 /* Maybe board dependent, using GPIO. Get GPIO-pin from prop? */ 363 /* Maybe board dependent, using GPIO. Get GPIO-pin from prop? */
364 return 1; /* XXXXXXXX */ 364 return 1; /* XXXXXXXX */
365} 365}
366 366
367static int 367static int
368obiosdhc_bus_clock(struct sdhc_softc *sc, int clk) 368obiosdhc_bus_clock(struct sdhc_softc *sc, int clk)
369{ 369{
370 struct obiosdhc_softc *osc = (struct obiosdhc_softc *)sc; 370 struct obiosdhc_softc *osc = (struct obiosdhc_softc *)sc;
371 uint32_t ctl; 371 uint32_t ctl;
372 372
373 ctl = bus_space_read_4(osc->sc_bst, osc->sc_bsh, MMCHS_SYSCTL); 373 ctl = bus_space_read_4(osc->sc_bst, osc->sc_bsh, MMCHS_SYSCTL);
374 if (clk == 0) { 374 if (clk == 0) {
375 clk &= ~SYSCTL_CEN; 375 ctl &= ~SYSCTL_CEN;
376 } else { 376 } else {
377 clk |= SYSCTL_CEN; 377 ctl |= SYSCTL_CEN;
378 } 378 }
379 bus_space_write_4(osc->sc_bst, osc->sc_bsh, MMCHS_SYSCTL, ctl); 379 bus_space_write_4(osc->sc_bst, osc->sc_bsh, MMCHS_SYSCTL, ctl);
380 380
381 return 0; 381 return 0;
382} 382}