static void snd_stm_stih415_procfs(struct snd_info_entry *entry, struct snd_info_buffer *buffer) { snd_iprintf(buffer, "pcm_clk_sel = %08lx\n", sysconf_read(snd_stm_stih415_pcm_clk_sel)); snd_iprintf(buffer, "biphase_idle_value = %08lx\n", sysconf_read(snd_stm_stih415_biphase_idle_value)); snd_iprintf(buffer, "voip = %08lx\n", sysconf_read(snd_stm_stih415_voip)); snd_iprintf(buffer, "pcmp_valid_sel = %08lx\n", sysconf_read(snd_stm_stih415_pcmp_valid_sel)); }
void __init stx7106_configure_spifsm(struct stm_plat_spifsm_data *data) { struct sysconf_field *sc; /* Not available on stx7105 */ BUG_ON(cpu_data->type == CPU_STX7105); stx7106_spifsm_device.dev.platform_data = data; sc = sysconf_claim(SYS_STA, 1, 5, 8, "boot-device"); /* SoC/IP Capabilities */ data->capabilities.quad_mode = 0; data->capabilities.no_write_repeat = 1; data->capabilities.read_status_bug = spifsm_no_read_status; data->capabilities.boot_from_spi = (sysconf_read(sc) == 0xa) ? 1 : 0; /* Dual mode not possible due to pad configurations issues */ data->capabilities.dual_mode = 0; data->pads = &stx7106_spifsm_pad_config; if (cpu_data->cut_major == 1) { data->capabilities.no_clk_div_4 = 1; data->capabilities.dummy_on_write = 1; data->capabilities.no_sw_reset = 1; } else if (cpu_data->cut_major == 3) { data->capabilities.no_poll_mode_change = 1; } sysconf_release(sc); platform_device_register(&stx7106_spifsm_device); }
static int stm_miphy_tap_tick(int tms, int tdi) { sysconf_write(tap_dev->tck, 0); sysconf_write(tap_dev->tms, tms); sysconf_write(tap_dev->tdi, tdi); sysconf_write(tap_dev->tck, 1); return sysconf_read(tap_dev->tdo); }
unsigned long long stm_device_sysconf_read(struct stm_device_state *state, const char* name) { int i; unsigned long long result = -1; i = stm_device_find_sysconf(state->config, name); WARN_ON(i < 0); if (i >= 0) result = sysconf_read(state->sysconf_fields[i]); return result; }
static int emi_pwr_dwn_ack(struct platform_device *dev, int host_phy, int ack) { static struct sysconf_field *sc; int i; if (!sc) sc = sysconf_claim(SYS_STA, 15, 1, 1, "emi pwr ack"); for (i = 5; i; --i) { if (sysconf_read(sc) == ack) return 0; mdelay(10); } return -EINVAL; }
static int usb_pwr_ack(struct platform_device *dev, int host_phy, int on) { static struct sysconf_field *sc; int i; if (!sc) sc = sysconf_claim(SYS_STA, 15, 4, 4, "USB_PW_ACK"); for (i = 5; i; --i) { if (sysconf_read(sc) == on) return 0; mdelay(10); } return -EINVAL; }
static int usb_pm_sw_reset(struct platform_device *dev) { static struct sysconf_field *sc; unsigned long reg; if (!sc) sc = sysconf_claim(SYS_CFG, 2, 1, 1, "usb reset"); reg = sysconf_read(sc); if (reg) { sysconf_write(sc, 0); mdelay(30); } return 0; }
static int usb_pwr_ack(struct platform_device *pdev, int host_phy, int ack) { static struct sysconf_field *sc[3]; int port = pdev->id; int i; if (!sc[port]) sc[port] = sysconf_claim(SYS_STA, 13, 2+port, 2+port, "usb ack"); for (i = 5; i; --i) { if (sysconf_read(sc[port]) == ack) return 0; mdelay(10); } return -EINVAL; }
static int sata_pwd_dwn_ack(struct platform_device *pdev, int host_phy, int ack) { static struct sysconf_field *sc[2]; int i; if (cpu_data->cut_major < 3) return 0; if (!sc[pdev->id]) sc[pdev->id] = sysconf_claim(SYS_STA, 13, 0 + pdev->id, 0 + pdev->id, "sata"); for (i = 5; i; --i) { if (sysconf_read(sc[pdev->id]) == ack) return 0; mdelay(10); } return -EINVAL; }
void __init stx5206_configure_spifsm(struct stm_plat_spifsm_data *data) { struct sysconf_field *sc; stx5206_spifsm_device.dev.platform_data = data; sc = sysconf_claim(SYS_STA, 1, 16, 17, "boot-device"); /* Pads not shared with PIO (although potential conflict with PCI * alternative routing) */ data->pads = NULL; /* SoC/IP Capabilities */ data->capabilities.quad_mode = 0; data->capabilities.no_read_repeat = 1; data->capabilities.no_write_repeat = 1; data->capabilities.no_clk_div_4 = 1; data->capabilities.read_status_bug = spifsm_no_read_status; data->capabilities.boot_from_spi = (sysconf_read(sc) == 0x2) ? 1 : 0; sysconf_release(sc); platform_device_register(&stx5206_spifsm_device); }
void __init stx7108_configure_pci(struct stm_plat_pci_config *pci_conf) { struct sysconf_field *sc; int i; /* LLA clocks have these horrible names... */ pci_conf->clk_name = "CLKA_PCI"; /* REQ0 is actually wired to REQ3 to work around NAND problems */ pci_conf->req0_to_req3 = 1; BUG_ON(pci_conf->req_gnt[3] != PCI_PIN_UNUSED); /* Fill in the default values */ if (!pci_conf->ad_override_default) { pci_conf->ad_threshold = 5; pci_conf->ad_read_ahead = 1; pci_conf->ad_chunks_in_msg = 0; pci_conf->ad_pcks_in_chunk = 0; pci_conf->ad_trigger_mode = 1; pci_conf->ad_max_opcode = 5; pci_conf->ad_posted = 1; } /* Copy over platform specific data to driver */ stx7108_pci_device.dev.platform_data = pci_conf; #if defined(CONFIG_PM) #warning TODO: PCI Power Management #endif /* Claim and power up the PCI cell */ sc = sysconf_claim(SYS_CFG_BANK2, 30, 2, 2, "PCI_PWR_DWN_REQ"); sysconf_write(sc, 0); /* We will need to stash this somewhere for power management. */ sc = sysconf_claim(SYS_STA_BANK2, 1, 2, 2, "PCI_PWR_DWN_GRANT"); while (sysconf_read(sc)) cpu_relax(); /* Loop until powered up */ /* Configure the REQ/GNT[1..2], muxed with PIOs */ for (i = 1; i <= 2; i++) { switch (pci_conf->req_gnt[i]) { case PCI_PIN_DEFAULT: if (stm_pad_claim(&stx7108_pci_reqgnt_pad_config[i], "PCI") == NULL) { printk(KERN_ERR "Failed to claim REQ/GNT%d " "pads!\n", i); BUG(); } break; case PCI_PIN_UNUSED: /* Unused is unused - nothing to do */ break; default: /* No alternative here... */ BUG(); break; } } /* Configure INTA..D interrupts */ for (i = 0; i < 4; i++) { switch (pci_conf->pci_irq[i]) { case PCI_PIN_DEFAULT: if (stm_pad_claim(&stx7108_pci_int_pad_config[i], "PCI") == NULL) { printk(KERN_ERR "Failed to claim INT%c pad!\n", 'A' + i); BUG(); } set_irq_type(ILC_IRQ(122 + i), IRQ_TYPE_LEVEL_LOW); break; case PCI_PIN_ALTERNATIVE: /* There is no alternative here ;-) */ BUG(); break; default: /* Unused or interrupt number passed, nothing to do */ break; } } /* Configure the SERR interrupt (if wired up) */ switch (pci_conf->serr_irq) { case PCI_PIN_DEFAULT: if (gpio_request(STX7108_PIO_PCI_SERR, "PCI_SERR#") == 0) { gpio_direction_input(STX7108_PIO_PCI_SERR); pci_conf->serr_irq = gpio_to_irq(STX7108_PIO_PCI_SERR); set_irq_type(pci_conf->serr_irq, IRQ_TYPE_LEVEL_LOW); } else { printk(KERN_WARNING "%s(): Failed to claim PCI SERR# " "PIO!\n", __func__); pci_conf->serr_irq = PCI_PIN_UNUSED; } break; case PCI_PIN_ALTERNATIVE: /* No alternative here */ BUG(); pci_conf->serr_irq = PCI_PIN_UNUSED; break; } if (pci_conf->serr_irq != PCI_PIN_UNUSED) { struct resource *res = platform_get_resource_byname(&stx7108_pci_device, IORESOURCE_IRQ, "pci serr"); BUG_ON(!res); res->start = pci_conf->serr_irq; res->end = pci_conf->serr_irq; } /* LOCK is not claimed as is totally pointless, the SOCs do not * support any form of coherency */ stx7108_pci_device.dev.parent = bus_find_device_by_name(&platform_bus_type, NULL, "emi"); platform_device_register(&stx7108_pci_device); }
static int stx5206_pio_config(unsigned gpio, enum stm_pad_gpio_direction direction, int function, void *priv) { int port = stm_gpio_port(gpio); int pin = stm_gpio_pin(gpio); BUG_ON(port > ARRAY_SIZE(stx5206_pio_devices)); if (function == STX5206_GPIO_FUNCTION) { switch (direction) { case stm_pad_gpio_direction_in: stm_gpio_direction(gpio, STM_GPIO_DIRECTION_IN); break; case stm_pad_gpio_direction_out: stm_gpio_direction(gpio, STM_GPIO_DIRECTION_OUT); break; case stm_pad_gpio_direction_bidir: stm_gpio_direction(gpio, STM_GPIO_DIRECTION_BIDIR); break; default: BUG(); break; } } else if (direction == stm_pad_gpio_direction_in) { BUG_ON(function != -1); stm_gpio_direction(gpio, STM_GPIO_DIRECTION_IN); } else { static struct sysconf_field *sys_cfg_16; static struct sysconf_field *sys_cfg_17; switch (direction) { case stm_pad_gpio_direction_out: stm_gpio_direction(gpio, STM_GPIO_DIRECTION_ALT_OUT); break; case stm_pad_gpio_direction_bidir: stm_gpio_direction(gpio, STM_GPIO_DIRECTION_ALT_BIDIR); break; default: BUG(); break; } if (!sys_cfg_16) { sys_cfg_16 = sysconf_claim(SYS_CFG, 16, 0, 31, "PIO Config"); BUG_ON(!sys_cfg_16); sys_cfg_17 = sysconf_claim(SYS_CFG, 17, 0, 31, "PIO Config"); BUG_ON(!sys_cfg_17); } if (port > 0) { struct sysconf_field *cfg; int offset; unsigned int value; BUG_ON(function < 0); BUG_ON(function > 3); if (port < 3) cfg = sys_cfg_16; else cfg = sys_cfg_17; offset = 16 * ((port - 1) % 2) + pin; value = sysconf_read(cfg); value &= ~((1 << (offset + 8)) | (1 << offset)); value |= ((function >> 1) & 1) << (offset + 8); value |= (function & 1) << offset; sysconf_write(cfg, value); } else { BUG_ON(function != 0); } }