Commit aabe5263 authored by Bryan O'Donoghue's avatar Bryan O'Donoghue Committed by Greg Kroah-Hartman

usb: pch_udc: usb gadget device support for Intel Quark X1000

commit a68df706 upstream.

This patch is to enable the USB gadget device for Intel Quark X1000
Signed-off-by: default avatarBryan O'Donoghue <bryan.odonoghue@intel.com>
Signed-off-by: default avatarBing Niu <bing.niu@intel.com>
Signed-off-by: default avatarAlvin (Weike) Chen <alvin.chen@intel.com>
Signed-off-by: default avatarFelipe Balbi <balbi@ti.com>
Signed-off-by: default avatarChang Rebecca Swee Fun <rebecca.swee.fun.chang@intel.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent c436c911
...@@ -438,7 +438,7 @@ config USB_GOKU ...@@ -438,7 +438,7 @@ config USB_GOKU
gadget drivers to also be dynamically linked. gadget drivers to also be dynamically linked.
config USB_EG20T config USB_EG20T
tristate "Intel EG20T PCH/LAPIS Semiconductor IOH(ML7213/ML7831) UDC" tristate "Intel QUARK X1000/EG20T PCH/LAPIS Semiconductor IOH(ML7213/ML7831) UDC"
depends on PCI depends on PCI
help help
This is a USB device driver for EG20T PCH. This is a USB device driver for EG20T PCH.
...@@ -459,6 +459,7 @@ config USB_EG20T ...@@ -459,6 +459,7 @@ config USB_EG20T
ML7213/ML7831 is companion chip for Intel Atom E6xx series. ML7213/ML7831 is companion chip for Intel Atom E6xx series.
ML7213/ML7831 is completely compatible for Intel EG20T PCH. ML7213/ML7831 is completely compatible for Intel EG20T PCH.
This driver can be used with Intel's Quark X1000 SOC platform
# #
# LAST -- dummy/emulated controller # LAST -- dummy/emulated controller
# #
......
...@@ -343,6 +343,7 @@ struct pch_vbus_gpio_data { ...@@ -343,6 +343,7 @@ struct pch_vbus_gpio_data {
* @setup_data: Received setup data * @setup_data: Received setup data
* @phys_addr: of device memory * @phys_addr: of device memory
* @base_addr: for mapped device memory * @base_addr: for mapped device memory
* @bar: Indicates which PCI BAR for USB regs
* @irq: IRQ line for the device * @irq: IRQ line for the device
* @cfg_data: current cfg, intf, and alt in use * @cfg_data: current cfg, intf, and alt in use
* @vbus_gpio: GPIO informaton for detecting VBUS * @vbus_gpio: GPIO informaton for detecting VBUS
...@@ -370,14 +371,17 @@ struct pch_udc_dev { ...@@ -370,14 +371,17 @@ struct pch_udc_dev {
struct usb_ctrlrequest setup_data; struct usb_ctrlrequest setup_data;
unsigned long phys_addr; unsigned long phys_addr;
void __iomem *base_addr; void __iomem *base_addr;
unsigned bar;
unsigned irq; unsigned irq;
struct pch_udc_cfg_data cfg_data; struct pch_udc_cfg_data cfg_data;
struct pch_vbus_gpio_data vbus_gpio; struct pch_vbus_gpio_data vbus_gpio;
}; };
#define to_pch_udc(g) (container_of((g), struct pch_udc_dev, gadget)) #define to_pch_udc(g) (container_of((g), struct pch_udc_dev, gadget))
#define PCH_UDC_PCI_BAR_QUARK_X1000 0
#define PCH_UDC_PCI_BAR 1 #define PCH_UDC_PCI_BAR 1
#define PCI_DEVICE_ID_INTEL_EG20T_UDC 0x8808 #define PCI_DEVICE_ID_INTEL_EG20T_UDC 0x8808
#define PCI_DEVICE_ID_INTEL_QUARK_X1000_UDC 0x0939
#define PCI_VENDOR_ID_ROHM 0x10DB #define PCI_VENDOR_ID_ROHM 0x10DB
#define PCI_DEVICE_ID_ML7213_IOH_UDC 0x801D #define PCI_DEVICE_ID_ML7213_IOH_UDC 0x801D
#define PCI_DEVICE_ID_ML7831_IOH_UDC 0x8808 #define PCI_DEVICE_ID_ML7831_IOH_UDC 0x8808
...@@ -3076,7 +3080,7 @@ static void pch_udc_remove(struct pci_dev *pdev) ...@@ -3076,7 +3080,7 @@ static void pch_udc_remove(struct pci_dev *pdev)
iounmap(dev->base_addr); iounmap(dev->base_addr);
if (dev->mem_region) if (dev->mem_region)
release_mem_region(dev->phys_addr, release_mem_region(dev->phys_addr,
pci_resource_len(pdev, PCH_UDC_PCI_BAR)); pci_resource_len(pdev, dev->bar));
if (dev->active) if (dev->active)
pci_disable_device(pdev); pci_disable_device(pdev);
kfree(dev); kfree(dev);
...@@ -3144,9 +3148,15 @@ static int pch_udc_probe(struct pci_dev *pdev, ...@@ -3144,9 +3148,15 @@ static int pch_udc_probe(struct pci_dev *pdev,
dev->active = 1; dev->active = 1;
pci_set_drvdata(pdev, dev); pci_set_drvdata(pdev, dev);
/* Determine BAR based on PCI ID */
if (id->device == PCI_DEVICE_ID_INTEL_QUARK_X1000_UDC)
dev->bar = PCH_UDC_PCI_BAR_QUARK_X1000;
else
dev->bar = PCH_UDC_PCI_BAR;
/* PCI resource allocation */ /* PCI resource allocation */
resource = pci_resource_start(pdev, 1); resource = pci_resource_start(pdev, dev->bar);
len = pci_resource_len(pdev, 1); len = pci_resource_len(pdev, dev->bar);
if (!request_mem_region(resource, len, KBUILD_MODNAME)) { if (!request_mem_region(resource, len, KBUILD_MODNAME)) {
dev_err(&pdev->dev, "%s: pci device used already\n", __func__); dev_err(&pdev->dev, "%s: pci device used already\n", __func__);
...@@ -3211,6 +3221,12 @@ static int pch_udc_probe(struct pci_dev *pdev, ...@@ -3211,6 +3221,12 @@ static int pch_udc_probe(struct pci_dev *pdev,
} }
static const struct pci_device_id pch_udc_pcidev_id[] = { static const struct pci_device_id pch_udc_pcidev_id[] = {
{
PCI_DEVICE(PCI_VENDOR_ID_INTEL,
PCI_DEVICE_ID_INTEL_QUARK_X1000_UDC),
.class = (PCI_CLASS_SERIAL_USB << 8) | 0xfe,
.class_mask = 0xffffffff,
},
{ {
PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_EG20T_UDC), PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_EG20T_UDC),
.class = (PCI_CLASS_SERIAL_USB << 8) | 0xfe, .class = (PCI_CLASS_SERIAL_USB << 8) | 0xfe,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment