core.c 14.6 KB
Newer Older
M
Magnus Damm 已提交
1
/*
2 3 4
 * Pin Control and GPIO driver for SuperH Pin Function Controller.
 *
 * Authors: Magnus Damm, Paul Mundt, Laurent Pinchart
M
Magnus Damm 已提交
5 6
 *
 * Copyright (C) 2008 Magnus Damm
7
 * Copyright (C) 2009 - 2012 Paul Mundt
M
Magnus Damm 已提交
8 9 10 11 12
 *
 * This file is subject to the terms and conditions of the GNU General Public
 * License.  See the file "COPYING" in the main directory of this archive
 * for more details.
 */
13 14

#define DRV_NAME "sh-pfc"
15

16
#include <linux/bitops.h>
M
Magnus Damm 已提交
17
#include <linux/err.h>
18
#include <linux/errno.h>
M
Magnus Damm 已提交
19
#include <linux/io.h>
M
Magnus Damm 已提交
20
#include <linux/ioport.h>
21
#include <linux/kernel.h>
22
#include <linux/init.h>
L
Laurent Pinchart 已提交
23 24
#include <linux/of.h>
#include <linux/of_device.h>
25
#include <linux/pinctrl/machine.h>
26
#include <linux/platform_device.h>
27
#include <linux/slab.h>
M
Magnus Damm 已提交
28

29 30
#include "core.h"

31 32
static int sh_pfc_map_resources(struct sh_pfc *pfc,
				struct platform_device *pdev)
M
Magnus Damm 已提交
33
{
34
	unsigned int num_windows, num_irqs;
35 36
	struct sh_pfc_window *windows;
	unsigned int *irqs = NULL;
M
Magnus Damm 已提交
37
	struct resource *res;
38
	unsigned int i;
39
	int irq;
40 41

	/* Count the MEM and IRQ resources. */
42 43 44
	for (num_windows = 0;; num_windows++) {
		res = platform_get_resource(pdev, IORESOURCE_MEM, num_windows);
		if (!res)
45
			break;
46 47 48 49 50 51
	}
	for (num_irqs = 0;; num_irqs++) {
		irq = platform_get_irq(pdev, num_irqs);
		if (irq == -EPROBE_DEFER)
			return irq;
		if (irq < 0)
52 53
			break;
	}
M
Magnus Damm 已提交
54

55
	if (num_windows == 0)
56
		return -EINVAL;
M
Magnus Damm 已提交
57

58 59 60 61
	/* Allocate memory windows and IRQs arrays. */
	windows = devm_kzalloc(pfc->dev, num_windows * sizeof(*windows),
			       GFP_KERNEL);
	if (windows == NULL)
L
Laurent Pinchart 已提交
62
		return -ENOMEM;
M
Magnus Damm 已提交
63

64 65
	pfc->num_windows = num_windows;
	pfc->windows = windows;
66

67 68 69 70
	if (num_irqs) {
		irqs = devm_kzalloc(pfc->dev, num_irqs * sizeof(*irqs),
				    GFP_KERNEL);
		if (irqs == NULL)
L
Laurent Pinchart 已提交
71
			return -ENOMEM;
72 73 74 75 76 77

		pfc->num_irqs = num_irqs;
		pfc->irqs = irqs;
	}

	/* Fill them. */
78 79 80 81 82 83 84 85
	for (i = 0; i < num_windows; i++) {
		res = platform_get_resource(pdev, IORESOURCE_MEM, i);
		windows->phys = res->start;
		windows->size = resource_size(res);
		windows->virt = devm_ioremap_resource(pfc->dev, res);
		if (IS_ERR(windows->virt))
			return -ENOMEM;
		windows++;
M
Magnus Damm 已提交
86
	}
87 88
	for (i = 0; i < num_irqs; i++)
		*irqs++ = platform_get_irq(pdev, i);
M
Magnus Damm 已提交
89 90 91 92

	return 0;
}

93
static void __iomem *sh_pfc_phys_to_virt(struct sh_pfc *pfc, u32 reg)
M
Magnus Damm 已提交
94
{
95
	struct sh_pfc_window *window;
96
	phys_addr_t address = reg;
97
	unsigned int i;
M
Magnus Damm 已提交
98 99

	/* scan through physical windows and convert address */
100
	for (i = 0; i < pfc->num_windows; i++) {
101
		window = pfc->windows + i;
M
Magnus Damm 已提交
102 103 104 105 106 107 108 109 110 111

		if (address < window->phys)
			continue;

		if (address >= (window->phys + window->size))
			continue;

		return window->virt + (address - window->phys);
	}

112
	BUG();
113
	return NULL;
M
Magnus Damm 已提交
114
}
M
Magnus Damm 已提交
115

116
int sh_pfc_get_pin_index(struct sh_pfc *pfc, unsigned int pin)
117
{
118 119 120
	unsigned int offset;
	unsigned int i;

121 122
	for (i = 0, offset = 0; i < pfc->nr_ranges; ++i) {
		const struct sh_pfc_pin_range *range = &pfc->ranges[i];
123 124

		if (pin <= range->end)
125 126
			return pin >= range->start
			     ? offset + pin - range->start : -1;
127

128
		offset += range->end - range->start + 1;
129 130
	}

131
	return -EINVAL;
132 133
}

134
static int sh_pfc_enum_in_range(u16 enum_id, const struct pinmux_range *r)
M
Magnus Damm 已提交
135 136 137 138 139 140 141 142 143 144
{
	if (enum_id < r->begin)
		return 0;

	if (enum_id > r->end)
		return 0;

	return 1;
}

145
u32 sh_pfc_read_raw_reg(void __iomem *mapped_reg, unsigned int reg_width)
M
Magnus Damm 已提交
146 147 148
{
	switch (reg_width) {
	case 8:
M
Magnus Damm 已提交
149
		return ioread8(mapped_reg);
M
Magnus Damm 已提交
150
	case 16:
M
Magnus Damm 已提交
151
		return ioread16(mapped_reg);
M
Magnus Damm 已提交
152
	case 32:
M
Magnus Damm 已提交
153
		return ioread32(mapped_reg);
M
Magnus Damm 已提交
154 155 156 157 158 159
	}

	BUG();
	return 0;
}

160
void sh_pfc_write_raw_reg(void __iomem *mapped_reg, unsigned int reg_width,
161
			  u32 data)
M
Magnus Damm 已提交
162 163 164
{
	switch (reg_width) {
	case 8:
M
Magnus Damm 已提交
165
		iowrite8(data, mapped_reg);
M
Magnus Damm 已提交
166 167
		return;
	case 16:
M
Magnus Damm 已提交
168
		iowrite16(data, mapped_reg);
M
Magnus Damm 已提交
169 170
		return;
	case 32:
M
Magnus Damm 已提交
171
		iowrite32(data, mapped_reg);
M
Magnus Damm 已提交
172 173 174 175 176 177
		return;
	}

	BUG();
}

178 179 180 181 182 183 184 185 186 187 188 189 190 191 192
u32 sh_pfc_read_reg(struct sh_pfc *pfc, u32 reg, unsigned int width)
{
	return sh_pfc_read_raw_reg(sh_pfc_phys_to_virt(pfc, reg), width);
}

void sh_pfc_write_reg(struct sh_pfc *pfc, u32 reg, unsigned int width, u32 data)
{
	if (pfc->info->unlock_reg)
		sh_pfc_write_raw_reg(
			sh_pfc_phys_to_virt(pfc, pfc->info->unlock_reg), 32,
			~data);

	sh_pfc_write_raw_reg(sh_pfc_phys_to_virt(pfc, reg), width, data);
}

