Re: [PATCH 3/3] pch_udc: Specifies GPI port number at configuration.

From: Tomoya MORINAGA
Date: Mon Feb 20 2012 - 19:27:59 EST


2012年2月3日19:50 Sergei Shtylyov <sshtylyov@xxxxxxxxxx>:
> Isn't it better to pass this with driver's platform data.

To define GPIO port number, we must I'm supporting IntelCrown Bay
platform (Intel AtomE600 + PCH EG20T).
I made an initialization code(attached) for the Crown Bay platform.
Should I post this module to upstream? I need your advice.
If I should do, could you tell me which category we should put
it?

---
ROHM Co., Ltd.
tomoya
/*
* Copyright (C) 2012 LAPIS Semiconductor Co., Ltd.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; version 2 of the License.
*/

#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/init.h>
#include <linux/platform_device.h>
#include <linux/usb/gpio_vbus.h>

#define PCH_GPIO_BASE 244

/* GPIO for USB VBUS detection */
#define CROWNBAY_GPIO_VBUS_PORT 5

static struct gpio_vbus_mach_info crownbay_gpio_vbus_data = {
.gpio_vbus = (PCH_GPIO_BASE + CROWNBAY_GPIO_VBUS_PORT),
};

static struct platform_device crownbay_gpio_vbus_device = {
.name = "pch-gpio-vbus",
.id = -1,
.dev = {
.platform_data = &crownbay_gpio_vbus_data,
},
};

static int __init crownbay_platform_init(void)
{
int retval;
retval = platform_device_register(&crownbay_gpio_vbus_device);
printk(KERN_INFO "Registered gpio-vbus device for Crown Bay\n");
return retval;
}
module_init(crownbay_platform_init);

static void __exit crownbay_platform_exit(void)
{
platform_device_unregister(&crownbay_gpio_vbus_device);
}
module_exit(crownbay_platform_exit);

MODULE_DESCRIPTION("Intel Crown Bay Platform Driver");
MODULE_LICENSE("GPL");