Date: Tue, 03 Jul 2012 11:24:42 +0000 From: aleek@FreeBSD.org To: svn-soc-all@FreeBSD.org Subject: socsvn commit: r238904 - in soc2012/aleek/beaglexm-armv6/sys: arm/ti boot/fdt/dts Message-ID: <20120703112442.2FA2E106566C@hub.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: aleek Date: Tue Jul 3 11:24:41 2012 New Revision: 238904 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=238904 Log: adapting MMC driver Modified: soc2012/aleek/beaglexm-armv6/sys/arm/ti/ti_mmchs.c soc2012/aleek/beaglexm-armv6/sys/boot/fdt/dts/beagleboardxm.dts Modified: soc2012/aleek/beaglexm-armv6/sys/arm/ti/ti_mmchs.c ============================================================================== --- soc2012/aleek/beaglexm-armv6/sys/arm/ti/ti_mmchs.c Tue Jul 3 09:11:47 2012 (r238903) +++ soc2012/aleek/beaglexm-armv6/sys/arm/ti/ti_mmchs.c Tue Jul 3 11:24:41 2012 (r238904) @@ -1330,7 +1330,8 @@ uint32_t con; /* 1: Enable the controller and interface/functional clocks */ - clk = MMC0_CLK + sc->device_id; + //clk = MMC0_CLK + sc->device_id; + clk = MMC1_CLK; if (ti_prcm_clk_enable(clk) != 0) { device_printf(dev, "Error: failed to enable MMC clock\n"); @@ -1430,6 +1431,7 @@ static int ti_mmchs_init_dma_channels(struct ti_mmchs_softc *sc) { + printf( "%s:%d\n", __FILE__, __LINE__ ); #ifdef SOC_TI_AM335X switch (sc->device_id) { case 0: @@ -1453,13 +1455,16 @@ int err; uint32_t rev; + printf( "%s:%d\n", __FILE__, __LINE__ ); /* Get the current chip revision */ rev = ti_revision(); if ((OMAP_REV_DEVICE(rev) != OMAP4430_DEV) && (sc->device_id > 3)) return(EINVAL); + printf( "%s:%d\n", __FILE__, __LINE__ ); /* Get the DMA MMC triggers */ switch (sc->device_id) { + case 0: case 1: sc->dma_tx_trig = 60; sc->dma_rx_trig = 61; @@ -1485,11 +1490,13 @@ return(EINVAL); } + printf( "%s:%d\n", __FILE__, __LINE__ ); /* Activate a RX channel from the OMAP DMA driver */ err = ti_sdma_activate_channel(&sc->sc_dmach_rd, ti_mmchs_dma_intr, sc); if (err != 0) return(err); + printf( "%s:%d\n", __FILE__, __LINE__ ); /* Setup the RX channel for MMC data transfers */ ti_sdma_set_xfer_burst(sc->sc_dmach_rd, TI_SDMA_BURST_NONE, TI_SDMA_BURST_64); @@ -1499,11 +1506,13 @@ ti_sdma_set_addr_mode(sc->sc_dmach_rd, TI_SDMA_ADDR_CONSTANT, TI_SDMA_ADDR_POST_INCREMENT); + printf( "%s:%d\n", __FILE__, __LINE__ ); /* Activate and configure the TX DMA channel */ err = ti_sdma_activate_channel(&sc->sc_dmach_wr, ti_mmchs_dma_intr, sc); if (err != 0) return(err); + printf( "%s:%d\n", __FILE__, __LINE__ ); /* Setup the TX channel for MMC data transfers */ ti_sdma_set_xfer_burst(sc->sc_dmach_wr, TI_SDMA_BURST_64, TI_SDMA_BURST_NONE); @@ -1595,6 +1604,7 @@ if (sc->sc_mem_res == NULL) panic("%s: Cannot map registers", device_get_name(dev)); + device_printf( dev, "%s:%d\n", __FILE__, __LINE__ ); /* Allocate an IRQ resource for the MMC controller */ rid = 0; sc->sc_irq_res = bus_alloc_resource_any(dev, SYS_RES_IRQ, &rid, @@ -1602,6 +1612,7 @@ if (sc->sc_irq_res == NULL) goto errout; + device_printf( dev, "%s:%d\n", __FILE__, __LINE__ ); /* Allocate DMA tags and maps */ err = bus_dma_tag_create(bus_get_dma_tag(dev), 1, 0, BUS_SPACE_MAXADDR_32BIT, BUS_SPACE_MAXADDR, NULL, @@ -1610,17 +1621,19 @@ if (err != 0) goto errout; + device_printf( dev, "%s:%d\n", __FILE__, __LINE__ ); err = bus_dmamap_create(sc->sc_dmatag, 0, &sc->sc_dmamap); if (err != 0) goto errout; + device_printf( dev, "%s:%d\n", __FILE__, __LINE__ ); /* Initialise the DMA channels to be used by the controller */ err = ti_mmchs_init_dma_channels(sc); if (err != 0) goto errout; /* Set the register offset */ - if (ti_chip() == CHIP_OMAP_3) + if (ti_chip() == CHIP_OMAP_3 || ti_chip() == CHIP_AM37X) // @todo XXX maybe switch instead of if? sc->sc_reg_off = OMAP3_MMCHS_REG_OFFSET; else if (ti_chip() == CHIP_OMAP_4) sc->sc_reg_off = OMAP4_MMCHS_REG_OFFSET; @@ -1691,6 +1704,7 @@ return (ENXIO); } sc->device_id = fdt32_to_cpu(did); + device_printf( dev, "Device id: %d\n", did ); /* Initiate the mtex lock */ TI_MMCHS_LOCK_INIT(sc); @@ -1729,16 +1743,16 @@ #endif /* Activate the device */ - device_printf( dev, "Activating the device..." ); + device_printf( dev, "Activating the device...\n" ); err = ti_mmchs_activate(dev); if (err) goto out; - device_printf( dev, "Initializing the device..." ); + device_printf( dev, "Initializing the device...\n" ); /* Initialise the controller */ ti_mmchs_hw_init(dev); - device_printf( dev, "Setting up interrupt the device..." ); + device_printf( dev, "Setting up interrupt the device...\n" ); /* Activate the interrupt and attach a handler */ err = bus_setup_intr(dev, sc->sc_irq_res, INTR_TYPE_MISC | INTR_MPSAFE, NULL, ti_mmchs_intr, sc, &sc->sc_irq_h); @@ -1754,7 +1768,7 @@ device_add_child(dev, "mmc", 0); device_set_ivars(dev, &sc->host); - device_printf( dev, "Attaching to bus..." ); + device_printf( dev, "Attaching to bus...\n" ); err = bus_generic_attach(dev); out: Modified: soc2012/aleek/beaglexm-armv6/sys/boot/fdt/dts/beagleboardxm.dts ============================================================================== --- soc2012/aleek/beaglexm-armv6/sys/boot/fdt/dts/beagleboardxm.dts Tue Jul 3 09:11:47 2012 (r238903) +++ soc2012/aleek/beaglexm-armv6/sys/boot/fdt/dts/beagleboardxm.dts Tue Jul 3 11:24:41 2012 (r238904) @@ -149,7 +149,7 @@ reg =<0x4809c000 0x1000 >; interrupts = <83>; interrupt-parent = <&AINTC>; - mmchs-device-id = <0>; + mmchs-device-id = <1>; };
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20120703112442.2FA2E106566C>