core.c 14.0 KB
Newer Older
M
Magnus Damm 已提交
1
/*
2
 * SuperH Pin Function Controller support.
M
Magnus Damm 已提交
3 4
 *
 * Copyright (C) 2008 Magnus Damm
5
 * Copyright (C) 2009 - 2012 Paul Mundt
M
Magnus Damm 已提交
6 7 8 9 10
 *
 * 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.
 */
11 12

#define DRV_NAME "sh-pfc"
13
#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
14

15
#include <linux/bitops.h>
M
Magnus Damm 已提交
16
#include <linux/err.h>
17
#include <linux/errno.h>
M
Magnus Damm 已提交
18
#include <linux/io.h>
M
Magnus Damm 已提交
19
#include <linux/ioport.h>
20 21
#include <linux/kernel.h>
#include <linux/module.h>
22
#include <linux/pinctrl/machine.h>
23
#include <linux/platform_device.h>
24 25
#include <linux/sh_pfc.h>
#include <linux/slab.h>
M
Magnus Damm 已提交
26

27 28
#include "core.h"

29
static int sh_pfc_ioremap(struct sh_pfc *pfc, struct platform_device *pdev)
M
Magnus Damm 已提交
30 31 32 33
{
	struct resource *res;
	int k;

34
	if (pdev->num_resources == 0) {
35
		pfc->num_windows = 0;
M
Magnus Damm 已提交
36
		return 0;
37
	}
M
Magnus Damm 已提交
38

39
	pfc->window = devm_kzalloc(pfc->dev, pdev->num_resources *
L
Laurent Pinchart 已提交
40
				   sizeof(*pfc->window), GFP_NOWAIT);
41
	if (!pfc->window)
L
Laurent Pinchart 已提交
42
		return -ENOMEM;
M
Magnus Damm 已提交
43

44
	pfc->num_windows = pdev->num_resources;
45

46
	for (k = 0, res = pdev->resource; k < pdev->num_resources; k++, res++) {
M
Magnus Damm 已提交
47
		WARN_ON(resource_type(res) != IORESOURCE_MEM);
48 49
		pfc->window[k].phys = res->start;
		pfc->window[k].size = resource_size(res);
50 51 52
		pfc->window[k].virt = devm_ioremap_nocache(pfc->dev, res->start,
							   resource_size(res));
		if (!pfc->window[k].virt)
L
Laurent Pinchart 已提交
53
			return -ENOMEM;
M
Magnus Damm 已提交
54 55 56 57 58
	}

	return 0;
}

59 60
static void __iomem *sh_pfc_phys_to_virt(struct sh_pfc *pfc,
					 unsigned long address)