193
static void sh_pfc_config_reg_helper(struct sh_pfc *pfc,
L
Laurent Pinchart 已提交
194
				     const struct pinmux_cfg_reg *crp,
195
				     unsigned int in_pos,
196
				     void __iomem **mapped_regp, u32 *maskp,
197
				     unsigned int *posp)
M
Magnus Damm 已提交
198
{
199
	unsigned int k;
200

201
	*mapped_regp = sh_pfc_phys_to_virt(pfc, crp->reg);
M
Magnus Damm 已提交
202

203 204 205 206 207 208 209 210 211
	if (crp->field_width) {
		*maskp = (1 << crp->field_width) - 1;
		*posp = crp->reg_width - ((in_pos + 1) * crp->field_width);
	} else {
		*maskp = (1 << crp->var_field_width[in_pos]) - 1;
		*posp = crp->reg_width;
		for (k = 0; k <= in_pos; k++)
			*posp -= crp->var_field_width[k];
	}
212 213
}

214
static void sh_pfc_write_config_reg(struct sh_pfc *pfc,
L
Laurent Pinchart 已提交
215
				    const struct pinmux_cfg_reg *crp,
216
				    unsigned int field, u32 value)
M
Magnus Damm 已提交
217
{
218
	void __iomem *mapped_reg;
219
	unsigned int pos;
220
	u32 mask, data;
M
Magnus Damm 已提交
221

222
	sh_pfc_config_reg_helper(pfc, crp, field, &mapped_reg, &mask, &pos);
M
Magnus Damm 已提交
223

224
	dev_dbg(pfc->dev, "write_reg addr = %x, value = 0x%x, field = %u, "
225
		"r_width = %u, f_width = %u\n",
226
		crp->reg, value, field, crp->reg_width, crp->field_width);
M
Magnus Damm 已提交
227 228 229

	mask = ~(mask << pos);
	value = value << pos;
M
Magnus Damm 已提交
230

231
	data = sh_pfc_read_raw_reg(mapped_reg, crp->reg_width);
M
Magnus Damm 已提交
232 233 234
	data &= mask;
	data |= value;

235
	if (pfc->info->unlock_reg)
236
		sh_pfc_write_raw_reg(
237
			sh_pfc_phys_to_virt(pfc, pfc->info->unlock_reg), 32,
238
			~data);
M
Magnus Damm 已提交
239

240
	sh_pfc_write_raw_reg(mapped_reg, crp->reg_width, data);
M
Magnus Damm 已提交
241 242
}

243
static int sh_pfc_get_config_reg(struct sh_pfc *pfc, u16 enum_id,
244 245
				 const struct pinmux_cfg_reg **crp,
				 unsigned int *fieldp, u32 *valuep)
M
Magnus Damm 已提交
246
{
247
	unsigned int k = 0;
M
Magnus Damm 已提交
248 249

	while (1) {
250 251 252 253 254 255 256 257
		const struct pinmux_cfg_reg *config_reg =
			pfc->info->cfg_regs + k;
		unsigned int r_width = config_reg->reg_width;
		unsigned int f_width = config_reg->field_width;
		unsigned int curr_width;
		unsigned int bit_pos;
		unsigned int pos = 0;
		unsigned int m = 0;
M
Magnus Damm 已提交
258 259 260

		if (!r_width)
			break;
261 262

		for (bit_pos = 0; bit_pos < r_width; bit_pos += curr_width) {
263 264 265
			u32 ncomb;
			u32 n;

266 267 268 269 270 271 272 273 274 275 276 277 278
			if (f_width)
				curr_width = f_width;
			else
				curr_width = config_reg->var_field_width[m];

			ncomb = 1 << curr_width;
			for (n = 0; n < ncomb; n++) {
				if (config_reg->enum_ids[pos + n] == enum_id) {
					*crp = config_reg;
					*fieldp = m;
					*valuep = n;
					return 0;
				}
M
Magnus Damm 已提交
279
			}
280 281
			pos += ncomb;
			m++;
M
Magnus Damm 已提交
282 283 284 285
		}
		k++;
	}

286
	return -EINVAL;
M
Magnus Damm 已提交
287 288
}

