Deleted Added
full compact
armada38x.c (294425) armada38x.c (294426)
1/*-
2 * Copyright (c) 2015 Semihalf.
3 * Copyright (c) 2015 Stormshield.
4 * All rights reserved.
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions
8 * are met:

--- 12 unchanged lines hidden (view full) ---

21 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
22 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
23 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
24 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
25 * SUCH DAMAGE.
26 */
27
28#include <sys/cdefs.h>
1/*-
2 * Copyright (c) 2015 Semihalf.
3 * Copyright (c) 2015 Stormshield.
4 * All rights reserved.
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions
8 * are met:

--- 12 unchanged lines hidden (view full) ---

21 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
22 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
23 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
24 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
25 * SUCH DAMAGE.
26 */
27
28#include <sys/cdefs.h>
29__FBSDID("$FreeBSD: head/sys/arm/mv/armada38x/armada38x.c 294425 2016-01-20 13:53:33Z zbb $");
29__FBSDID("$FreeBSD: head/sys/arm/mv/armada38x/armada38x.c 294426 2016-01-20 13:55:51Z zbb $");
30
31#include <sys/param.h>
32#include <sys/systm.h>
33#include <sys/bus.h>
34
35#include <machine/fdt.h>
36
37#include <arm/mv/mvwin.h>
38#include <arm/mv/mvreg.h>
39#include <arm/mv/mvvar.h>
40
41int armada38x_win_set_iosync_barrier(void);
30
31#include <sys/param.h>
32#include <sys/systm.h>
33#include <sys/bus.h>
34
35#include <machine/fdt.h>
36
37#include <arm/mv/mvwin.h>
38#include <arm/mv/mvreg.h>
39#include <arm/mv/mvvar.h>
40
41int armada38x_win_set_iosync_barrier(void);
42int armada38x_scu_enable(void);
42
43uint32_t
44get_tclk(void)
45{
46 uint32_t sar;
47
48 /*
49 * On Armada38x TCLK can be configured to 250 MHz or 200 MHz.

--- 23 unchanged lines hidden (view full) ---

73 MV_SYNC_BARRIER_CTRL_ALL);
74
75 bus_space_barrier(fdtbus_bs_tag, vaddr_iowind, 0,
76 MV_CPU_SUBSYS_REGS_LEN, BUS_SPACE_BARRIER_WRITE);
77 bus_space_unmap(fdtbus_bs_tag, vaddr_iowind, MV_CPU_SUBSYS_REGS_LEN);
78
79 return (rv);
80}
43
44uint32_t
45get_tclk(void)
46{
47 uint32_t sar;
48
49 /*
50 * On Armada38x TCLK can be configured to 250 MHz or 200 MHz.

--- 23 unchanged lines hidden (view full) ---

74 MV_SYNC_BARRIER_CTRL_ALL);
75
76 bus_space_barrier(fdtbus_bs_tag, vaddr_iowind, 0,
77 MV_CPU_SUBSYS_REGS_LEN, BUS_SPACE_BARRIER_WRITE);
78 bus_space_unmap(fdtbus_bs_tag, vaddr_iowind, MV_CPU_SUBSYS_REGS_LEN);
79
80 return (rv);
81}
82
83int
84armada38x_scu_enable(void)
85{
86 bus_space_handle_t vaddr_scu;
87 int rv;
88 uint32_t val;
89
90 rv = bus_space_map(fdtbus_bs_tag, (bus_addr_t)MV_SCU_BASE,
91 MV_SCU_REGS_LEN, 0, &vaddr_scu);
92 if (rv != 0)
93 return (rv);
94
95 /* Enable SCU */
96 val = bus_space_read_4(fdtbus_bs_tag, vaddr_scu, MV_SCU_REG_CTRL);
97 if (!(val & MV_SCU_ENABLE))
98 bus_space_write_4(fdtbus_bs_tag, vaddr_scu, 0,
99 val | MV_SCU_ENABLE);
100
101 bus_space_unmap(fdtbus_bs_tag, vaddr_scu, MV_SCU_REGS_LEN);
102 return (0);
103}