Guess the TI chip based on the PLATFORM infos, instead of relying on the

kernel config file.
This commit is contained in:
Olivier Houchard 2016-11-18 23:48:20 +00:00
parent fcef00c336
commit 31a2ddf253
2 changed files with 27 additions and 7 deletions

View File

@ -70,15 +70,12 @@
#define CHIP_OMAP_4 0
#define CHIP_AM335X 1
extern int _ti_chip;
static __inline int ti_chip(void)
{
#if defined(SOC_OMAP4)
return CHIP_OMAP_4;
#elif defined(SOC_TI_AM335X)
return CHIP_AM335X;
#else
# error Chip type not defined, ensure SOC_xxxx is defined
#endif
KASSERT(_ti_chip != -1, ("Can't determine TI Chip"));
return _ti_chip;
}
uint32_t ti_revision(void);

View File

@ -54,11 +54,32 @@ __FBSDID("$FreeBSD$");
#include <arm/ti/omap4/omap4_reg.h>
#include <arm/ti/omap4/omap4_mp.h>
#include <arm/ti/ti_cpuid.h>
#include "platform_if.h"
void (*ti_cpu_reset)(void) = NULL;
int _ti_chip = -1;
#if defined(SOC_OMAP4)
static int
omap4_attach(platform_t plat)
{
_ti_chip = CHIP_OMAP_4;
return (0);
}
#endif
#if defined(SOC_TI_AM335X)
static int
ti_am335x_attach(platform_t plat)
{
_ti_chip = CHIP_AM335X;
return (0);
}
#endif
static vm_offset_t
ti_lastaddr(platform_t plat)
{
@ -107,6 +128,7 @@ ti_plat_cpu_reset(platform_t plat)
#if defined(SOC_OMAP4)
static platform_method_t omap4_methods[] = {
PLATFORMMETHOD(platform_attach, omap4_attach),
PLATFORMMETHOD(platform_devmap_init, ti_omap4_devmap_init),
PLATFORMMETHOD(platform_lastaddr, ti_lastaddr),
PLATFORMMETHOD(platform_cpu_reset, ti_plat_cpu_reset),
@ -122,6 +144,7 @@ FDT_PLATFORM_DEF(omap4, "omap4", 0, "ti,omap4430", 0);
#if defined(SOC_TI_AM335X)
static platform_method_t am335x_methods[] = {
PLATFORMMETHOD(platform_attach, ti_am335x_attach),
PLATFORMMETHOD(platform_devmap_init, ti_am335x_devmap_init),
PLATFORMMETHOD(platform_lastaddr, ti_lastaddr),
PLATFORMMETHOD(platform_cpu_reset, ti_plat_cpu_reset),