Changeset View
Changeset View
Standalone View
Standalone View
head/sys/arm/mv/mv_common.c
| Show First 20 Lines • Show All 127 Lines • ▼ Show 20 Lines | |||||
| 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); | ||||
| /* | |||||
| * The power status of device feature is only supported on | |||||
| * Kirkwood and Discovery SoCs. | |||||
| */ | |||||
| #if defined(SOC_MV_KIRKWOOD) || defined(SOC_MV_DISCOVERY) | |||||
| #define SOC_MV_POWER_STAT_SUPPORTED 1 | |||||
| #else | |||||
| #define SOC_MV_POWER_STAT_SUPPORTED 0 | |||||
| #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; | ||||
| }; | }; | ||||
| 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 }, | ||||
| Show All 25 Lines | static struct fdt_pm_mask_entry fdt_pm_mask_table[] = { | ||||
| { "mrvl,sata", CPU_PM_CTRL_SATA }, | { "mrvl,sata", CPU_PM_CTRL_SATA }, | ||||
| { NULL, 0 } | { NULL, 0 } | ||||
| }; | }; | ||||
| static __inline int | static __inline int | ||||
| pm_is_disabled(uint32_t mask) | pm_is_disabled(uint32_t mask) | ||||
| { | { | ||||
| #if defined(SOC_MV_KIRKWOOD) | #if SOC_MV_POWER_STAT_SUPPORTED | ||||
| return (soc_power_ctrl_get(mask) == mask); | |||||
| #else | |||||
| return (soc_power_ctrl_get(mask) == mask ? 0 : 1); | return (soc_power_ctrl_get(mask) == mask ? 0 : 1); | ||||
| #else | |||||
| return (0); | |||||
| #endif | #endif | ||||
| } | } | ||||
| /* | /* | ||||
| * Disable device using power management register. | * Disable device using power management register. | ||||
| * 1 - Device Power On | * 1 - Device Power On | ||||
| * 0 - Device Power Off | * 0 - Device Power Off | ||||
| * Mask can be set in loader. | * Mask can be set in loader. | ||||
| ▲ Show 20 Lines • Show All 170 Lines • ▼ Show 20 Lines | |||||
| /* | /* | ||||
| * Get the power status of device. This feature is only supported on | * Get the power status of device. This feature is only supported on | ||||
| * Kirkwood and Discovery SoCs. | * Kirkwood and Discovery SoCs. | ||||
| */ | */ | ||||
| uint32_t | uint32_t | ||||
| soc_power_ctrl_get(uint32_t mask) | soc_power_ctrl_get(uint32_t mask) | ||||
| { | { | ||||
| #if !defined(SOC_MV_ORION) | #if SOC_MV_POWER_STAT_SUPPORTED | ||||
| if (mask != CPU_PM_CTRL_NONE) | if (mask != CPU_PM_CTRL_NONE) | ||||
| mask &= read_cpu_ctrl(CPU_PM_CTRL); | mask &= read_cpu_ctrl(CPU_PM_CTRL); | ||||
| return (mask); | return (mask); | ||||
| #else | #else | ||||
| return (mask); | return (mask); | ||||
| #endif | #endif | ||||
| } | } | ||||
| ▲ Show 20 Lines • Show All 786 Lines • ▼ Show 20 Lines | |||||
| /* | /* | ||||
| * Set USB decode windows. | * Set USB decode windows. | ||||
| */ | */ | ||||
| static void | static void | ||||
| decode_win_usb_setup(u_long base) | decode_win_usb_setup(u_long base) | ||||
| { | { | ||||
| uint32_t br, cr; | uint32_t br, cr; | ||||
| int i, j; | int i, j; | ||||
| if (pm_is_disabled(CPU_PM_CTRL_USB(usb_port))) | if (pm_is_disabled(CPU_PM_CTRL_USB(usb_port))) | ||||
| return; | return; | ||||
| usb_port++; | usb_port++; | ||||
| for (i = 0; i < MV_WIN_USB_MAX; i++) { | for (i = 0; i < MV_WIN_USB_MAX; i++) { | ||||
| win_usb_cr_write(base, i, 0); | win_usb_cr_write(base, i, 0); | ||||
| ▲ Show 20 Lines • Show All 1,399 Lines • Show Last 20 Lines | |||||