• Home
  • Raw
  • Download

Lines Matching refs:pfc

27 static int sh_pfc_ioremap(struct sh_pfc *pfc, struct platform_device *pdev)  in sh_pfc_ioremap()  argument
35 pfc->window = devm_kzalloc(pfc->dev, pdev->num_resources * in sh_pfc_ioremap()
36 sizeof(*pfc->window), GFP_NOWAIT); in sh_pfc_ioremap()
37 if (!pfc->window) in sh_pfc_ioremap()
40 pfc->num_windows = pdev->num_resources; in sh_pfc_ioremap()
44 pfc->window[k].phys = res->start; in sh_pfc_ioremap()
45 pfc->window[k].size = resource_size(res); in sh_pfc_ioremap()
46 pfc->window[k].virt = devm_ioremap_nocache(pfc->dev, res->start, in sh_pfc_ioremap()
48 if (!pfc->window[k].virt) in sh_pfc_ioremap()
55 static void __iomem *sh_pfc_phys_to_virt(struct sh_pfc *pfc, in sh_pfc_phys_to_virt() argument
62 for (i = 0; i < pfc->num_windows; i++) { in sh_pfc_phys_to_virt()
63 window = pfc->window + i; in sh_pfc_phys_to_virt()
78 int sh_pfc_get_pin_index(struct sh_pfc *pfc, unsigned int pin) in sh_pfc_get_pin_index() argument
83 if (pfc->info->ranges == NULL) in sh_pfc_get_pin_index()
86 for (i = 0, offset = 0; i < pfc->info->nr_ranges; ++i) { in sh_pfc_get_pin_index()
87 const struct pinmux_range *range = &pfc->info->ranges[i]; in sh_pfc_get_pin_index()
145 static void sh_pfc_config_reg_helper(struct sh_pfc *pfc, in sh_pfc_config_reg_helper() argument
154 *mapped_regp = sh_pfc_phys_to_virt(pfc, crp->reg); in sh_pfc_config_reg_helper()
167 static void sh_pfc_write_config_reg(struct sh_pfc *pfc, in sh_pfc_write_config_reg() argument
174 sh_pfc_config_reg_helper(pfc, crp, field, &mapped_reg, &mask, &pos); in sh_pfc_write_config_reg()
176 dev_dbg(pfc->dev, "write_reg addr = %lx, value = %ld, field = %ld, " in sh_pfc_write_config_reg()
187 if (pfc->info->unlock_reg) in sh_pfc_write_config_reg()
189 sh_pfc_phys_to_virt(pfc, pfc->info->unlock_reg), 32, in sh_pfc_write_config_reg()
195 static int sh_pfc_get_config_reg(struct sh_pfc *pfc, pinmux_enum_t enum_id, in sh_pfc_get_config_reg() argument
205 config_reg = pfc->info->cfg_regs + k; in sh_pfc_get_config_reg()
239 static int sh_pfc_mark_to_enum(struct sh_pfc *pfc, pinmux_enum_t mark, int pos, in sh_pfc_mark_to_enum() argument
242 const pinmux_enum_t *data = pfc->info->gpio_data; in sh_pfc_mark_to_enum()
250 for (k = 0; k < pfc->info->gpio_data_size; k++) { in sh_pfc_mark_to_enum()
257 dev_err(pfc->dev, "cannot locate data/mark enum_id for mark %d\n", in sh_pfc_mark_to_enum()
262 int sh_pfc_config_mux(struct sh_pfc *pfc, unsigned mark, int pinmux_type) in sh_pfc_config_mux() argument
277 range = &pfc->info->output; in sh_pfc_config_mux()
281 range = &pfc->info->input; in sh_pfc_config_mux()
285 range = &pfc->info->input_pu; in sh_pfc_config_mux()
289 range = &pfc->info->input_pd; in sh_pfc_config_mux()
303 pos = sh_pfc_mark_to_enum(pfc, mark, pos, &enum_id); in sh_pfc_config_mux()
314 in_range = sh_pfc_enum_in_range(enum_id, &pfc->info->function); in sh_pfc_config_mux()
341 ret = sh_pfc_get_config_reg(pfc, enum_id, &cr, &field, &value); in sh_pfc_config_mux()
345 sh_pfc_write_config_reg(pfc, cr, field, value); in sh_pfc_config_mux()
354 struct sh_pfc *pfc; in sh_pfc_probe() local
362 pfc = devm_kzalloc(&pdev->dev, sizeof(*pfc), GFP_KERNEL); in sh_pfc_probe()
363 if (pfc == NULL) in sh_pfc_probe()
366 pfc->info = info; in sh_pfc_probe()
367 pfc->dev = &pdev->dev; in sh_pfc_probe()
369 ret = sh_pfc_ioremap(pfc, pdev); in sh_pfc_probe()
373 spin_lock_init(&pfc->lock); in sh_pfc_probe()
380 ret = sh_pfc_register_pinctrl(pfc); in sh_pfc_probe()
388 ret = sh_pfc_register_gpiochip(pfc); in sh_pfc_probe()
395 dev_notice(pfc->dev, "failed to init GPIO chip, ignoring...\n"); in sh_pfc_probe()
399 platform_set_drvdata(pdev, pfc); in sh_pfc_probe()
401 dev_info(pfc->dev, "%s support registered\n", info->name); in sh_pfc_probe()
408 struct sh_pfc *pfc = platform_get_drvdata(pdev); in sh_pfc_remove() local
411 sh_pfc_unregister_gpiochip(pfc); in sh_pfc_remove()
413 sh_pfc_unregister_pinctrl(pfc); in sh_pfc_remove()