289 290
static int sh_pfc_mark_to_enum(struct sh_pfc *pfc, u16 mark, int pos,
			      u16 *enum_idp)
M
Magnus Damm 已提交
291
{
292
	const u16 *data = pfc->info->pinmux_data;
293
	unsigned int k;
M
Magnus Damm 已提交
294 295 296 297 298 299

	if (pos) {
		*enum_idp = data[pos + 1];
		return pos + 1;
	}

300
	for (k = 0; k < pfc->info->pinmux_data_size; k++) {
301
		if (data[k] == mark) {
M
Magnus Damm 已提交
302 303 304 305 306
			*enum_idp = data[k + 1];
			return k + 1;
		}
	}

307 308
	dev_err(pfc->dev, "cannot locate data/mark enum_id for mark %d\n",
		mark);
309
	return -EINVAL;
M
Magnus Damm 已提交
310 311
}

312
int sh_pfc_config_mux(struct sh_pfc *pfc, unsigned mark, int pinmux_type)
M
Magnus Damm 已提交
313
{
L
Laurent Pinchart 已提交
314
	const struct pinmux_range *range;
315
	int pos = 0;
M
Magnus Damm 已提交
316 317

	switch (pinmux_type) {
318
	case PINMUX_TYPE_GPIO:
M
Magnus Damm 已提交
319 320 321 322 323
	case PINMUX_TYPE_FUNCTION:
		range = NULL;
		break;

	case PINMUX_TYPE_OUTPUT:
324
		range = &pfc->info->output;
M
Magnus Damm 已提交
325 326 327
		break;

	case PINMUX_TYPE_INPUT:
328
		range = &pfc->info->input;
M
Magnus Damm 已提交
329 330 331
		break;

	default:
332
		return -EINVAL;
M
Magnus Damm 已提交
333 334
	}

335
	/* Iterate over all the configuration fields we need to update. */
M
Magnus Damm 已提交
336
	while (1) {
337 338 339 340 341 342 343
		const struct pinmux_cfg_reg *cr;
		unsigned int field;
		u16 enum_id;
		u32 value;
		int in_range;
		int ret;

344
		pos = sh_pfc_mark_to_enum(pfc, mark, pos, &enum_id);
345 346
		if (pos < 0)
			return pos;
M
Magnus Damm 已提交
347 348 349 350

		if (!enum_id)
			break;

351 352 353 354
		/* Check if the configuration field selects a function. If it
		 * doesn't, skip the field if it's not applicable to the
		 * requested pinmux type.
		 */
355
		in_range = sh_pfc_enum_in_range(enum_id, &pfc->info->function);
356
		if (!in_range) {
357 358 359 360 361 362 363 364
			if (pinmux_type == PINMUX_TYPE_FUNCTION) {
				/* Functions are allowed to modify all
				 * fields.
				 */
				in_range = 1;
			} else if (pinmux_type != PINMUX_TYPE_GPIO) {
				/* Input/output types can only modify fields
				 * that correspond to their respective ranges.
365
				 */
366
				in_range = sh_pfc_enum_in_range(enum_id, range);
367 368 369 370 371 372 373 374 375

				/*
				 * special case pass through for fixed
				 * input-only or output-only pins without
				 * function enum register association.
				 */
				if (in_range && enum_id == range->force)
					continue;
			}
376
			/* GPIOs are only allowed to modify function fields. */
377 378
		}

M
Magnus Damm 已提交
379 380 381
		if (!in_range)
			continue;

382 383 384
		ret = sh_pfc_get_config_reg(pfc, enum_id, &cr, &field, &value);
		if (ret < 0)
			return ret;
M
Magnus Damm 已提交
385

386
		sh_pfc_write_config_reg(pfc, cr, field, value);
M
Magnus Damm 已提交
387 388 389 390 391
	}

	return 0;
}

