1/*- 2 * Copyright (c) 2011 Jakub Wojciech Klama <jceel@FreeBSD.org> 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 36 unchanged lines hidden (view full) --- 45 * [52..64] -> P2.0..P2.12 (port 2) 46 * [65..88] -> P1.0..P1.23 (port 1) 47 * [89..96] -> P0.0..P0.7 (port 0) 48 * 49 */ 50 51 52#include <sys/cdefs.h> |
53__FBSDID("$FreeBSD: stable/10/sys/arm/lpc/lpc_gpio.c 266084 2014-05-14 19:18:58Z ian $"); |
54 55#include <sys/param.h> 56#include <sys/systm.h> 57#include <sys/bio.h> 58#include <sys/bus.h> 59#include <sys/conf.h> 60#include <sys/endian.h> 61#include <sys/kernel.h> --- 435 unchanged lines hidden (view full) --- 497 return (ENXIO); 498 499 return lpc_gpio_pin_get(lpc_gpio_sc->lg_dev, pin, state); 500} 501 502void 503platform_gpio_init() 504{ |
505 bus_space_tag_t bst; 506 bus_space_handle_t bsh; 507 508 bst = fdtbus_bs_tag; 509 |
510 /* Preset SPI devices CS pins to one */ |
511 bus_space_map(bst, LPC_GPIO_PHYS_BASE, LPC_GPIO_SIZE, 0, &bsh); 512 bus_space_write_4(bst, bsh, LPC_GPIO_P3_OUTP_SET, |
513 1 << (SSD1289_CS_PIN - LPC_GPIO_GPO_00(0)) | 514 1 << (SSD1289_DC_PIN - LPC_GPIO_GPO_00(0)) | 515 1 << (ADS7846_CS_PIN - LPC_GPIO_GPO_00(0))); |
516 bus_space_unmap(bst, bsh, LPC_GPIO_SIZE); |
517} 518 519static device_method_t lpc_gpio_methods[] = { 520 /* Device interface */ 521 DEVMETHOD(device_probe, lpc_gpio_probe), 522 DEVMETHOD(device_attach, lpc_gpio_attach), 523 DEVMETHOD(device_detach, lpc_gpio_detach), 524 --- 28 unchanged lines hidden --- |