Date: Wed, 20 Jan 2016 13:55:52 +0000 (UTC) From: Zbigniew Bodek <zbb@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r294426 - in head/sys/arm/mv: . armada38x Message-ID: <201601201355.u0KDtq0S068646@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: zbb Date: Wed Jan 20 13:55:51 2016 New Revision: 294426 URL: https://svnweb.freebsd.org/changeset/base/294426 Log: Enable SCU unit for Armada38x Valid SCU operation is necessary for SMP interoperability. Initialization function armada38x_enable_scu() was added. Reviewed by: andrew, ian Obtained from: Semihalf Sponsored by: Stormshield Submitted by: Bartosz Szczepanek <bsz@semihalf.com> Differential revision: https://reviews.freebsd.org/D4220 Modified: head/sys/arm/mv/armada38x/armada38x.c head/sys/arm/mv/mv_machdep.c head/sys/arm/mv/mvreg.h Modified: head/sys/arm/mv/armada38x/armada38x.c ============================================================================== --- head/sys/arm/mv/armada38x/armada38x.c Wed Jan 20 13:53:33 2016 (r294425) +++ head/sys/arm/mv/armada38x/armada38x.c Wed Jan 20 13:55:51 2016 (r294426) @@ -39,6 +39,7 @@ __FBSDID("$FreeBSD$"); #include <arm/mv/mvvar.h> int armada38x_win_set_iosync_barrier(void); +int armada38x_scu_enable(void); uint32_t get_tclk(void) @@ -78,3 +79,25 @@ armada38x_win_set_iosync_barrier(void) return (rv); } + +int +armada38x_scu_enable(void) +{ + bus_space_handle_t vaddr_scu; + int rv; + uint32_t val; + + rv = bus_space_map(fdtbus_bs_tag, (bus_addr_t)MV_SCU_BASE, + MV_SCU_REGS_LEN, 0, &vaddr_scu); + if (rv != 0) + return (rv); + + /* Enable SCU */ + val = bus_space_read_4(fdtbus_bs_tag, vaddr_scu, MV_SCU_REG_CTRL); + if (!(val & MV_SCU_ENABLE)) + bus_space_write_4(fdtbus_bs_tag, vaddr_scu, 0, + val | MV_SCU_ENABLE); + + bus_space_unmap(fdtbus_bs_tag, vaddr_scu, MV_SCU_REGS_LEN); + return (0); +} Modified: head/sys/arm/mv/mv_machdep.c ============================================================================== --- head/sys/arm/mv/mv_machdep.c Wed Jan 20 13:53:33 2016 (r294425) +++ head/sys/arm/mv/mv_machdep.c Wed Jan 20 13:55:51 2016 (r294426) @@ -68,6 +68,7 @@ void armadaxp_l2_init(void); #endif #if defined(SOC_MV_ARMADA38X) int armada38x_win_set_iosync_barrier(void); +int armada38x_scu_enable(void); #endif #define MPP_PIN_MAX 68 @@ -257,6 +258,8 @@ platform_late_init(void) /* Set IO Sync Barrier bit for all Mbus devices */ if (armada38x_win_set_iosync_barrier() != 0) printf("WARNING: could not map CPU Subsystem registers\n"); + if (armada38x_scu_enable() != 0) + printf("WARNING: could not enable SCU\n"); #endif } Modified: head/sys/arm/mv/mvreg.h ============================================================================== --- head/sys/arm/mv/mvreg.h Wed Jan 20 13:53:33 2016 (r294425) +++ head/sys/arm/mv/mvreg.h Wed Jan 20 13:55:51 2016 (r294426) @@ -34,6 +34,8 @@ #ifndef _MVREG_H_ #define _MVREG_H_ +#include <arm/mv/mvwin.h> + #if defined(SOC_MV_DISCOVERY) #define IRQ_CAUSE_ERROR 0x0 #define IRQ_CAUSE 0x4 @@ -452,4 +454,15 @@ #define MV_DRBL_MASK(d,u) (0x10 * (u) + 0x8 * (d) + 0x4) #define MV_DRBL_MSG(m,d,u) (0x10 * (u) + 0x8 * (d) + 0x4 * (m) + 0x30) #endif + +/* + * SCU + */ +#if defined(SOC_MV_ARMADA38X) +#define MV_SCU_BASE (MV_BASE + 0xc000) +#define MV_SCU_REGS_LEN 0x100 +#define MV_SCU_REG_CTRL 0 +#define MV_SCU_ENABLE 1 +#endif + #endif /* _MVREG_H_ */
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201601201355.u0KDtq0S068646>