Changeset View
Changeset View
Standalone View
Standalone View
head/sys/arm/mv/mv_common.c
Show First 20 Lines • Show All 132 Lines • ▼ Show 20 Lines | |||||
static boolean_t platform_io_coherent = false; | static boolean_t platform_io_coherent = false; | ||||
static struct decode_win cpu_win_tbl[MAX_CPU_WIN]; | static struct decode_win cpu_win_tbl[MAX_CPU_WIN]; | ||||
const struct decode_win *cpu_wins = cpu_win_tbl; | const struct decode_win *cpu_wins = cpu_win_tbl; | ||||
typedef void (*decode_win_setup_t)(u_long); | typedef void (*decode_win_setup_t)(u_long); | ||||
typedef void (*dump_win_t)(u_long); | typedef void (*dump_win_t)(u_long); | ||||
typedef int (*valid_t)(void); | |||||
/* | /* | ||||
* The power status of device feature is only supported on | * The power status of device feature is only supported on | ||||
* Kirkwood and Discovery SoCs. | * Kirkwood and Discovery SoCs. | ||||
*/ | */ | ||||
#if defined(SOC_MV_KIRKWOOD) || defined(SOC_MV_DISCOVERY) | #if defined(SOC_MV_KIRKWOOD) || defined(SOC_MV_DISCOVERY) | ||||
#define SOC_MV_POWER_STAT_SUPPORTED 1 | #define SOC_MV_POWER_STAT_SUPPORTED 1 | ||||
#else | #else | ||||
#define SOC_MV_POWER_STAT_SUPPORTED 0 | #define SOC_MV_POWER_STAT_SUPPORTED 0 | ||||
#endif | #endif | ||||
struct soc_node_spec { | struct soc_node_spec { | ||||
const char *compat; | const char *compat; | ||||
decode_win_setup_t decode_handler; | decode_win_setup_t decode_handler; | ||||
dump_win_t dump_handler; | dump_win_t dump_handler; | ||||
valid_t valid_handler; | |||||
}; | }; | ||||
static struct soc_node_spec soc_nodes[] = { | static struct soc_node_spec soc_nodes[] = { | ||||
{ "mrvl,ge", &decode_win_eth_setup, &decode_win_eth_dump }, | { "mrvl,ge", &decode_win_eth_setup, &decode_win_eth_dump, &decode_win_eth_valid}, | ||||
{ "marvell,armada-370-neta", &decode_win_neta_setup, &decode_win_neta_dump }, | { "marvell,armada-370-neta", &decode_win_neta_setup, | ||||
{ "mrvl,usb-ehci", &decode_win_usb_setup, &decode_win_usb_dump }, | &decode_win_neta_dump, NULL }, | ||||
{ "marvell,orion-ehci", &decode_win_usb_setup, &decode_win_usb_dump }, | { "mrvl,usb-ehci", &decode_win_usb_setup, &decode_win_usb_dump, &decode_win_usb_valid}, | ||||
{ "marvell,armada-380-xhci", &decode_win_usb3_setup, &decode_win_usb3_dump }, | { "marvell,orion-ehci", &decode_win_usb_setup, &decode_win_usb_dump, &decode_win_usb_valid }, | ||||
{ "marvell,armada-380-ahci", &decode_win_ahci_setup, &decode_win_ahci_dump }, | { "marvell,armada-380-xhci", &decode_win_usb3_setup, | ||||
{ "marvell,armada-380-sdhci", &decode_win_sdhci_setup, &decode_win_sdhci_dump }, | &decode_win_usb3_dump, &decode_win_usb3_valid }, | ||||
{ "mrvl,sata", &decode_win_sata_setup, NULL }, | { "marvell,armada-380-ahci", &decode_win_ahci_setup, | ||||
{ "mrvl,xor", &decode_win_xor_setup, &decode_win_xor_dump }, | &decode_win_ahci_dump, NULL }, | ||||
{ "mrvl,idma", &decode_win_idma_setup, &decode_win_idma_dump }, | { "marvell,armada-380-sdhci", &decode_win_sdhci_setup, | ||||
{ "mrvl,cesa", &decode_win_cesa_setup, &decode_win_cesa_dump }, | &decode_win_sdhci_dump, &decode_win_sdhci_valid}, | ||||
{ "mrvl,pcie", &decode_win_pcie_setup, &decode_win_pcie_dump }, | { "mrvl,sata", &decode_win_sata_setup, NULL, &decode_win_sata_valid}, | ||||
{ NULL, NULL, NULL }, | { "mrvl,xor", &decode_win_xor_setup, &decode_win_xor_dump, &decode_win_xor_valid}, | ||||
{ "mrvl,idma", &decode_win_idma_setup, &decode_win_idma_dump, &decode_win_idma_valid}, | |||||
{ "mrvl,cesa", &decode_win_cesa_setup, &decode_win_cesa_dump, &decode_win_cesa_valid}, | |||||
{ "mrvl,pcie", &decode_win_pcie_setup, &decode_win_pcie_dump, &decode_win_pcie_valid}, | |||||
{ NULL, NULL, NULL, NULL }, | |||||
}; | }; | ||||
struct fdt_pm_mask_entry { | struct fdt_pm_mask_entry { | ||||
char *compat; | char *compat; | ||||
uint32_t mask; | uint32_t mask; | ||||
}; | }; | ||||
static struct fdt_pm_mask_entry fdt_pm_mask_table[] = { | static struct fdt_pm_mask_entry fdt_pm_mask_table[] = { | ||||
▲ Show 20 Lines • Show All 410 Lines • ▼ Show 20 Lines | soc_decode_win(void) | ||||
/* Retrieve our ID: some windows facilities vary between SoC models */ | /* Retrieve our ID: some windows facilities vary between SoC models */ | ||||
soc_id(&dev, &rev); | soc_id(&dev, &rev); | ||||
#ifdef SOC_MV_ARMADAXP | #ifdef SOC_MV_ARMADAXP | ||||
if ((err = decode_win_sdram_fixup()) != 0) | if ((err = decode_win_sdram_fixup()) != 0) | ||||
return(err); | return(err); | ||||
#endif | #endif | ||||
if (!decode_win_cpu_valid() || !decode_win_usb_valid() || | |||||
!decode_win_eth_valid() || !decode_win_idma_valid() || | |||||
!decode_win_pcie_valid() || !decode_win_sata_valid() || | |||||
!decode_win_xor_valid() || !decode_win_usb3_valid() || | |||||
!decode_win_sdhci_valid() || !decode_win_cesa_valid()) | |||||
return (EINVAL); | |||||
decode_win_cpu_setup(); | decode_win_cpu_setup(); | ||||
if (MV_DUMP_WIN) | if (MV_DUMP_WIN) | ||||
soc_dump_decode_win(); | soc_dump_decode_win(); | ||||
eth_port = 0; | eth_port = 0; | ||||
usb_port = 0; | usb_port = 0; | ||||
if ((err = fdt_win_setup()) != 0) | if ((err = fdt_win_setup()) != 0) | ||||
▲ Show 20 Lines • Show All 1,844 Lines • ▼ Show 20 Lines | for (i = 0; soc_nodes[i].compat != NULL; i++) { | ||||
if (OF_getprop(child, "reg", ®, sizeof(reg)) <= 0) | if (OF_getprop(child, "reg", ®, sizeof(reg)) <= 0) | ||||
return (EINVAL); | return (EINVAL); | ||||
if (addr_cells <= 2) | if (addr_cells <= 2) | ||||
base = fdt_data_get(®[0], addr_cells); | base = fdt_data_get(®[0], addr_cells); | ||||
else | else | ||||
base = fdt_data_get(®[addr_cells - 2], 2); | base = fdt_data_get(®[addr_cells - 2], 2); | ||||
size = fdt_data_get(®[addr_cells], size_cells); | size = fdt_data_get(®[addr_cells], size_cells); | ||||
if (soc_node->valid_handler != NULL) | |||||
if (!soc_node->valid_handler()) | |||||
return (EINVAL); | |||||
base = (base & 0x000fffff) | fdt_immr_va; | base = (base & 0x000fffff) | fdt_immr_va; | ||||
if (soc_node->decode_handler != NULL) | if (soc_node->decode_handler != NULL) | ||||
soc_node->decode_handler(base); | soc_node->decode_handler(base); | ||||
else | else | ||||
return (ENXIO); | return (ENXIO); | ||||
if (MV_DUMP_WIN && (soc_node->dump_handler != NULL)) | if (MV_DUMP_WIN && (soc_node->dump_handler != NULL)) | ||||
▲ Show 20 Lines • Show All 195 Lines • Show Last 20 Lines |