M
Magnus Damm 已提交
61
{
62
	struct sh_pfc_window *window;
M
Magnus Damm 已提交
63 64 65
	int k;

	/* scan through physical windows and convert address */
66
	for (k = 0; k < pfc->num_windows; k++) {
67
		window = pfc->window + k;
M
Magnus Damm 已提交
68 69 70 71 72 73 74 75 76 77 78 79 80

		if (address < window->phys)
			continue;

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

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

	/* no windows defined, register must be 1:1 mapped virt:phys */
	return (void __iomem *)address;
}
M
Magnus Damm 已提交
81

82
static int sh_pfc_enum_in_range(pinmux_enum_t enum_id, struct pinmux_range *r)
M
Magnus Damm 已提交
83 84 85 86 87 88 89 90 91 92
{
	if (enum_id < r->begin)
		return 0;

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

	return 1;
}

93 94
static unsigned long sh_pfc_read_raw_reg(void __iomem *mapped_reg,
					 unsigned long reg_width)
M
Magnus Damm 已提交
95 96 97
{
	switch (reg_width) {
	case 8:
M
Magnus Damm 已提交
98
		return ioread8(mapped_reg);
M
Magnus Damm 已提交
99
	case 16:
M
Magnus Damm 已提交
100
		return ioread16(mapped_reg);
M
Magnus Damm 已提交
101
	case 32:
M
Magnus Damm 已提交
102
		return ioread32(mapped_reg);
M
Magnus Damm 已提交
103 104 105 106 107 108
	}

	BUG();
	return 0;
}

109 110
static void sh_pfc_write_raw_reg(void __iomem *mapped_reg,
				 unsigned long reg_width, unsigned long data)
M
Magnus Damm 已提交
111 112 113
{
	switch (reg_width) {
	case 8:
M
Magnus Damm 已提交
114
		iowrite8(data, mapped_reg);
M
Magnus Damm 已提交
115 116
		return;
	case 16:
M
Magnus Damm 已提交
117
		iowrite16(data, mapped_reg);
M
Magnus Damm 已提交
118 119
		return;
	case 32:
M
Magnus Damm 已提交
120
		iowrite32(data, mapped_reg);
M
Magnus Damm 已提交
121 122 123 124 125 126
		return;
	}

	BUG();
}

127
int sh_pfc_read_bit(struct pinmux_data_reg *dr, unsigned long in_pos)
128 129 130 131 132 133 134 135
{
	unsigned long pos;

	pos = dr->reg_width - (in_pos + 1);

	pr_debug("read_bit: addr = %lx, pos = %ld, "
		 "r_width = %ld\n", dr->reg, pos, dr->reg_width);

136
	return (sh_pfc_read_raw_reg(dr->mapped_reg, dr->reg_width) >> pos) & 1;
137 138
}

139 140
void sh_pfc_write_bit(struct pinmux_data_reg *dr, unsigned long in_pos,
		      unsigned long value)
M
Magnus Damm 已提交
141 142 143 144 145
{
	unsigned long pos;

	pos = dr->reg_width - (in_pos + 1);

146
	pr_debug("write_bit addr = %lx, value = %d, pos = %ld, "
147 148
		 "r_width = %ld\n",
		 dr->reg, !!value, pos, dr->reg_width);
M
Magnus Damm 已提交
149 150 151 152 153 154

	if (value)
		set_bit(pos, &dr->reg_shadow);
	else
		clear_bit(pos, &dr->reg_shadow);

155
	sh_pfc_write_raw_reg(dr->mapped_reg, dr->reg_width, dr->reg_shadow);
M
Magnus Damm 已提交
156 157
}

158 159 160 161 162 163
static void sh_pfc_config_reg_helper(struct sh_pfc *pfc,
				     struct pinmux_cfg_reg *crp,
				     unsigned long in_pos,
				     void __iomem **mapped_regp,
				     unsigned long *maskp,
				     unsigned long *posp)
M
Magnus Damm 已提交
164
{
165 166
	int k;

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

169 170 171 172 173 174 175 176 177
	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];
	}
178 179
}

180 181 182
static int sh_pfc_read_config_reg(struct sh_pfc *pfc,
				  struct pinmux_cfg_reg *crp,
				  unsigned long field)
183 184 185 186
{
	void __iomem *mapped_reg;
	unsigned long mask, pos;

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

189
	pr_debug("read_reg: addr = %lx, field = %ld, "
190
		 "r_width = %ld, f_width = %ld\n",
191
		 crp->reg, field, crp->reg_width, crp->field_width);
M
Magnus Damm 已提交
192

193
	return (sh_pfc_read_raw_reg(mapped_reg, crp->reg_width) >> pos) & mask;
M
Magnus Damm 已提交
194 195
}

196 197 198
static void sh_pfc_write_config_reg(struct sh_pfc *pfc,
				    struct pinmux_cfg_reg *crp,
				    unsigned long field, unsigned long value)
M
Magnus Damm 已提交
199
{
200
	void __iomem *mapped_reg;
M
Magnus Damm 已提交
201
	unsigned long mask, pos, data;
M
Magnus Damm 已提交
202

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

205
	pr_debug("write_reg addr = %lx, value = %ld, field = %ld, "
206
		 "r_width = %ld, f_width = %ld\n",
207
		 crp->reg, value, field, crp->reg_width, crp->field_width);
M
Magnus Damm 已提交
208 209 210

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

212
	data = sh_pfc_read_raw_reg(mapped_reg, crp->reg_width);
M
Magnus Damm 已提交
213 214 215
	data &= mask;
	data |= value;

216
	if (pfc->info->unlock_reg)
217
		sh_pfc_write_raw_reg(
218
			sh_pfc_phys_to_virt(pfc, pfc->info->unlock_reg), 32,
219
			~data);
M
Magnus Damm 已提交
220

221
	sh_pfc_write_raw_reg(mapped_reg, crp->reg_width, data);
M
Magnus Damm 已提交
222 223
}