392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415
static int sh_pfc_init_ranges(struct sh_pfc *pfc)
{
	struct sh_pfc_pin_range *range;
	unsigned int nr_ranges;
	unsigned int i;

	if (pfc->info->pins[0].pin == (u16)-1) {
		/* Pin number -1 denotes that the SoC doesn't report pin numbers
		 * in its pin arrays yet. Consider the pin numbers range as
		 * continuous and allocate a single range.
		 */
		pfc->nr_ranges = 1;
		pfc->ranges = devm_kzalloc(pfc->dev, sizeof(*pfc->ranges),
					   GFP_KERNEL);
		if (pfc->ranges == NULL)
			return -ENOMEM;

		pfc->ranges->start = 0;
		pfc->ranges->end = pfc->info->nr_pins - 1;
		pfc->nr_gpio_pins = pfc->info->nr_pins;

		return 0;
	}

416 417 418 419
	/* Count, allocate and fill the ranges. The PFC SoC data pins array must
	 * be sorted by pin numbers, and pins without a GPIO port must come
	 * last.
	 */
420 421 422 423 424 425 426 427 428 429 430 431 432 433 434
	for (i = 1, nr_ranges = 1; i < pfc->info->nr_pins; ++i) {
		if (pfc->info->pins[i-1].pin != pfc->info->pins[i].pin - 1)
			nr_ranges++;
	}

	pfc->nr_ranges = nr_ranges;
	pfc->ranges = devm_kzalloc(pfc->dev, sizeof(*pfc->ranges) * nr_ranges,
				   GFP_KERNEL);
	if (pfc->ranges == NULL)
		return -ENOMEM;

	range = pfc->ranges;
	range->start = pfc->info->pins[0].pin;

	for (i = 1; i < pfc->info->nr_pins; ++i) {
435 436 437 438 439 440 441 442 443
		if (pfc->info->pins[i-1].pin == pfc->info->pins[i].pin - 1)
			continue;

		range->end = pfc->info->pins[i-1].pin;
		if (!(pfc->info->pins[i-1].configs & SH_PFC_PIN_CFG_NO_GPIO))
			pfc->nr_gpio_pins = range->end + 1;

		range++;
		range->start = pfc->info->pins[i].pin;
444 445 446
	}

	range->end = pfc->info->pins[i-1].pin;
447 448
	if (!(pfc->info->pins[i-1].configs & SH_PFC_PIN_CFG_NO_GPIO))
		pfc->nr_gpio_pins = range->end + 1;
449 450 451 452

	return 0;
}

