imx51_ipuv3.c (266152) | imx51_ipuv3.c (266365) |
---|---|
1/*- 2 * Copyright (c) 2012 Oleksandr Tymoshenko <gonzo@freebsd.org> 3 * Copyright (c) 2012, 2013 The FreeBSD Foundation 4 * All rights reserved. 5 * 6 * Portions of this software were developed by Oleksandr Rybalko 7 * under sponsorship from the FreeBSD Foundation. 8 * --- 15 unchanged lines hidden (view full) --- 24 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 25 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 26 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 27 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 28 * SUCH DAMAGE. 29 * 30 */ 31#include <sys/cdefs.h> | 1/*- 2 * Copyright (c) 2012 Oleksandr Tymoshenko <gonzo@freebsd.org> 3 * Copyright (c) 2012, 2013 The FreeBSD Foundation 4 * All rights reserved. 5 * 6 * Portions of this software were developed by Oleksandr Rybalko 7 * under sponsorship from the FreeBSD Foundation. 8 * --- 15 unchanged lines hidden (view full) --- 24 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 25 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 26 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 27 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 28 * SUCH DAMAGE. 29 * 30 */ 31#include <sys/cdefs.h> |
32__FBSDID("$FreeBSD: stable/10/sys/arm/freescale/imx/imx51_ipuv3.c 266152 2014-05-15 16:11:06Z ian $"); | 32__FBSDID("$FreeBSD: stable/10/sys/arm/freescale/imx/imx51_ipuv3.c 266365 2014-05-17 22:00:10Z ian $"); |
33 34#include <sys/param.h> 35#include <sys/systm.h> 36#include <sys/bio.h> 37#include <sys/bus.h> 38#include <sys/conf.h> 39#include <sys/endian.h> 40#include <sys/kernel.h> --- 214 unchanged lines hidden (view full) --- 255 int error; 256 257 if (!ofw_bus_status_okay(dev)) 258 return (ENXIO); 259 260 if (!ofw_bus_is_compatible(dev, "fsl,ipu3")) 261 return (ENXIO); 262 | 33 34#include <sys/param.h> 35#include <sys/systm.h> 36#include <sys/bio.h> 37#include <sys/bus.h> 38#include <sys/conf.h> 39#include <sys/endian.h> 40#include <sys/kernel.h> --- 214 unchanged lines hidden (view full) --- 255 int error; 256 257 if (!ofw_bus_status_okay(dev)) 258 return (ENXIO); 259 260 if (!ofw_bus_is_compatible(dev, "fsl,ipu3")) 261 return (ENXIO); 262 |
263 device_set_desc(dev, "i.MX515 Image Processing Unit (FB)"); | 263 device_set_desc(dev, "i.MX5x Image Processing Unit v3 (FB)"); |
264 265 error = sc_probe_unit(device_get_unit(dev), 266 device_get_flags(dev) | SC_AUTODETECT_KBD); 267 268 if (error != 0) 269 return (error); 270 271 return (BUS_PROBE_DEFAULT); 272} 273 274static int 275ipu3_fb_attach(device_t dev) 276{ 277 struct ipu3sc_softc *sc = device_get_softc(dev); 278 bus_space_tag_t iot; 279 bus_space_handle_t ioh; | 264 265 error = sc_probe_unit(device_get_unit(dev), 266 device_get_flags(dev) | SC_AUTODETECT_KBD); 267 268 if (error != 0) 269 return (error); 270 271 return (BUS_PROBE_DEFAULT); 272} 273 274static int 275ipu3_fb_attach(device_t dev) 276{ 277 struct ipu3sc_softc *sc = device_get_softc(dev); 278 bus_space_tag_t iot; 279 bus_space_handle_t ioh; |
280 phandle_t node; 281 pcell_t reg; |
|
280 int err; | 282 int err; |
283 uintptr_t base; |
|
281 282 if (ipu3sc_softc) 283 return (ENXIO); 284 285 ipu3sc_softc = sc; 286 | 284 285 if (ipu3sc_softc) 286 return (ENXIO); 287 288 ipu3sc_softc = sc; 289 |
287 device_printf(dev, "\tclock gate status is %d\n", 288 imx51_get_clk_gating(IMX51CLK_IPU_HSP_CLK_ROOT)); | 290 if (bootverbose) 291 device_printf(dev, "clock gate status is %d\n", 292 imx51_get_clk_gating(IMX51CLK_IPU_HSP_CLK_ROOT)); |
289 290 sc->dev = dev; 291 292 err = (sc_attach_unit(device_get_unit(dev), 293 device_get_flags(dev) | SC_AUTODETECT_KBD)); 294 295 if (err) { 296 device_printf(dev, "failed to attach syscons\n"); 297 goto fail; 298 } 299 300 sc = device_get_softc(dev); 301 sc->iot = iot = fdtbus_bs_tag; 302 | 293 294 sc->dev = dev; 295 296 err = (sc_attach_unit(device_get_unit(dev), 297 device_get_flags(dev) | SC_AUTODETECT_KBD)); 298 299 if (err) { 300 device_printf(dev, "failed to attach syscons\n"); 301 goto fail; 302 } 303 304 sc = device_get_softc(dev); 305 sc->iot = iot = fdtbus_bs_tag; 306 |
303 device_printf(sc->dev, ": i.MX51 IPUV3 controller\n"); 304 | 307 /* 308 * Retrieve the device address based on the start address in the 309 * DTS. The DTS for i.MX51 specifies 0x5e000000 as the first register 310 * address, so we just subtract IPU_CM_BASE to get the offset at which 311 * the IPU device was memory mapped. 312 * On i.MX53, the offset is 0. 313 */ 314 node = ofw_bus_get_node(dev); 315 if ((OF_getprop(node, "reg", ®, sizeof(reg))) <= 0) 316 base = 0; 317 else 318 base = fdt32_to_cpu(reg) - IPU_CM_BASE(0); |
305 /* map controller registers */ | 319 /* map controller registers */ |
306 err = bus_space_map(iot, IPU_CM_BASE, IPU_CM_SIZE, 0, &ioh); | 320 err = bus_space_map(iot, IPU_CM_BASE(base), IPU_CM_SIZE, 0, &ioh); |
307 if (err) 308 goto fail_retarn_cm; 309 sc->cm_ioh = ioh; 310 311 /* map Display Multi FIFO Controller registers */ | 321 if (err) 322 goto fail_retarn_cm; 323 sc->cm_ioh = ioh; 324 325 /* map Display Multi FIFO Controller registers */ |
312 err = bus_space_map(iot, IPU_DMFC_BASE, IPU_DMFC_SIZE, 0, &ioh); | 326 err = bus_space_map(iot, IPU_DMFC_BASE(base), IPU_DMFC_SIZE, 0, &ioh); |
313 if (err) 314 goto fail_retarn_dmfc; 315 sc->dmfc_ioh = ioh; 316 317 /* map Display Interface 0 registers */ | 327 if (err) 328 goto fail_retarn_dmfc; 329 sc->dmfc_ioh = ioh; 330 331 /* map Display Interface 0 registers */ |
318 err = bus_space_map(iot, IPU_DI0_BASE, IPU_DI0_SIZE, 0, &ioh); | 332 err = bus_space_map(iot, IPU_DI0_BASE(base), IPU_DI0_SIZE, 0, &ioh); |
319 if (err) 320 goto fail_retarn_di0; 321 sc->di0_ioh = ioh; 322 323 /* map Display Interface 1 registers */ | 333 if (err) 334 goto fail_retarn_di0; 335 sc->di0_ioh = ioh; 336 337 /* map Display Interface 1 registers */ |
324 err = bus_space_map(iot, IPU_DI1_BASE, IPU_DI0_SIZE, 0, &ioh); | 338 err = bus_space_map(iot, IPU_DI1_BASE(base), IPU_DI0_SIZE, 0, &ioh); |
325 if (err) 326 goto fail_retarn_di1; 327 sc->di1_ioh = ioh; 328 329 /* map Display Processor registers */ | 339 if (err) 340 goto fail_retarn_di1; 341 sc->di1_ioh = ioh; 342 343 /* map Display Processor registers */ |
330 err = bus_space_map(iot, IPU_DP_BASE, IPU_DP_SIZE, 0, &ioh); | 344 err = bus_space_map(iot, IPU_DP_BASE(base), IPU_DP_SIZE, 0, &ioh); |
331 if (err) 332 goto fail_retarn_dp; 333 sc->dp_ioh = ioh; 334 335 /* map Display Controller registers */ | 345 if (err) 346 goto fail_retarn_dp; 347 sc->dp_ioh = ioh; 348 349 /* map Display Controller registers */ |
336 err = bus_space_map(iot, IPU_DC_BASE, IPU_DC_SIZE, 0, &ioh); | 350 err = bus_space_map(iot, IPU_DC_BASE(base), IPU_DC_SIZE, 0, &ioh); |
337 if (err) 338 goto fail_retarn_dc; 339 sc->dc_ioh = ioh; 340 341 /* map Image DMA Controller registers */ | 351 if (err) 352 goto fail_retarn_dc; 353 sc->dc_ioh = ioh; 354 355 /* map Image DMA Controller registers */ |
342 err = bus_space_map(iot, IPU_IDMAC_BASE, IPU_IDMAC_SIZE, 0, &ioh); | 356 err = bus_space_map(iot, IPU_IDMAC_BASE(base), IPU_IDMAC_SIZE, 0, 357 &ioh); |
343 if (err) 344 goto fail_retarn_idmac; 345 sc->idmac_ioh = ioh; 346 347 /* map CPMEM registers */ | 358 if (err) 359 goto fail_retarn_idmac; 360 sc->idmac_ioh = ioh; 361 362 /* map CPMEM registers */ |
348 err = bus_space_map(iot, IPU_CPMEM_BASE, IPU_CPMEM_SIZE, 0, &ioh); | 363 err = bus_space_map(iot, IPU_CPMEM_BASE(base), IPU_CPMEM_SIZE, 0, 364 &ioh); |
349 if (err) 350 goto fail_retarn_cpmem; 351 sc->cpmem_ioh = ioh; 352 353 /* map DCTEMPL registers */ | 365 if (err) 366 goto fail_retarn_cpmem; 367 sc->cpmem_ioh = ioh; 368 369 /* map DCTEMPL registers */ |
354 err = bus_space_map(iot, IPU_DCTMPL_BASE, IPU_DCTMPL_SIZE, 0, &ioh); | 370 err = bus_space_map(iot, IPU_DCTMPL_BASE(base), IPU_DCTMPL_SIZE, 0, 371 &ioh); |
355 if (err) 356 goto fail_retarn_dctmpl; 357 sc->dctmpl_ioh = ioh; 358 359#ifdef notyet 360 sc->ih = imx51_ipuv3_intr_establish(IMX51_INT_IPUV3, IPL_BIO, 361 ipuv3intr, sc); 362 if (sc->ih == NULL) { --- 518 unchanged lines hidden --- | 372 if (err) 373 goto fail_retarn_dctmpl; 374 sc->dctmpl_ioh = ioh; 375 376#ifdef notyet 377 sc->ih = imx51_ipuv3_intr_establish(IMX51_INT_IPUV3, IPL_BIO, 378 ipuv3intr, sc); 379 if (sc->ih == NULL) { --- 518 unchanged lines hidden --- |