224
static int sh_pfc_setup_data_reg(struct sh_pfc *pfc, unsigned gpio)
M
Magnus Damm 已提交
225
{
226
	struct pinmux_gpio *gpiop = &pfc->info->gpios[gpio];
M
Magnus Damm 已提交
227 228 229
	struct pinmux_data_reg *data_reg;
	int k, n;

230
	if (!sh_pfc_enum_in_range(gpiop->enum_id, &pfc->info->data))
M
Magnus Damm 已提交
231 232 233 234
		return -1;

	k = 0;
	while (1) {
235
		data_reg = pfc->info->data_regs + k;
M
Magnus Damm 已提交
236 237 238 239

		if (!data_reg->reg_width)
			break;

240
		data_reg->mapped_reg = sh_pfc_phys_to_virt(pfc, data_reg->reg);
M
Magnus Damm 已提交
241

M
Magnus Damm 已提交
242
		for (n = 0; n < data_reg->reg_width; n++) {
M
Magnus Damm 已提交
243 244 245 246 247
			if (data_reg->enum_ids[n] == gpiop->enum_id) {
				gpiop->flags &= ~PINMUX_FLAG_DREG;
				gpiop->flags |= (k << PINMUX_FLAG_DREG_SHIFT);
				gpiop->flags &= ~PINMUX_FLAG_DBIT;
				gpiop->flags |= (n << PINMUX_FLAG_DBIT_SHIFT);
M
Magnus Damm 已提交
248 249 250 251 252 253
				return 0;
			}
		}
		k++;
	}

M
Magnus Damm 已提交
254 255
	BUG();

M
Magnus Damm 已提交
256 257 258
	return -1;
}

259
static void sh_pfc_setup_data_regs(struct sh_pfc *pfc)
M
Magnus Damm 已提交
260 261 262 263
{
	struct pinmux_data_reg *drp;
	int k;

264
	for (k = pfc->info->first_gpio; k <= pfc->info->last_gpio; k++)
265
		sh_pfc_setup_data_reg(pfc, k);
M
Magnus Damm 已提交
266 267 268

	k = 0;
	while (1) {
269
		drp = pfc->info->data_regs + k;
M
Magnus Damm 已提交
270 271 272 273

		if (!drp->reg_width)
			break;

274 275
		drp->reg_shadow = sh_pfc_read_raw_reg(drp->mapped_reg,
						      drp->reg_width);
M
Magnus Damm 已提交
276 277 278 279
		k++;
	}
}

280
int sh_pfc_get_data_reg(struct sh_pfc *pfc, unsigned gpio,
M
Magnus Damm 已提交
281 282
			struct pinmux_data_reg **drp, int *bitp)
{
283
	struct pinmux_gpio *gpiop = &pfc->info->gpios[gpio];
M
Magnus Damm 已提交
284 285
	int k, n;

286
	if (!sh_pfc_enum_in_range(gpiop->enum_id, &pfc->info->data))
M
Magnus Damm 已提交
287 288 289 290
		return -1;

	k = (gpiop->flags & PINMUX_FLAG_DREG) >> PINMUX_FLAG_DREG_SHIFT;
	n = (gpiop->flags & PINMUX_FLAG_DBIT) >> PINMUX_FLAG_DBIT_SHIFT;
291
	*drp = pfc->info->data_regs + k;
M
Magnus Damm 已提交
292 293 294 295
	*bitp = n;
	return 0;
}

296 297 298
static int sh_pfc_get_config_reg(struct sh_pfc *pfc, pinmux_enum_t enum_id,
				 struct pinmux_cfg_reg **crp, int *fieldp,
				 int *valuep, unsigned long **cntp)
M
Magnus Damm 已提交
299 300
{
	struct pinmux_cfg_reg *config_reg;
301 302
	unsigned long r_width, f_width, curr_width, ncomb;
	int k, m, n, pos, bit_pos;
M
Magnus Damm 已提交
303 304 305

	k = 0;
	while (1) {
306
		config_reg = pfc->info->cfg_regs + k;
M
Magnus Damm 已提交
307 308 309 310 311 312

		r_width = config_reg->reg_width;
		f_width = config_reg->field_width;

		if (!r_width)
			break;
313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330

		pos = 0;
		m = 0;
		for (bit_pos = 0; bit_pos < r_width; bit_pos += curr_width) {
			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;
					*cntp = &config_reg->cnt[m];
					return 0;
				}
M
Magnus Damm 已提交
331
			}
332 333
			pos += ncomb;
			m++;
M
Magnus Damm 已提交
334 335 336 337 338 339 340
		}
		k++;
	}

	return -1;
}

341 342
int sh_pfc_gpio_to_enum(struct sh_pfc *pfc, unsigned gpio, int pos,
			pinmux_enum_t *enum_idp)
M
Magnus Damm 已提交
343
{
344 345
	pinmux_enum_t enum_id = pfc->info->gpios[gpio].enum_id;
	pinmux_enum_t *data = pfc->info->gpio_data;
M
Magnus Damm 已提交
346 347
	int k;

348 349
	if (!sh_pfc_enum_in_range(enum_id, &pfc->info->data)) {
		if (!sh_pfc_enum_in_range(enum_id, &pfc->info->mark)) {
M
Magnus Damm 已提交
350 351 352 353 354 355 356 357 358 359
			pr_err("non data/mark enum_id for gpio %d\n", gpio);
			return -1;
		}
	}

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

360
	for (k = 0; k < pfc->info->gpio_data_size; k++) {
M
Magnus Damm 已提交
361 362 363 364 365 366 367 368 369 370
		if (data[k] == enum_id) {
			*enum_idp = data[k + 1];
			return k + 1;
		}
	}

	pr_err("cannot locate data/mark enum_id for gpio %d\n", gpio);
	return -1;
}

371 372
int sh_pfc_config_gpio(struct sh_pfc *pfc, unsigned gpio, int pinmux_type,
		       int cfg_mode)
M
Magnus Damm 已提交
373 374 375 376
{
	struct pinmux_cfg_reg *cr = NULL;
	pinmux_enum_t enum_id;
	struct pinmux_range *range;
377
	int in_range, pos, field, value;
M
Magnus Damm 已提交
378 379 380 381 382 383 384 385 386
	unsigned long *cntp;

	switch (pinmux_type) {

	case PINMUX_TYPE_FUNCTION:
		range = NULL;
		break;

	case PINMUX_TYPE_OUTPUT:
387
		range = &pfc->info->output;
M
Magnus Damm 已提交
388 389 390
		break;

	case PINMUX_TYPE_INPUT:
391
		range = &pfc->info->input;
M
Magnus Damm 已提交
392 393 394
		break;

	case PINMUX_TYPE_INPUT_PULLUP:
395
		range = &pfc->info->input_pu;
M
Magnus Damm 已提交
396 397 398
		break;

	case PINMUX_TYPE_INPUT_PULLDOWN:
399
		range = &pfc->info->input_pd;
M
Magnus Damm 已提交
400 401 402 403 404 405 406 407
		break;

	default:
		goto out_err;
	}

	pos = 0;
	enum_id = 0;
408 409
	field = 0;
	value = 0;
M
Magnus Damm 已提交
410
	while (1) {
411
		pos = sh_pfc_gpio_to_enum(pfc, gpio, pos, &enum_id);
M
Magnus Damm 已提交
412 413 414 415 416 417
		if (pos <= 0)
			goto out_err;

		if (!enum_id)
			break;

418
		/* first check if this is a function enum */
419
		in_range = sh_pfc_enum_in_range(enum_id, &pfc->info->function);
420 421 422 423 424 425 426 427 428 429 430
		if (!in_range) {
			/* not a function enum */
			if (range) {
				/*
				 * other range exists, so this pin is
				 * a regular GPIO pin that now is being
				 * bound to a specific direction.
				 *
				 * for this case we only allow function enums
				 * and the enums that match the other range.
				 */
431
				in_range = sh_pfc_enum_in_range(enum_id, range);
432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450

				/*
				 * 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;
			} else {
				/*
				 * no other range exists, so this pin
				 * must then be of the function type.
				 *
				 * allow function type pins to select
				 * any combination of function/in/out
				 * in their MARK lists.
				 */
				in_range = 1;
			}
451 452
		}

M
Magnus Damm 已提交
453 454 455
		if (!in_range)
			continue;

456 457
		if (sh_pfc_get_config_reg(pfc, enum_id, &cr,
					  &field, &value, &cntp) != 0)
M
Magnus Damm 已提交
458 459 460 461
			goto out_err;

		switch (cfg_mode) {
		case GPIO_CFG_DRYRUN:
462
			if (!*cntp ||
463
			    (sh_pfc_read_config_reg(pfc, cr, field) != value))
M
Magnus Damm 已提交
464 465 466 467
				continue;
			break;

		case GPIO_CFG_REQ:
468
			sh_pfc_write_config_reg(pfc, cr, field, value);
M
Magnus Damm 已提交
469 470 471 472 473 474 475 476 477 478 479 480 481 482
			*cntp = *cntp + 1;
			break;

		case GPIO_CFG_FREE:
			*cntp = *cntp - 1;
			break;
		}
	}

	return 0;
 out_err:
	return -1;
}

483
static int sh_pfc_probe(struct platform_device *pdev)
M
Magnus Damm 已提交
484
{
485
	struct sh_pfc_soc_info *info;
486
	struct sh_pfc *pfc;
M
Magnus Damm 已提交
487
	int ret;
M
Magnus Damm 已提交
488

489 490 491 492 493
	/*
	 * Ensure that the type encoding fits
	 */
	BUILD_BUG_ON(PINMUX_FLAG_TYPE > ((1 << PINMUX_FLAG_DBIT_SHIFT) - 1));

494 495 496
	info = pdev->id_entry->driver_data
	      ? (void *)pdev->id_entry->driver_data : pdev->dev.platform_data;
	if (info == NULL)
497
		return -ENODEV;
M
Magnus Damm 已提交
498

499 500 501
	pfc = devm_kzalloc(&pdev->dev, sizeof(pfc), GFP_KERNEL);
	if (pfc == NULL)
		return -ENOMEM;
502

503
	pfc->info = info;
504 505
	pfc->dev = &pdev->dev;

506
	ret = sh_pfc_ioremap(pfc, pdev);
507
	if (unlikely(ret < 0))
M
Magnus Damm 已提交
508 509
		return ret;

510
	spin_lock_init(&pfc->lock);
M
Magnus Damm 已提交
511

512
	pinctrl_provide_dummies();
513
	sh_pfc_setup_data_regs(pfc);
M
Magnus Damm 已提交
514

515 516 517
	/*
	 * Initialize pinctrl bindings first
	 */
518
	ret = sh_pfc_register_pinctrl(pfc);
519
	if (unlikely(ret != 0))
520
		return ret;
521

522
#ifdef CONFIG_GPIO_SH_PFC
523 524 525
	/*
	 * Then the GPIO chip
	 */
526
	ret = sh_pfc_register_gpiochip(pfc);
527
	if (unlikely(ret != 0)) {
528 529 530 531 532
		/*
		 * 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.
		 */
533
		pr_notice("failed to init GPIO chip, ignoring...\n");
534
	}
535
#endif
536

537 538
	platform_set_drvdata(pdev, pfc);

539
	pr_info("%s support registered\n", info->name);
540

541
	return 0;
542
}
543