L
Laurent Pinchart 已提交
453 454
#ifdef CONFIG_OF
static const struct of_device_id sh_pfc_of_table[] = {
455 456 457 458 459 460
#ifdef CONFIG_PINCTRL_PFC_EMEV2
	{
		.compatible = "renesas,pfc-emev2",
		.data = &emev2_pinmux_info,
	},
#endif
L
Laurent Pinchart 已提交
461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490
#ifdef CONFIG_PINCTRL_PFC_R8A73A4
	{
		.compatible = "renesas,pfc-r8a73a4",
		.data = &r8a73a4_pinmux_info,
	},
#endif
#ifdef CONFIG_PINCTRL_PFC_R8A7740
	{
		.compatible = "renesas,pfc-r8a7740",
		.data = &r8a7740_pinmux_info,
	},
#endif
#ifdef CONFIG_PINCTRL_PFC_R8A7778
	{
		.compatible = "renesas,pfc-r8a7778",
		.data = &r8a7778_pinmux_info,
	},
#endif
#ifdef CONFIG_PINCTRL_PFC_R8A7779
	{
		.compatible = "renesas,pfc-r8a7779",
		.data = &r8a7779_pinmux_info,
	},
#endif
#ifdef CONFIG_PINCTRL_PFC_R8A7790
	{
		.compatible = "renesas,pfc-r8a7790",
		.data = &r8a7790_pinmux_info,
	},
#endif
491 492 493 494 495 496
#ifdef CONFIG_PINCTRL_PFC_R8A7791
	{
		.compatible = "renesas,pfc-r8a7791",
		.data = &r8a7791_pinmux_info,
	},
#endif
497 498 499 500 501 502
#ifdef CONFIG_PINCTRL_PFC_R8A7793
	{
		.compatible = "renesas,pfc-r8a7793",
		.data = &r8a7793_pinmux_info,
	},
#endif
503 504 505 506 507 508
#ifdef CONFIG_PINCTRL_PFC_R8A7794
	{
		.compatible = "renesas,pfc-r8a7794",
		.data = &r8a7794_pinmux_info,
	},
#endif
509 510 511 512 513 514
#ifdef CONFIG_PINCTRL_PFC_R8A7795
	{
		.compatible = "renesas,pfc-r8a7795",
		.data = &r8a7795_pinmux_info,
	},
#endif
L
Laurent Pinchart 已提交
515 516 517 518 519 520 521 522 523 524
#ifdef CONFIG_PINCTRL_PFC_SH73A0
	{
		.compatible = "renesas,pfc-sh73a0",
		.data = &sh73a0_pinmux_info,
	},
#endif
	{ },
};
#endif

525
static int sh_pfc_probe(struct platform_device *pdev)
M
Magnus Damm 已提交
526
{
L
Laurent Pinchart 已提交
527 528 529 530
	const struct platform_device_id *platid = platform_get_device_id(pdev);
#ifdef CONFIG_OF
	struct device_node *np = pdev->dev.of_node;
#endif
L
Laurent Pinchart 已提交
531
	const struct sh_pfc_soc_info *info;
532
	struct sh_pfc *pfc;
M
Magnus Damm 已提交
533
	int ret;
M
Magnus Damm 已提交
534

L
Laurent Pinchart 已提交
535 536
#ifdef CONFIG_OF
	if (np)
537
		info = of_device_get_match_data(&pdev->dev);
L
Laurent Pinchart 已提交
538 539 540 541
	else
#endif
		info = platid ? (const void *)platid->driver_data : NULL;

542
	if (info == NULL)
543
		return -ENODEV;
M
Magnus Damm 已提交
544

545
	pfc = devm_kzalloc(&pdev->dev, sizeof(*pfc), GFP_KERNEL);
546 547
	if (pfc == NULL)
		return -ENOMEM;
548

549
	pfc->info = info;
550 551
	pfc->dev = &pdev->dev;

552
	ret = sh_pfc_map_resources(pfc, pdev);
553
	if (unlikely(ret < 0))
M
Magnus Damm 已提交
554 555
		return ret;

556
	spin_lock_init(&pfc->lock);
M
Magnus Damm 已提交
557

558 559 560 561 562 563
	if (info->ops && info->ops->init) {
		ret = info->ops->init(pfc);
		if (ret < 0)
			return ret;
	}

564
	pinctrl_provide_dummies();
M
Magnus Damm 已提交
565

566 567 568 569
	ret = sh_pfc_init_ranges(pfc);
	if (ret < 0)
		return ret;

570 571 572
	/*
	 * Initialize pinctrl bindings first
	 */
573
	ret = sh_pfc_register_pinctrl(pfc);
574
	if (unlikely(ret != 0))
575
		return ret;
576

577
#ifdef CONFIG_PINCTRL_SH_PFC_GPIO
578 579 580
	/*
	 * Then the GPIO chip
	 */
581
	ret = sh_pfc_register_gpiochip(pfc);
582
	if (unlikely(ret != 0)) {
583 584 585 586 587
		/*
		 * If the GPIO chip fails to come up we still leave the
		 * PFC state as it is, given that there are already
		 * extant users of it that have succeeded by this point.
		 */
588
		dev_notice(pfc->dev, "failed to init GPIO chip, ignoring...\n");
589
	}
590
#endif
591

592 593
	platform_set_drvdata(pdev, pfc);

594
	dev_info(pfc->dev, "%s support registered\n", info->name);
595

596
	return 0;
597
}
598

