board_cpld.c (233542) | board_cpld.c (255368) |
---|---|
1/*- 2 * Copyright (c) 2003-2012 Broadcom Corporation 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 * --- 13 unchanged lines hidden (view full) --- 22 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR 23 * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 24 * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE 25 * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN 26 * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 27 */ 28 29#include <sys/cdefs.h> | 1/*- 2 * Copyright (c) 2003-2012 Broadcom Corporation 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 * --- 13 unchanged lines hidden (view full) --- 22 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR 23 * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 24 * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE 25 * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN 26 * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 27 */ 28 29#include <sys/cdefs.h> |
30__FBSDID("$FreeBSD: head/sys/mips/nlm/board_cpld.c 233542 2012-03-27 12:25:47Z jchandra $"); | 30__FBSDID("$FreeBSD: head/sys/mips/nlm/board_cpld.c 255368 2013-09-07 18:26:16Z jchandra $"); |
31#include <sys/param.h> 32#include <sys/systm.h> 33#include <sys/endian.h> 34 35#include <mips/nlm/hal/mips-extns.h> 36#include <mips/nlm/hal/haldefs.h> 37#include <mips/nlm/hal/iomap.h> 38#include <mips/nlm/hal/gbu.h> --- 11 unchanged lines hidden (view full) --- 50#define CPLD_DATA 0x8 51 52static __inline 53int nlm_cpld_read(uint64_t base, int reg) 54{ 55 uint16_t val; 56 57 val = *(volatile uint16_t *)(long)(base + reg * 2); | 31#include <sys/param.h> 32#include <sys/systm.h> 33#include <sys/endian.h> 34 35#include <mips/nlm/hal/mips-extns.h> 36#include <mips/nlm/hal/haldefs.h> 37#include <mips/nlm/hal/iomap.h> 38#include <mips/nlm/hal/gbu.h> --- 11 unchanged lines hidden (view full) --- 50#define CPLD_DATA 0x8 51 52static __inline 53int nlm_cpld_read(uint64_t base, int reg) 54{ 55 uint16_t val; 56 57 val = *(volatile uint16_t *)(long)(base + reg * 2); |
58 return bswap16(val); | 58 return le16toh(val); |
59} 60 61static __inline void 62nlm_cpld_write(uint64_t base, int reg, uint16_t data) 63{ | 59} 60 61static __inline void 62nlm_cpld_write(uint64_t base, int reg, uint16_t data) 63{ |
64 bswap16(data); | 64 data = htole16(data); |
65 *(volatile uint16_t *)(long)(base + reg * 2) = data; 66} 67 68int 69nlm_board_cpld_majorversion(uint64_t base) 70{ 71 return (nlm_cpld_read(base, CPLD_REVISION) >> 8); 72} --- 41 unchanged lines hidden --- | 65 *(volatile uint16_t *)(long)(base + reg * 2) = data; 66} 67 68int 69nlm_board_cpld_majorversion(uint64_t base) 70{ 71 return (nlm_cpld_read(base, CPLD_REVISION) >> 8); 72} --- 41 unchanged lines hidden --- |