544 545 546 547 548 549 550 551 552 553 554 555 556 557 558
static int sh_pfc_remove(struct platform_device *pdev)
{
	struct sh_pfc *pfc = platform_get_drvdata(pdev);

#ifdef CONFIG_GPIO_SH_PFC
	sh_pfc_unregister_gpiochip(pfc);
#endif
	sh_pfc_unregister_pinctrl(pfc);

	platform_set_drvdata(pdev, NULL);

	return 0;
}

static const struct platform_device_id sh_pfc_id_table[] = {
559 560
#ifdef CONFIG_PINCTRL_PFC_R8A7740
	{ "pfc-r8a7740", (kernel_ulong_t)&r8a7740_pinmux_info },
561 562 563
#endif
#ifdef CONFIG_PINCTRL_PFC_R8A7779
	{ "pfc-r8a7779", (kernel_ulong_t)&r8a7779_pinmux_info },
564
#endif
565 566 567
#ifdef CONFIG_PINCTRL_PFC_SH7203
	{ "pfc-sh7203", (kernel_ulong_t)&sh7203_pinmux_info },
#endif
568 569 570
#ifdef CONFIG_PINCTRL_PFC_SH7264
	{ "pfc-sh7264", (kernel_ulong_t)&sh7264_pinmux_info },
#endif
571 572 573
#ifdef CONFIG_PINCTRL_PFC_SH7269
	{ "pfc-sh7269", (kernel_ulong_t)&sh7269_pinmux_info },
#endif
574 575
#ifdef CONFIG_PINCTRL_PFC_SH7372
	{ "pfc-sh7372", (kernel_ulong_t)&sh7372_pinmux_info },
576 577 578
#endif
#ifdef CONFIG_PINCTRL_PFC_SH73A0
	{ "pfc-sh73a0", (kernel_ulong_t)&sh73a0_pinmux_info },
579 580 581
#endif
#ifdef CONFIG_PINCTRL_PFC_SH7720
	{ "pfc-sh7720", (kernel_ulong_t)&sh7720_pinmux_info },
582 583 584
#endif
#ifdef CONFIG_PINCTRL_PFC_SH7722
	{ "pfc-sh7722", (kernel_ulong_t)&sh7722_pinmux_info },
585 586 587
#endif
#ifdef CONFIG_PINCTRL_PFC_SH7723
	{ "pfc-sh7723", (kernel_ulong_t)&sh7723_pinmux_info },
588 589 590
#endif
#ifdef CONFIG_PINCTRL_PFC_SH7724
	{ "pfc-sh7724", (kernel_ulong_t)&sh7724_pinmux_info },
591 592 593
#endif
#ifdef CONFIG_PINCTRL_PFC_SH7734
	{ "pfc-sh7734", (kernel_ulong_t)&sh7734_pinmux_info },
594 595 596
#endif
#ifdef CONFIG_PINCTRL_PFC_SH7757
	{ "pfc-sh7757", (kernel_ulong_t)&sh7757_pinmux_info },
597 598 599
#endif
#ifdef CONFIG_PINCTRL_PFC_SH7785
	{ "pfc-sh7785", (kernel_ulong_t)&sh7785_pinmux_info },
600 601 602
#endif
#ifdef CONFIG_PINCTRL_PFC_SH7786
	{ "pfc-sh7786", (kernel_ulong_t)&sh7786_pinmux_info },
603
#endif
604 605 606 607 608 609 610 611 612 613 614 615 616 617 618
	{ "sh-pfc", 0 },
	{ },
};
MODULE_DEVICE_TABLE(platform, sh_pfc_id_table);

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,
		.owner	= THIS_MODULE,
	},
};

619 620 621
static int __init sh_pfc_init(void)
{
	return platform_driver_register(&sh_pfc_driver);
622
}
623
postcore_initcall(sh_pfc_init);
624 625 626 627 628 629 630

static void __exit sh_pfc_exit(void)
{
	platform_driver_unregister(&sh_pfc_driver);
}
module_exit(sh_pfc_exit);

631 632 633
MODULE_AUTHOR("Magnus Damm, Paul Mundt, Laurent Pinchart");
MODULE_DESCRIPTION("Pin Control and GPIO driver for SuperH pin function controller");
MODULE_LICENSE("GPL v2");