599 600 601 602
static int sh_pfc_remove(struct platform_device *pdev)
{
	struct sh_pfc *pfc = platform_get_drvdata(pdev);

603
#ifdef CONFIG_PINCTRL_SH_PFC_GPIO
604 605 606 607 608 609 610 611
	sh_pfc_unregister_gpiochip(pfc);
#endif
	sh_pfc_unregister_pinctrl(pfc);

	return 0;
}

static const struct platform_device_id sh_pfc_id_table[] = {
612 613 614
#ifdef CONFIG_PINCTRL_PFC_SH7203
	{ "pfc-sh7203", (kernel_ulong_t)&sh7203_pinmux_info },
#endif
615 616 617
#ifdef CONFIG_PINCTRL_PFC_SH7264
	{ "pfc-sh7264", (kernel_ulong_t)&sh7264_pinmux_info },
#endif
618 619 620
#ifdef CONFIG_PINCTRL_PFC_SH7269
	{ "pfc-sh7269", (kernel_ulong_t)&sh7269_pinmux_info },
#endif
621 622
#ifdef CONFIG_PINCTRL_PFC_SH7720
	{ "pfc-sh7720", (kernel_ulong_t)&sh7720_pinmux_info },
623 624 625
#endif
#ifdef CONFIG_PINCTRL_PFC_SH7722
	{ "pfc-sh7722", (kernel_ulong_t)&sh7722_pinmux_info },
626 627 628
#endif
#ifdef CONFIG_PINCTRL_PFC_SH7723
	{ "pfc-sh7723", (kernel_ulong_t)&sh7723_pinmux_info },
629 630 631
#endif
#ifdef CONFIG_PINCTRL_PFC_SH7724
	{ "pfc-sh7724", (kernel_ulong_t)&sh7724_pinmux_info },
632 633 634
#endif
#ifdef CONFIG_PINCTRL_PFC_SH7734
	{ "pfc-sh7734", (kernel_ulong_t)&sh7734_pinmux_info },
635 636 637
#endif
#ifdef CONFIG_PINCTRL_PFC_SH7757
	{ "pfc-sh7757", (kernel_ulong_t)&sh7757_pinmux_info },
638 639 640
#endif
#ifdef CONFIG_PINCTRL_PFC_SH7785
	{ "pfc-sh7785", (kernel_ulong_t)&sh7785_pinmux_info },
641 642 643
#endif
#ifdef CONFIG_PINCTRL_PFC_SH7786
	{ "pfc-sh7786", (kernel_ulong_t)&sh7786_pinmux_info },
644 645 646
#endif
#ifdef CONFIG_PINCTRL_PFC_SHX3
	{ "pfc-shx3", (kernel_ulong_t)&shx3_pinmux_info },
647
#endif
648 649 650 651 652 653 654 655 656 657
	{ "sh-pfc", 0 },
	{ },
};

static struct platform_driver sh_pfc_driver = {
	.probe		= sh_pfc_probe,
	.remove		= sh_pfc_remove,
	.id_table	= sh_pfc_id_table,
	.driver		= {
		.name	= DRV_NAME,
L
Laurent Pinchart 已提交
658
		.of_match_table = of_match_ptr(sh_pfc_of_table),
659 660 661
	},
};

662 663 664
static int __init sh_pfc_init(void)
{
	return platform_driver_register(&sh_pfc_driver);
665
}
666
postcore_initcall(sh_pfc_init);