Commit 8e22978c authored by Alexander Shishkin's avatar Alexander Shishkin Committed by Greg Kroah-Hartman

usb: chipidea: drop "13xxx" infix

"ci13xxx" is bad for at least the following reasons:
  * people often mistype it
  * it doesn't add any informational value to the names it's used in
  * it needlessly attracts mail filters

This patch replaces it with "ci_hdrc", "ci_udc" or "ci_hw", depending
on the situation. Modules with ci13xxx prefix are also renamed accordingly
and aliases are added for compatibility. Otherwise, no functional changes.
Signed-off-by: default avatarAlexander Shishkin <alexander.shishkin@linux.intel.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 38dcdb3a
...@@ -9,13 +9,13 @@ ci_hdrc-$(CONFIG_USB_CHIPIDEA_DEBUG) += debug.o ...@@ -9,13 +9,13 @@ ci_hdrc-$(CONFIG_USB_CHIPIDEA_DEBUG) += debug.o
# Glue/Bridge layers go here # Glue/Bridge layers go here
obj-$(CONFIG_USB_CHIPIDEA) += ci13xxx_msm.o obj-$(CONFIG_USB_CHIPIDEA) += ci_hdrc_msm.o
# PCI doesn't provide stubs, need to check # PCI doesn't provide stubs, need to check
ifneq ($(CONFIG_PCI),) ifneq ($(CONFIG_PCI),)
obj-$(CONFIG_USB_CHIPIDEA) += ci13xxx_pci.o obj-$(CONFIG_USB_CHIPIDEA) += ci_hdrc_pci.o
endif endif
ifneq ($(CONFIG_OF_DEVICE),) ifneq ($(CONFIG_OF_DEVICE),)
obj-$(CONFIG_USB_CHIPIDEA) += ci13xxx_imx.o usbmisc_imx.o obj-$(CONFIG_USB_CHIPIDEA) += ci_hdrc_imx.o usbmisc_imx.o
endif endif
...@@ -22,14 +22,14 @@ ...@@ -22,14 +22,14 @@
* DEFINE * DEFINE
*****************************************************************************/ *****************************************************************************/
#define TD_PAGE_COUNT 5 #define TD_PAGE_COUNT 5
#define CI13XXX_PAGE_SIZE 4096ul /* page size for TD's */ #define CI_HDRC_PAGE_SIZE 4096ul /* page size for TD's */
#define ENDPT_MAX 32 #define ENDPT_MAX 32
/****************************************************************************** /******************************************************************************
* STRUCTURES * STRUCTURES
*****************************************************************************/ *****************************************************************************/
/** /**
* struct ci13xxx_ep - endpoint representation * struct ci_hw_ep - endpoint representation
* @ep: endpoint structure for gadget drivers * @ep: endpoint structure for gadget drivers
* @dir: endpoint direction (TX/RX) * @dir: endpoint direction (TX/RX)
* @num: endpoint number * @num: endpoint number
...@@ -41,7 +41,7 @@ ...@@ -41,7 +41,7 @@
* @lock: pointer to controller's spinlock * @lock: pointer to controller's spinlock
* @td_pool: pointer to controller's TD pool * @td_pool: pointer to controller's TD pool
*/ */
struct ci13xxx_ep { struct ci_hw_ep {
struct usb_ep ep; struct usb_ep ep;
u8 dir; u8 dir;
u8 num; u8 num;
...@@ -49,13 +49,13 @@ struct ci13xxx_ep { ...@@ -49,13 +49,13 @@ struct ci13xxx_ep {
char name[16]; char name[16];
struct { struct {
struct list_head queue; struct list_head queue;
struct ci13xxx_qh *ptr; struct ci_hw_qh *ptr;
dma_addr_t dma; dma_addr_t dma;
} qh; } qh;
int wedge; int wedge;
/* global resources */ /* global resources */
struct ci13xxx *ci; struct ci_hdrc *ci;
spinlock_t *lock; spinlock_t *lock;
struct dma_pool *td_pool; struct dma_pool *td_pool;
struct td_node *pending_td; struct td_node *pending_td;
...@@ -75,9 +75,9 @@ enum ci_role { ...@@ -75,9 +75,9 @@ enum ci_role {
* name: role name string (host/gadget) * name: role name string (host/gadget)
*/ */
struct ci_role_driver { struct ci_role_driver {
int (*start)(struct ci13xxx *); int (*start)(struct ci_hdrc *);
void (*stop)(struct ci13xxx *); void (*stop)(struct ci_hdrc *);
irqreturn_t (*irq)(struct ci13xxx *); irqreturn_t (*irq)(struct ci_hdrc *);
const char *name; const char *name;
}; };
...@@ -102,7 +102,7 @@ struct hw_bank { ...@@ -102,7 +102,7 @@ struct hw_bank {
}; };
/** /**
* struct ci13xxx - chipidea device representation * struct ci_hdrc - chipidea device representation
* @dev: pointer to parent device * @dev: pointer to parent device
* @lock: access synchronization * @lock: access synchronization
* @hw_bank: hardware register mapping * @hw_bank: hardware register mapping
...@@ -117,7 +117,7 @@ struct hw_bank { ...@@ -117,7 +117,7 @@ struct hw_bank {
* @gadget: device side representation for peripheral controller * @gadget: device side representation for peripheral controller
* @driver: gadget driver * @driver: gadget driver
* @hw_ep_max: total number of endpoints supported by hardware * @hw_ep_max: total number of endpoints supported by hardware
* @ci13xxx_ep: array of endpoints * @ci_hw_ep: array of endpoints
* @ep0_dir: ep0 direction * @ep0_dir: ep0 direction
* @ep0out: pointer to ep0 OUT endpoint * @ep0out: pointer to ep0 OUT endpoint
* @ep0in: pointer to ep0 IN endpoint * @ep0in: pointer to ep0 IN endpoint
...@@ -133,7 +133,7 @@ struct hw_bank { ...@@ -133,7 +133,7 @@ struct hw_bank {
* @hcd: pointer to usb_hcd for ehci host driver * @hcd: pointer to usb_hcd for ehci host driver
* @debugfs: root dentry for this controller in debugfs * @debugfs: root dentry for this controller in debugfs
*/ */
struct ci13xxx { struct ci_hdrc {
struct device *dev; struct device *dev;
spinlock_t lock; spinlock_t lock;
struct hw_bank hw_bank; struct hw_bank hw_bank;
...@@ -150,9 +150,9 @@ struct ci13xxx { ...@@ -150,9 +150,9 @@ struct ci13xxx {
struct usb_gadget gadget; struct usb_gadget gadget;
struct usb_gadget_driver *driver; struct usb_gadget_driver *driver;
unsigned hw_ep_max; unsigned hw_ep_max;
struct ci13xxx_ep ci13xxx_ep[ENDPT_MAX]; struct ci_hw_ep ci_hw_ep[ENDPT_MAX];
u32 ep0_dir; u32 ep0_dir;
struct ci13xxx_ep *ep0out, *ep0in; struct ci_hw_ep *ep0out, *ep0in;
struct usb_request *status; struct usb_request *status;
bool setaddr; bool setaddr;
...@@ -161,7 +161,7 @@ struct ci13xxx { ...@@ -161,7 +161,7 @@ struct ci13xxx {
u8 suspended; u8 suspended;
u8 test_mode; u8 test_mode;
struct ci13xxx_platform_data *platdata; struct ci_hdrc_platform_data *platdata;
int vbus_active; int vbus_active;
/* FIXME: some day, we'll not use global phy */ /* FIXME: some day, we'll not use global phy */
bool global_phy; bool global_phy;
...@@ -170,13 +170,13 @@ struct ci13xxx { ...@@ -170,13 +170,13 @@ struct ci13xxx {
struct dentry *debugfs; struct dentry *debugfs;
}; };
static inline struct ci_role_driver *ci_role(struct ci13xxx *ci) static inline struct ci_role_driver *ci_role(struct ci_hdrc *ci)
{ {
BUG_ON(ci->role >= CI_ROLE_END || !ci->roles[ci->role]); BUG_ON(ci->role >= CI_ROLE_END || !ci->roles[ci->role]);
return ci->roles[ci->role]; return ci->roles[ci->role];
} }
static inline int ci_role_start(struct ci13xxx *ci, enum ci_role role) static inline int ci_role_start(struct ci_hdrc *ci, enum ci_role role)
{ {
int ret; int ret;
...@@ -192,7 +192,7 @@ static inline int ci_role_start(struct ci13xxx *ci, enum ci_role role) ...@@ -192,7 +192,7 @@ static inline int ci_role_start(struct ci13xxx *ci, enum ci_role role)
return ret; return ret;
} }
static inline void ci_role_stop(struct ci13xxx *ci) static inline void ci_role_stop(struct ci_hdrc *ci)
{ {
enum ci_role role = ci->role; enum ci_role role = ci->role;
...@@ -211,7 +211,7 @@ static inline void ci_role_stop(struct ci13xxx *ci) ...@@ -211,7 +211,7 @@ static inline void ci_role_stop(struct ci13xxx *ci)
#define REG_BITS (32) #define REG_BITS (32)
/* register indices */ /* register indices */
enum ci13xxx_regs { enum ci_hw_regs {
CAP_CAPLENGTH, CAP_CAPLENGTH,
CAP_HCCPARAMS, CAP_HCCPARAMS,
CAP_DCCPARAMS, CAP_DCCPARAMS,
...@@ -243,7 +243,7 @@ enum ci13xxx_regs { ...@@ -243,7 +243,7 @@ enum ci13xxx_regs {
* *
* This function returns register contents * This function returns register contents
*/ */
static inline u32 hw_read(struct ci13xxx *ci, enum ci13xxx_regs reg, u32 mask) static inline u32 hw_read(struct ci_hdrc *ci, enum ci_hw_regs reg, u32 mask)
{ {
return ioread32(ci->hw_bank.regmap[reg]) & mask; return ioread32(ci->hw_bank.regmap[reg]) & mask;
} }
...@@ -254,7 +254,7 @@ static inline u32 hw_read(struct ci13xxx *ci, enum ci13xxx_regs reg, u32 mask) ...@@ -254,7 +254,7 @@ static inline u32 hw_read(struct ci13xxx *ci, enum ci13xxx_regs reg, u32 mask)
* @mask: bitfield mask * @mask: bitfield mask
* @data: new value * @data: new value
*/ */
static inline void hw_write(struct ci13xxx *ci, enum ci13xxx_regs reg, static inline void hw_write(struct ci_hdrc *ci, enum ci_hw_regs reg,
u32 mask, u32 data) u32 mask, u32 data)
{ {
if (~mask) if (~mask)
...@@ -271,7 +271,7 @@ static inline void hw_write(struct ci13xxx *ci, enum ci13xxx_regs reg, ...@@ -271,7 +271,7 @@ static inline void hw_write(struct ci13xxx *ci, enum ci13xxx_regs reg,
* *
* This function returns register contents * This function returns register contents
*/ */
static inline u32 hw_test_and_clear(struct ci13xxx *ci, enum ci13xxx_regs reg, static inline u32 hw_test_and_clear(struct ci_hdrc *ci, enum ci_hw_regs reg,
u32 mask) u32 mask)
{ {
u32 val = ioread32(ci->hw_bank.regmap[reg]) & mask; u32 val = ioread32(ci->hw_bank.regmap[reg]) & mask;
...@@ -288,7 +288,7 @@ static inline u32 hw_test_and_clear(struct ci13xxx *ci, enum ci13xxx_regs reg, ...@@ -288,7 +288,7 @@ static inline u32 hw_test_and_clear(struct ci13xxx *ci, enum ci13xxx_regs reg,
* *
* This function returns register contents * This function returns register contents
*/ */
static inline u32 hw_test_and_write(struct ci13xxx *ci, enum ci13xxx_regs reg, static inline u32 hw_test_and_write(struct ci_hdrc *ci, enum ci_hw_regs reg,
u32 mask, u32 data) u32 mask, u32 data)
{ {
u32 val = hw_read(ci, reg, ~0); u32 val = hw_read(ci, reg, ~0);
...@@ -297,10 +297,10 @@ static inline u32 hw_test_and_write(struct ci13xxx *ci, enum ci13xxx_regs reg, ...@@ -297,10 +297,10 @@ static inline u32 hw_test_and_write(struct ci13xxx *ci, enum ci13xxx_regs reg,
return (val & mask) >> __ffs(mask); return (val & mask) >> __ffs(mask);
} }
int hw_device_reset(struct ci13xxx *ci, u32 mode); int hw_device_reset(struct ci_hdrc *ci, u32 mode);
int hw_port_test_set(struct ci13xxx *ci, u8 mode); int hw_port_test_set(struct ci_hdrc *ci, u8 mode);
u8 hw_port_test_get(struct ci13xxx *ci); u8 hw_port_test_get(struct ci_hdrc *ci);
#endif /* __DRIVERS_USB_CHIPIDEA_CI_H */ #endif /* __DRIVERS_USB_CHIPIDEA_CI_H */
...@@ -22,12 +22,12 @@ ...@@ -22,12 +22,12 @@
#include <linux/regulator/consumer.h> #include <linux/regulator/consumer.h>
#include "ci.h" #include "ci.h"
#include "ci13xxx_imx.h" #include "ci_hdrc_imx.h"
#define pdev_to_phy(pdev) \ #define pdev_to_phy(pdev) \
((struct usb_phy *)platform_get_drvdata(pdev)) ((struct usb_phy *)platform_get_drvdata(pdev))
struct ci13xxx_imx_data { struct ci_hdrc_imx_data {
struct usb_phy *phy; struct usb_phy *phy;
struct platform_device *ci_pdev; struct platform_device *ci_pdev;
struct clk *clk; struct clk *clk;
...@@ -86,15 +86,15 @@ EXPORT_SYMBOL_GPL(usbmisc_get_init_data); ...@@ -86,15 +86,15 @@ EXPORT_SYMBOL_GPL(usbmisc_get_init_data);
/* End of common functions shared by usbmisc drivers*/ /* End of common functions shared by usbmisc drivers*/
static int ci13xxx_imx_probe(struct platform_device *pdev) static int ci_hdrc_imx_probe(struct platform_device *pdev)
{ {
struct ci13xxx_imx_data *data; struct ci_hdrc_imx_data *data;
struct ci13xxx_platform_data pdata = { struct ci_hdrc_platform_data pdata = {
.name = "ci13xxx_imx", .name = "ci_hdrc_imx",
.capoffset = DEF_CAPOFFSET, .capoffset = DEF_CAPOFFSET,
.flags = CI13XXX_REQUIRE_TRANSCEIVER | .flags = CI_HDRC_REQUIRE_TRANSCEIVER |
CI13XXX_PULLUP_ON_VBUS | CI_HDRC_PULLUP_ON_VBUS |
CI13XXX_DISABLE_STREAMING, CI_HDRC_DISABLE_STREAMING,
}; };
struct resource *res; struct resource *res;
int ret; int ret;
...@@ -106,7 +106,7 @@ static int ci13xxx_imx_probe(struct platform_device *pdev) ...@@ -106,7 +106,7 @@ static int ci13xxx_imx_probe(struct platform_device *pdev)
data = devm_kzalloc(&pdev->dev, sizeof(*data), GFP_KERNEL); data = devm_kzalloc(&pdev->dev, sizeof(*data), GFP_KERNEL);
if (!data) { if (!data) {
dev_err(&pdev->dev, "Failed to allocate CI13xxx-IMX data!\n"); dev_err(&pdev->dev, "Failed to allocate ci_hdrc-imx data!\n");
return -ENOMEM; return -ENOMEM;
} }
...@@ -172,7 +172,7 @@ static int ci13xxx_imx_probe(struct platform_device *pdev) ...@@ -172,7 +172,7 @@ static int ci13xxx_imx_probe(struct platform_device *pdev)
} }
} }
data->ci_pdev = ci13xxx_add_device(&pdev->dev, data->ci_pdev = ci_hdrc_add_device(&pdev->dev,
pdev->resource, pdev->num_resources, pdev->resource, pdev->num_resources,
&pdata); &pdata);
if (IS_ERR(data->ci_pdev)) { if (IS_ERR(data->ci_pdev)) {
...@@ -200,7 +200,7 @@ static int ci13xxx_imx_probe(struct platform_device *pdev) ...@@ -200,7 +200,7 @@ static int ci13xxx_imx_probe(struct platform_device *pdev)
return 0; return 0;
disable_device: disable_device:
ci13xxx_remove_device(data->ci_pdev); ci_hdrc_remove_device(data->ci_pdev);
err: err:
if (data->reg_vbus) if (data->reg_vbus)
regulator_disable(data->reg_vbus); regulator_disable(data->reg_vbus);
...@@ -209,12 +209,12 @@ static int ci13xxx_imx_probe(struct platform_device *pdev) ...@@ -209,12 +209,12 @@ static int ci13xxx_imx_probe(struct platform_device *pdev)
return ret; return ret;
} }
static int ci13xxx_imx_remove(struct platform_device *pdev) static int ci_hdrc_imx_remove(struct platform_device *pdev)
{ {
struct ci13xxx_imx_data *data = platform_get_drvdata(pdev); struct ci_hdrc_imx_data *data = platform_get_drvdata(pdev);
pm_runtime_disable(&pdev->dev); pm_runtime_disable(&pdev->dev);
ci13xxx_remove_device(data->ci_pdev); ci_hdrc_remove_device(data->ci_pdev);
if (data->reg_vbus) if (data->reg_vbus)
regulator_disable(data->reg_vbus); regulator_disable(data->reg_vbus);
...@@ -229,26 +229,26 @@ static int ci13xxx_imx_remove(struct platform_device *pdev) ...@@ -229,26 +229,26 @@ static int ci13xxx_imx_remove(struct platform_device *pdev)
return 0; return 0;
} }
static const struct of_device_id ci13xxx_imx_dt_ids[] = { static const struct of_device_id ci_hdrc_imx_dt_ids[] = {
{ .compatible = "fsl,imx27-usb", }, { .compatible = "fsl,imx27-usb", },
{ /* sentinel */ } { /* sentinel */ }
}; };
MODULE_DEVICE_TABLE(of, ci13xxx_imx_dt_ids); MODULE_DEVICE_TABLE(of, ci_hdrc_imx_dt_ids);
static struct platform_driver ci13xxx_imx_driver = { static struct platform_driver ci_hdrc_imx_driver = {
.probe = ci13xxx_imx_probe, .probe = ci_hdrc_imx_probe,
.remove = ci13xxx_imx_remove, .remove = ci_hdrc_imx_remove,
.driver = { .driver = {
.name = "imx_usb", .name = "imx_usb",
.owner = THIS_MODULE, .owner = THIS_MODULE,
.of_match_table = ci13xxx_imx_dt_ids, .of_match_table = ci_hdrc_imx_dt_ids,
}, },
}; };
module_platform_driver(ci13xxx_imx_driver); module_platform_driver(ci_hdrc_imx_driver);
MODULE_ALIAS("platform:imx-usb"); MODULE_ALIAS("platform:imx-usb");
MODULE_LICENSE("GPL v2"); MODULE_LICENSE("GPL v2");
MODULE_DESCRIPTION("CI13xxx i.MX USB binding"); MODULE_DESCRIPTION("CI HDRC i.MX USB binding");
MODULE_AUTHOR("Marek Vasut <marex@denx.de>"); MODULE_AUTHOR("Marek Vasut <marex@denx.de>");
MODULE_AUTHOR("Richard Zhao <richard.zhao@freescale.com>"); MODULE_AUTHOR("Richard Zhao <richard.zhao@freescale.com>");
...@@ -17,19 +17,19 @@ ...@@ -17,19 +17,19 @@
#define MSM_USB_BASE (ci->hw_bank.abs) #define MSM_USB_BASE (ci->hw_bank.abs)
static void ci13xxx_msm_notify_event(struct ci13xxx *ci, unsigned event) static void ci_hdrc_msm_notify_event(struct ci_hdrc *ci, unsigned event)
{ {
struct device *dev = ci->gadget.dev.parent; struct device *dev = ci->gadget.dev.parent;
int val; int val;
switch (event) { switch (event) {
case CI13XXX_CONTROLLER_RESET_EVENT: case CI_HDRC_CONTROLLER_RESET_EVENT:
dev_dbg(dev, "CI13XXX_CONTROLLER_RESET_EVENT received\n"); dev_dbg(dev, "CI_HDRC_CONTROLLER_RESET_EVENT received\n");
writel(0, USB_AHBBURST); writel(0, USB_AHBBURST);
writel(0, USB_AHBMODE); writel(0, USB_AHBMODE);
break; break;
case CI13XXX_CONTROLLER_STOPPED_EVENT: case CI_HDRC_CONTROLLER_STOPPED_EVENT:
dev_dbg(dev, "CI13XXX_CONTROLLER_STOPPED_EVENT received\n"); dev_dbg(dev, "CI_HDRC_CONTROLLER_STOPPED_EVENT received\n");
/* /*
* Put the transceiver in non-driving mode. Otherwise host * Put the transceiver in non-driving mode. Otherwise host
* may not detect soft-disconnection. * may not detect soft-disconnection.
...@@ -40,32 +40,32 @@ static void ci13xxx_msm_notify_event(struct ci13xxx *ci, unsigned event) ...@@ -40,32 +40,32 @@ static void ci13xxx_msm_notify_event(struct ci13xxx *ci, unsigned event)
usb_phy_io_write(ci->transceiver, val, ULPI_FUNC_CTRL); usb_phy_io_write(ci->transceiver, val, ULPI_FUNC_CTRL);
break; break;
default: default:
dev_dbg(dev, "unknown ci13xxx event\n"); dev_dbg(dev, "unknown ci_hdrc event\n");
break; break;
} }
} }
static struct ci13xxx_platform_data ci13xxx_msm_platdata = { static struct ci_hdrc_platform_data ci_hdrc_msm_platdata = {
.name = "ci13xxx_msm", .name = "ci_hdrc_msm",
.flags = CI13XXX_REGS_SHARED | .flags = CI_HDRC_REGS_SHARED |
CI13XXX_REQUIRE_TRANSCEIVER | CI_HDRC_REQUIRE_TRANSCEIVER |
CI13XXX_PULLUP_ON_VBUS | CI_HDRC_PULLUP_ON_VBUS |
CI13XXX_DISABLE_STREAMING, CI_HDRC_DISABLE_STREAMING,
.notify_event = ci13xxx_msm_notify_event, .notify_event = ci_hdrc_msm_notify_event,
}; };
static int ci13xxx_msm_probe(struct platform_device *pdev) static int ci_hdrc_msm_probe(struct platform_device *pdev)
{ {
struct platform_device *plat_ci; struct platform_device *plat_ci;
dev_dbg(&pdev->dev, "ci13xxx_msm_probe\n"); dev_dbg(&pdev->dev, "ci_hdrc_msm_probe\n");
plat_ci = ci13xxx_add_device(&pdev->dev, plat_ci = ci_hdrc_add_device(&pdev->dev,
pdev->resource, pdev->num_resources, pdev->resource, pdev->num_resources,
&ci13xxx_msm_platdata); &ci_hdrc_msm_platdata);
if (IS_ERR(plat_ci)) { if (IS_ERR(plat_ci)) {
dev_err(&pdev->dev, "ci13xxx_add_device failed!\n"); dev_err(&pdev->dev, "ci_hdrc_add_device failed!\n");
return PTR_ERR(plat_ci); return PTR_ERR(plat_ci);
} }
...@@ -77,23 +77,24 @@ static int ci13xxx_msm_probe(struct platform_device *pdev) ...@@ -77,23 +77,24 @@ static int ci13xxx_msm_probe(struct platform_device *pdev)
return 0; return 0;
} }
static int ci13xxx_msm_remove(struct platform_device *pdev) static int ci_hdrc_msm_remove(struct platform_device *pdev)
{ {
struct platform_device *plat_ci = platform_get_drvdata(pdev); struct platform_device *plat_ci = platform_get_drvdata(pdev);
pm_runtime_disable(&pdev->dev); pm_runtime_disable(&pdev->dev);
ci13xxx_remove_device(plat_ci); ci_hdrc_remove_device(plat_ci);
return 0; return 0;
} }
static struct platform_driver ci13xxx_msm_driver = { static struct platform_driver ci_hdrc_msm_driver = {
.probe = ci13xxx_msm_probe, .probe = ci_hdrc_msm_probe,
.remove = ci13xxx_msm_remove, .remove = ci_hdrc_msm_remove,
.driver = { .name = "msm_hsusb", }, .driver = { .name = "msm_hsusb", },
}; };
module_platform_driver(ci13xxx_msm_driver); module_platform_driver(ci_hdrc_msm_driver);
MODULE_ALIAS("platform:msm_hsusb"); MODULE_ALIAS("platform:msm_hsusb");
MODULE_ALIAS("platform:ci13xxx_msm");
MODULE_LICENSE("GPL v2"); MODULE_LICENSE("GPL v2");
/* /*
* ci13xxx_pci.c - MIPS USB IP core family device controller * ci_hdrc_pci.c - MIPS USB IP core family device controller
* *
* Copyright (C) 2008 Chipidea - MIPS Technologies, Inc. All rights reserved. * Copyright (C) 2008 Chipidea - MIPS Technologies, Inc. All rights reserved.
* *
...@@ -18,29 +18,29 @@ ...@@ -18,29 +18,29 @@
#include <linux/usb/chipidea.h> #include <linux/usb/chipidea.h>
/* driver name */ /* driver name */
#define UDC_DRIVER_NAME "ci13xxx_pci" #define UDC_DRIVER_NAME "ci_hdrc_pci"
/****************************************************************************** /******************************************************************************
* PCI block * PCI block
*****************************************************************************/ *****************************************************************************/
static struct ci13xxx_platform_data pci_platdata = { static struct ci_hdrc_platform_data pci_platdata = {
.name = UDC_DRIVER_NAME, .name = UDC_DRIVER_NAME,
.capoffset = DEF_CAPOFFSET, .capoffset = DEF_CAPOFFSET,
}; };
static struct ci13xxx_platform_data langwell_pci_platdata = { static struct ci_hdrc_platform_data langwell_pci_platdata = {
.name = UDC_DRIVER_NAME, .name = UDC_DRIVER_NAME,
.capoffset = 0, .capoffset = 0,
}; };
static struct ci13xxx_platform_data penwell_pci_platdata = { static struct ci_hdrc_platform_data penwell_pci_platdata = {
.name = UDC_DRIVER_NAME, .name = UDC_DRIVER_NAME,
.capoffset = 0, .capoffset = 0,
.power_budget = 200, .power_budget = 200,
}; };
/** /**
* ci13xxx_pci_probe: PCI probe * ci_hdrc_pci_probe: PCI probe
* @pdev: USB device controller being probed * @pdev: USB device controller being probed
* @id: PCI hotplug ID connecting controller to UDC framework * @id: PCI hotplug ID connecting controller to UDC framework
* *
...@@ -48,10 +48,10 @@ static struct ci13xxx_platform_data penwell_pci_platdata = { ...@@ -48,10 +48,10 @@ static struct ci13xxx_platform_data penwell_pci_platdata = {
* Allocates basic PCI resources for this USB device controller, and then * Allocates basic PCI resources for this USB device controller, and then
* invokes the udc_probe() method to start the UDC associated with it * invokes the udc_probe() method to start the UDC associated with it
*/ */
static int ci13xxx_pci_probe(struct pci_dev *pdev, static int ci_hdrc_pci_probe(struct pci_dev *pdev,
const struct pci_device_id *id) const struct pci_device_id *id)
{ {
struct ci13xxx_platform_data *platdata = (void *)id->driver_data; struct ci_hdrc_platform_data *platdata = (void *)id->driver_data;
struct platform_device *plat_ci; struct platform_device *plat_ci;
struct resource res[3]; struct resource res[3];
int retval = 0, nres = 2; int retval = 0, nres = 2;
...@@ -80,9 +80,9 @@ static int ci13xxx_pci_probe(struct pci_dev *pdev, ...@@ -80,9 +80,9 @@ static int ci13xxx_pci_probe(struct pci_dev *pdev,
res[1].start = pdev->irq; res[1].start = pdev->irq;
res[1].flags = IORESOURCE_IRQ; res[1].flags = IORESOURCE_IRQ;
plat_ci = ci13xxx_add_device(&pdev->dev, res, nres, platdata); plat_ci = ci_hdrc_add_device(&pdev->dev, res, nres, platdata);
if (IS_ERR(plat_ci)) { if (IS_ERR(plat_ci)) {
dev_err(&pdev->dev, "ci13xxx_add_device failed!\n"); dev_err(&pdev->dev, "ci_hdrc_add_device failed!\n");
return PTR_ERR(plat_ci); return PTR_ERR(plat_ci);
} }
...@@ -92,18 +92,18 @@ static int ci13xxx_pci_probe(struct pci_dev *pdev, ...@@ -92,18 +92,18 @@ static int ci13xxx_pci_probe(struct pci_dev *pdev,
} }
/** /**
* ci13xxx_pci_remove: PCI remove * ci_hdrc_pci_remove: PCI remove
* @pdev: USB Device Controller being removed * @pdev: USB Device Controller being removed
* *
* Reverses the effect of ci13xxx_pci_probe(), * Reverses the effect of ci_hdrc_pci_probe(),
* first invoking the udc_remove() and then releases * first invoking the udc_remove() and then releases
* all PCI resources allocated for this USB device controller * all PCI resources allocated for this USB device controller
*/ */
static void ci13xxx_pci_remove(struct pci_dev *pdev) static void ci_hdrc_pci_remove(struct pci_dev *pdev)
{ {
struct platform_device *plat_ci = pci_get_drvdata(pdev); struct platform_device *plat_ci = pci_get_drvdata(pdev);
ci13xxx_remove_device(plat_ci); ci_hdrc_remove_device(plat_ci);
} }
/** /**
...@@ -112,7 +112,7 @@ static void ci13xxx_pci_remove(struct pci_dev *pdev) ...@@ -112,7 +112,7 @@ static void ci13xxx_pci_remove(struct pci_dev *pdev)
* *
* Check "pci.h" for details * Check "pci.h" for details
*/ */
static DEFINE_PCI_DEVICE_TABLE(ci13xxx_pci_id_table) = { static DEFINE_PCI_DEVICE_TABLE(ci_hdrc_pci_id_table) = {
{ {
PCI_DEVICE(0x153F, 0x1004), PCI_DEVICE(0x153F, 0x1004),
.driver_data = (kernel_ulong_t)&pci_platdata, .driver_data = (kernel_ulong_t)&pci_platdata,
...@@ -131,18 +131,19 @@ static DEFINE_PCI_DEVICE_TABLE(ci13xxx_pci_id_table) = { ...@@ -131,18 +131,19 @@ static DEFINE_PCI_DEVICE_TABLE(ci13xxx_pci_id_table) = {
}, },
{ 0, 0, 0, 0, 0, 0, 0 /* end: all zeroes */ } { 0, 0, 0, 0, 0, 0, 0 /* end: all zeroes */ }
}; };
MODULE_DEVICE_TABLE(pci, ci13xxx_pci_id_table); MODULE_DEVICE_TABLE(pci, ci_hdrc_pci_id_table);
static struct pci_driver ci13xxx_pci_driver = { static struct pci_driver ci_hdrc_pci_driver = {
.name = UDC_DRIVER_NAME, .name = UDC_DRIVER_NAME,
.id_table = ci13xxx_pci_id_table, .id_table = ci_hdrc_pci_id_table,
.probe = ci13xxx_pci_probe, .probe = ci_hdrc_pci_probe,
.remove = ci13xxx_pci_remove, .remove = ci_hdrc_pci_remove,
}; };
module_pci_driver(ci13xxx_pci_driver); module_pci_driver(ci_hdrc_pci_driver);
MODULE_AUTHOR("MIPS - David Lopo <dlopo@chipidea.mips.com>"); MODULE_AUTHOR("MIPS - David Lopo <dlopo@chipidea.mips.com>");
MODULE_DESCRIPTION("MIPS CI13XXX USB Peripheral Controller"); MODULE_DESCRIPTION("MIPS CI13XXX USB Peripheral Controller");
MODULE_LICENSE("GPL"); MODULE_LICENSE("GPL");
MODULE_VERSION("June 2008"); MODULE_VERSION("June 2008");
MODULE_ALIAS("platform:ci13xxx_pci");
...@@ -117,7 +117,7 @@ static uintptr_t ci_regs_lpm[] = { ...@@ -117,7 +117,7 @@ static uintptr_t ci_regs_lpm[] = {
[OP_ENDPTCTRL] = 0x0ECUL, [OP_ENDPTCTRL] = 0x0ECUL,
}; };
static int hw_alloc_regmap(struct ci13xxx *ci, bool is_lpm) static int hw_alloc_regmap(struct ci_hdrc *ci, bool is_lpm)
{ {
int i; int i;
...@@ -149,7 +149,7 @@ static int hw_alloc_regmap(struct ci13xxx *ci, bool is_lpm) ...@@ -149,7 +149,7 @@ static int hw_alloc_regmap(struct ci13xxx *ci, bool is_lpm)
* *
* This function returns an error code * This function returns an error code
*/ */
int hw_port_test_set(struct ci13xxx *ci, u8 mode) int hw_port_test_set(struct ci_hdrc *ci, u8 mode)
{ {
const u8 TEST_MODE_MAX = 7; const u8 TEST_MODE_MAX = 7;
...@@ -165,12 +165,12 @@ int hw_port_test_set(struct ci13xxx *ci, u8 mode) ...@@ -165,12 +165,12 @@ int hw_port_test_set(struct ci13xxx *ci, u8 mode)
* *
* This function returns port test mode value * This function returns port test mode value
*/ */
u8 hw_port_test_get(struct ci13xxx *ci) u8 hw_port_test_get(struct ci_hdrc *ci)
{ {
return hw_read(ci, OP_PORTSC, PORTSC_PTC) >> __ffs(PORTSC_PTC); return hw_read(ci, OP_PORTSC, PORTSC_PTC) >> __ffs(PORTSC_PTC);
} }
static int hw_device_init(struct ci13xxx *ci, void __iomem *base) static int hw_device_init(struct ci_hdrc *ci, void __iomem *base)
{ {
u32 reg; u32 reg;
...@@ -209,7 +209,7 @@ static int hw_device_init(struct ci13xxx *ci, void __iomem *base) ...@@ -209,7 +209,7 @@ static int hw_device_init(struct ci13xxx *ci, void __iomem *base)
return 0; return 0;
} }
static void hw_phymode_configure(struct ci13xxx *ci) static void hw_phymode_configure(struct ci_hdrc *ci)
{ {
u32 portsc, lpm, sts; u32 portsc, lpm, sts;
...@@ -254,7 +254,7 @@ static void hw_phymode_configure(struct ci13xxx *ci) ...@@ -254,7 +254,7 @@ static void hw_phymode_configure(struct ci13xxx *ci)
* *
* This function returns an error code * This function returns an error code
*/ */
int hw_device_reset(struct ci13xxx *ci, u32 mode) int hw_device_reset(struct ci_hdrc *ci, u32 mode)
{ {
/* should flush & stop before reset */ /* should flush & stop before reset */
hw_write(ci, OP_ENDPTFLUSH, ~0, ~0); hw_write(ci, OP_ENDPTFLUSH, ~0, ~0);
...@@ -268,9 +268,9 @@ int hw_device_reset(struct ci13xxx *ci, u32 mode) ...@@ -268,9 +268,9 @@ int hw_device_reset(struct ci13xxx *ci, u32 mode)
if (ci->platdata->notify_event) if (ci->platdata->notify_event)
ci->platdata->notify_event(ci, ci->platdata->notify_event(ci,
CI13XXX_CONTROLLER_RESET_EVENT); CI_HDRC_CONTROLLER_RESET_EVENT);
if (ci->platdata->flags & CI13XXX_DISABLE_STREAMING) if (ci->platdata->flags & CI_HDRC_DISABLE_STREAMING)
hw_write(ci, OP_USBMODE, USBMODE_CI_SDIS, USBMODE_CI_SDIS); hw_write(ci, OP_USBMODE, USBMODE_CI_SDIS, USBMODE_CI_SDIS);
/* USBMODE should be configured step by step */ /* USBMODE should be configured step by step */
...@@ -292,7 +292,7 @@ int hw_device_reset(struct ci13xxx *ci, u32 mode) ...@@ -292,7 +292,7 @@ int hw_device_reset(struct ci13xxx *ci, u32 mode)
* ci_otg_role - pick role based on ID pin state * ci_otg_role - pick role based on ID pin state
* @ci: the controller * @ci: the controller
*/ */
static enum ci_role ci_otg_role(struct ci13xxx *ci) static enum ci_role ci_otg_role(struct ci_hdrc *ci)
{ {
u32 sts = hw_read(ci, OP_OTGSC, ~0); u32 sts = hw_read(ci, OP_OTGSC, ~0);
enum ci_role role = sts & OTGSC_ID enum ci_role role = sts & OTGSC_ID
...@@ -308,7 +308,7 @@ static enum ci_role ci_otg_role(struct ci13xxx *ci) ...@@ -308,7 +308,7 @@ static enum ci_role ci_otg_role(struct ci13xxx *ci)
*/ */
static void ci_role_work(struct work_struct *work) static void ci_role_work(struct work_struct *work)
{ {
struct ci13xxx *ci = container_of(work, struct ci13xxx, work); struct ci_hdrc *ci = container_of(work, struct ci_hdrc, work);
enum ci_role role = ci_otg_role(ci); enum ci_role role = ci_otg_role(ci);
if (role != ci->role) { if (role != ci->role) {
...@@ -324,7 +324,7 @@ static void ci_role_work(struct work_struct *work) ...@@ -324,7 +324,7 @@ static void ci_role_work(struct work_struct *work)
static irqreturn_t ci_irq(int irq, void *data) static irqreturn_t ci_irq(int irq, void *data)
{ {
struct ci13xxx *ci = data; struct ci_hdrc *ci = data;
irqreturn_t ret = IRQ_NONE; irqreturn_t ret = IRQ_NONE;
u32 otgsc = 0; u32 otgsc = 0;
...@@ -346,9 +346,9 @@ static irqreturn_t ci_irq(int irq, void *data) ...@@ -346,9 +346,9 @@ static irqreturn_t ci_irq(int irq, void *data)
static DEFINE_IDA(ci_ida); static DEFINE_IDA(ci_ida);
struct platform_device *ci13xxx_add_device(struct device *dev, struct platform_device *ci_hdrc_add_device(struct device *dev,
struct resource *res, int nres, struct resource *res, int nres,
struct ci13xxx_platform_data *platdata) struct ci_hdrc_platform_data *platdata)
{ {
struct platform_device *pdev; struct platform_device *pdev;
int id, ret; int id, ret;
...@@ -388,20 +388,20 @@ struct platform_device *ci13xxx_add_device(struct device *dev, ...@@ -388,20 +388,20 @@ struct platform_device *ci13xxx_add_device(struct device *dev,
ida_simple_remove(&ci_ida, id); ida_simple_remove(&ci_ida, id);
return ERR_PTR(ret); return ERR_PTR(ret);
} }
EXPORT_SYMBOL_GPL(ci13xxx_add_device); EXPORT_SYMBOL_GPL(ci_hdrc_add_device);
void ci13xxx_remove_device(struct platform_device *pdev) void ci_hdrc_remove_device(struct platform_device *pdev)
{ {
int id = pdev->id; int id = pdev->id;
platform_device_unregister(pdev); platform_device_unregister(pdev);
ida_simple_remove(&ci_ida, id); ida_simple_remove(&ci_ida, id);
} }
EXPORT_SYMBOL_GPL(ci13xxx_remove_device); EXPORT_SYMBOL_GPL(ci_hdrc_remove_device);
static int ci_hdrc_probe(struct platform_device *pdev) static int ci_hdrc_probe(struct platform_device *pdev)
{ {
struct device *dev = &pdev->dev; struct device *dev = &pdev->dev;
struct ci13xxx *ci; struct ci_hdrc *ci;
struct resource *res; struct resource *res;
void __iomem *base; void __iomem *base;
int ret; int ret;
...@@ -526,7 +526,7 @@ static int ci_hdrc_probe(struct platform_device *pdev) ...@@ -526,7 +526,7 @@ static int ci_hdrc_probe(struct platform_device *pdev)
static int ci_hdrc_remove(struct platform_device *pdev) static int ci_hdrc_remove(struct platform_device *pdev)
{ {
struct ci13xxx *ci = platform_get_drvdata(pdev); struct ci_hdrc *ci = platform_get_drvdata(pdev);
dbg_remove_files(ci); dbg_remove_files(ci);
flush_workqueue(ci->wq); flush_workqueue(ci->wq);
......
...@@ -18,7 +18,7 @@ ...@@ -18,7 +18,7 @@
*/ */
static int ci_device_show(struct seq_file *s, void *data) static int ci_device_show(struct seq_file *s, void *data)
{ {
struct ci13xxx *ci = s->private; struct ci_hdrc *ci = s->private;
struct usb_gadget *gadget = &ci->gadget; struct usb_gadget *gadget = &ci->gadget;
seq_printf(s, "speed = %d\n", gadget->speed); seq_printf(s, "speed = %d\n", gadget->speed);
...@@ -58,7 +58,7 @@ static const struct file_operations ci_device_fops = { ...@@ -58,7 +58,7 @@ static const struct file_operations ci_device_fops = {
*/ */
static int ci_port_test_show(struct seq_file *s, void *data) static int ci_port_test_show(struct seq_file *s, void *data)
{ {
struct ci13xxx *ci = s->private; struct ci_hdrc *ci = s->private;
unsigned long flags; unsigned long flags;
unsigned mode; unsigned mode;
...@@ -78,7 +78,7 @@ static ssize_t ci_port_test_write(struct file *file, const char __user *ubuf, ...@@ -78,7 +78,7 @@ static ssize_t ci_port_test_write(struct file *file, const char __user *ubuf,
size_t count, loff_t *ppos) size_t count, loff_t *ppos)
{ {
struct seq_file *s = file->private_data; struct seq_file *s = file->private_data;
struct ci13xxx *ci = s->private; struct ci_hdrc *ci = s->private;
unsigned long flags; unsigned long flags;
unsigned mode; unsigned mode;
char buf[32]; char buf[32];
...@@ -115,7 +115,7 @@ static const struct file_operations ci_port_test_fops = { ...@@ -115,7 +115,7 @@ static const struct file_operations ci_port_test_fops = {
*/ */
static int ci_qheads_show(struct seq_file *s, void *data) static int ci_qheads_show(struct seq_file *s, void *data)
{ {
struct ci13xxx *ci = s->private; struct ci_hdrc *ci = s->private;
unsigned long flags; unsigned long flags;
unsigned i, j; unsigned i, j;
...@@ -126,12 +126,12 @@ static int ci_qheads_show(struct seq_file *s, void *data) ...@@ -126,12 +126,12 @@ static int ci_qheads_show(struct seq_file *s, void *data)
spin_lock_irqsave(&ci->lock, flags); spin_lock_irqsave(&ci->lock, flags);
for (i = 0; i < ci->hw_ep_max/2; i++) { for (i = 0; i < ci->hw_ep_max/2; i++) {
struct ci13xxx_ep *hweprx = &ci->ci13xxx_ep[i]; struct ci_hw_ep *hweprx = &ci->ci_hw_ep[i];
struct ci13xxx_ep *hweptx = struct ci_hw_ep *hweptx =
&ci->ci13xxx_ep[i + ci->hw_ep_max/2]; &ci->ci_hw_ep[i + ci->hw_ep_max/2];
seq_printf(s, "EP=%02i: RX=%08X TX=%08X\n", seq_printf(s, "EP=%02i: RX=%08X TX=%08X\n",
i, (u32)hweprx->qh.dma, (u32)hweptx->qh.dma); i, (u32)hweprx->qh.dma, (u32)hweptx->qh.dma);
for (j = 0; j < (sizeof(struct ci13xxx_qh)/sizeof(u32)); j++) for (j = 0; j < (sizeof(struct ci_hw_qh)/sizeof(u32)); j++)
seq_printf(s, " %04X: %08X %08X\n", j, seq_printf(s, " %04X: %08X %08X\n", j,
*((u32 *)hweprx->qh.ptr + j), *((u32 *)hweprx->qh.ptr + j),
*((u32 *)hweptx->qh.ptr + j)); *((u32 *)hweptx->qh.ptr + j));
...@@ -158,12 +158,12 @@ static const struct file_operations ci_qheads_fops = { ...@@ -158,12 +158,12 @@ static const struct file_operations ci_qheads_fops = {
*/ */
static int ci_requests_show(struct seq_file *s, void *data) static int ci_requests_show(struct seq_file *s, void *data)
{ {
struct ci13xxx *ci = s->private; struct ci_hdrc *ci = s->private;
unsigned long flags; unsigned long flags;
struct list_head *ptr = NULL; struct list_head *ptr = NULL;
struct ci13xxx_req *req = NULL; struct ci_hw_req *req = NULL;
struct td_node *node, *tmpnode; struct td_node *node, *tmpnode;
unsigned i, j, qsize = sizeof(struct ci13xxx_td)/sizeof(u32); unsigned i, j, qsize = sizeof(struct ci_hw_td)/sizeof(u32);
if (ci->role != CI_ROLE_GADGET) { if (ci->role != CI_ROLE_GADGET) {
seq_printf(s, "not in gadget mode\n"); seq_printf(s, "not in gadget mode\n");
...@@ -172,8 +172,8 @@ static int ci_requests_show(struct seq_file *s, void *data) ...@@ -172,8 +172,8 @@ static int ci_requests_show(struct seq_file *s, void *data)
spin_lock_irqsave(&ci->lock, flags); spin_lock_irqsave(&ci->lock, flags);
for (i = 0; i < ci->hw_ep_max; i++) for (i = 0; i < ci->hw_ep_max; i++)
list_for_each(ptr, &ci->ci13xxx_ep[i].qh.queue) { list_for_each(ptr, &ci->ci_hw_ep[i].qh.queue) {
req = list_entry(ptr, struct ci13xxx_req, queue); req = list_entry(ptr, struct ci_hw_req, queue);
list_for_each_entry_safe(node, tmpnode, &req->tds, td) { list_for_each_entry_safe(node, tmpnode, &req->tds, td) {
seq_printf(s, "EP=%02i: TD=%08X %s\n", seq_printf(s, "EP=%02i: TD=%08X %s\n",
...@@ -206,7 +206,7 @@ static const struct file_operations ci_requests_fops = { ...@@ -206,7 +206,7 @@ static const struct file_operations ci_requests_fops = {
static int ci_role_show(struct seq_file *s, void *data) static int ci_role_show(struct seq_file *s, void *data)
{ {
struct ci13xxx *ci = s->private; struct ci_hdrc *ci = s->private;
seq_printf(s, "%s\n", ci_role(ci)->name); seq_printf(s, "%s\n", ci_role(ci)->name);
...@@ -217,7 +217,7 @@ static ssize_t ci_role_write(struct file *file, const char __user *ubuf, ...@@ -217,7 +217,7 @@ static ssize_t ci_role_write(struct file *file, const char __user *ubuf,
size_t count, loff_t *ppos) size_t count, loff_t *ppos)
{ {
struct seq_file *s = file->private_data; struct seq_file *s = file->private_data;
struct ci13xxx *ci = s->private; struct ci_hdrc *ci = s->private;
enum ci_role role; enum ci_role role;
char buf[8]; char buf[8];
int ret; int ret;
...@@ -259,7 +259,7 @@ static const struct file_operations ci_role_fops = { ...@@ -259,7 +259,7 @@ static const struct file_operations ci_role_fops = {
* *
* This function returns an error code * This function returns an error code
*/ */
int dbg_create_files(struct ci13xxx *ci) int dbg_create_files(struct ci_hdrc *ci)
{ {
struct dentry *dent; struct dentry *dent;
...@@ -300,7 +300,7 @@ int dbg_create_files(struct ci13xxx *ci) ...@@ -300,7 +300,7 @@ int dbg_create_files(struct ci13xxx *ci)
* dbg_remove_files: destroys the attribute interface * dbg_remove_files: destroys the attribute interface
* @ci: device * @ci: device
*/ */
void dbg_remove_files(struct ci13xxx *ci) void dbg_remove_files(struct ci_hdrc *ci)
{ {
debugfs_remove_recursive(ci->debugfs); debugfs_remove_recursive(ci->debugfs);
} }
...@@ -14,15 +14,15 @@ ...@@ -14,15 +14,15 @@
#define __DRIVERS_USB_CHIPIDEA_DEBUG_H #define __DRIVERS_USB_CHIPIDEA_DEBUG_H
#ifdef CONFIG_USB_CHIPIDEA_DEBUG #ifdef CONFIG_USB_CHIPIDEA_DEBUG
int dbg_create_files(struct ci13xxx *ci); int dbg_create_files(struct ci_hdrc *ci);
void dbg_remove_files(struct ci13xxx *ci); void dbg_remove_files(struct ci_hdrc *ci);
#else #else
static inline int dbg_create_files(struct ci13xxx *ci) static inline int dbg_create_files(struct ci_hdrc *ci)
{ {
return 0; return 0;
} }
static inline void dbg_remove_files(struct ci13xxx *ci) static inline void dbg_remove_files(struct ci_hdrc *ci)
{ {
} }
#endif #endif
......
...@@ -33,12 +33,12 @@ ...@@ -33,12 +33,12 @@
static struct hc_driver __read_mostly ci_ehci_hc_driver; static struct hc_driver __read_mostly ci_ehci_hc_driver;
static irqreturn_t host_irq(struct ci13xxx *ci) static irqreturn_t host_irq(struct ci_hdrc *ci)
{ {
return usb_hcd_irq(ci->irq, ci->hcd); return usb_hcd_irq(ci->irq, ci->hcd);
} }
static int host_start(struct ci13xxx *ci) static int host_start(struct ci_hdrc *ci)
{ {
struct usb_hcd *hcd; struct usb_hcd *hcd;
struct ehci_hcd *ehci; struct ehci_hcd *ehci;
...@@ -70,13 +70,13 @@ static int host_start(struct ci13xxx *ci) ...@@ -70,13 +70,13 @@ static int host_start(struct ci13xxx *ci)
else else
ci->hcd = hcd; ci->hcd = hcd;
if (ci->platdata->flags & CI13XXX_DISABLE_STREAMING) if (ci->platdata->flags & CI_HDRC_DISABLE_STREAMING)
hw_write(ci, OP_USBMODE, USBMODE_CI_SDIS, USBMODE_CI_SDIS); hw_write(ci, OP_USBMODE, USBMODE_CI_SDIS, USBMODE_CI_SDIS);
return ret; return ret;
} }
static void host_stop(struct ci13xxx *ci) static void host_stop(struct ci_hdrc *ci)
{ {
struct usb_hcd *hcd = ci->hcd; struct usb_hcd *hcd = ci->hcd;
...@@ -84,7 +84,7 @@ static void host_stop(struct ci13xxx *ci) ...@@ -84,7 +84,7 @@ static void host_stop(struct ci13xxx *ci)
usb_put_hcd(hcd); usb_put_hcd(hcd);
} }
int ci_hdrc_host_init(struct ci13xxx *ci) int ci_hdrc_host_init(struct ci_hdrc *ci)
{ {
struct ci_role_driver *rdrv; struct ci_role_driver *rdrv;
......
...@@ -3,11 +3,11 @@ ...@@ -3,11 +3,11 @@
#ifdef CONFIG_USB_CHIPIDEA_HOST #ifdef CONFIG_USB_CHIPIDEA_HOST
int ci_hdrc_host_init(struct ci13xxx *ci); int ci_hdrc_host_init(struct ci_hdrc *ci);
#else #else
static inline int ci_hdrc_host_init(struct ci13xxx *ci) static inline int ci_hdrc_host_init(struct ci_hdrc *ci)
{ {
return -ENXIO; return -ENXIO;
} }
......
...@@ -61,7 +61,7 @@ static inline int hw_ep_bit(int num, int dir) ...@@ -61,7 +61,7 @@ static inline int hw_ep_bit(int num, int dir)
return num + (dir ? 16 : 0); return num + (dir ? 16 : 0);
} }
static inline int ep_to_bit(struct ci13xxx *ci, int n) static inline int ep_to_bit(struct ci_hdrc *ci, int n)
{ {
int fill = 16 - ci->hw_ep_max / 2; int fill = 16 - ci->hw_ep_max / 2;
...@@ -77,7 +77,7 @@ static inline int ep_to_bit(struct ci13xxx *ci, int n) ...@@ -77,7 +77,7 @@ static inline int ep_to_bit(struct ci13xxx *ci, int n)
* *
* This function returns an error code * This function returns an error code
*/ */
static int hw_device_state(struct ci13xxx *ci, u32 dma) static int hw_device_state(struct ci_hdrc *ci, u32 dma)
{ {
if (dma) { if (dma) {
hw_write(ci, OP_ENDPTLISTADDR, ~0, dma); hw_write(ci, OP_ENDPTLISTADDR, ~0, dma);
...@@ -97,7 +97,7 @@ static int hw_device_state(struct ci13xxx *ci, u32 dma) ...@@ -97,7 +97,7 @@ static int hw_device_state(struct ci13xxx *ci, u32 dma)
* *
* This function returns an error code * This function returns an error code
*/ */
static int hw_ep_flush(struct ci13xxx *ci, int num, int dir) static int hw_ep_flush(struct ci_hdrc *ci, int num, int dir)
{ {
int n = hw_ep_bit(num, dir); int n = hw_ep_bit(num, dir);
...@@ -118,7 +118,7 @@ static int hw_ep_flush(struct ci13xxx *ci, int num, int dir) ...@@ -118,7 +118,7 @@ static int hw_ep_flush(struct ci13xxx *ci, int num, int dir)
* *
* This function returns an error code * This function returns an error code
*/ */
static int hw_ep_disable(struct ci13xxx *ci, int num, int dir) static int hw_ep_disable(struct ci_hdrc *ci, int num, int dir)
{ {
hw_ep_flush(ci, num, dir); hw_ep_flush(ci, num, dir);
hw_write(ci, OP_ENDPTCTRL + num, hw_write(ci, OP_ENDPTCTRL + num,
...@@ -134,7 +134,7 @@ static int hw_ep_disable(struct ci13xxx *ci, int num, int dir) ...@@ -134,7 +134,7 @@ static int hw_ep_disable(struct ci13xxx *ci, int num, int dir)
* *
* This function returns an error code * This function returns an error code
*/ */
static int hw_ep_enable(struct ci13xxx *ci, int num, int dir, int type) static int hw_ep_enable(struct ci_hdrc *ci, int num, int dir, int type)
{ {
u32 mask, data; u32 mask, data;
...@@ -168,7 +168,7 @@ static int hw_ep_enable(struct ci13xxx *ci, int num, int dir, int type) ...@@ -168,7 +168,7 @@ static int hw_ep_enable(struct ci13xxx *ci, int num, int dir, int type)
* *
* This function returns 1 if endpoint halted * This function returns 1 if endpoint halted
*/ */
static int hw_ep_get_halt(struct ci13xxx *ci, int num, int dir) static int hw_ep_get_halt(struct ci_hdrc *ci, int num, int dir)
{ {
u32 mask = dir ? ENDPTCTRL_TXS : ENDPTCTRL_RXS; u32 mask = dir ? ENDPTCTRL_TXS : ENDPTCTRL_RXS;
...@@ -182,7 +182,7 @@ static int hw_ep_get_halt(struct ci13xxx *ci, int num, int dir) ...@@ -182,7 +182,7 @@ static int hw_ep_get_halt(struct ci13xxx *ci, int num, int dir)
* *
* This function returns setup status * This function returns setup status
*/ */
static int hw_test_and_clear_setup_status(struct ci13xxx *ci, int n) static int hw_test_and_clear_setup_status(struct ci_hdrc *ci, int n)
{ {
n = ep_to_bit(ci, n); n = ep_to_bit(ci, n);
return hw_test_and_clear(ci, OP_ENDPTSETUPSTAT, BIT(n)); return hw_test_and_clear(ci, OP_ENDPTSETUPSTAT, BIT(n));
...@@ -196,7 +196,7 @@ static int hw_test_and_clear_setup_status(struct ci13xxx *ci, int n) ...@@ -196,7 +196,7 @@ static int hw_test_and_clear_setup_status(struct ci13xxx *ci, int n)
* *
* This function returns an error code * This function returns an error code
*/ */
static int hw_ep_prime(struct ci13xxx *ci, int num, int dir, int is_ctrl) static int hw_ep_prime(struct ci_hdrc *ci, int num, int dir, int is_ctrl)
{ {
int n = hw_ep_bit(num, dir); int n = hw_ep_bit(num, dir);
...@@ -223,13 +223,13 @@ static int hw_ep_prime(struct ci13xxx *ci, int num, int dir, int is_ctrl) ...@@ -223,13 +223,13 @@ static int hw_ep_prime(struct ci13xxx *ci, int num, int dir, int is_ctrl)
* *
* This function returns an error code * This function returns an error code
*/ */
static int hw_ep_set_halt(struct ci13xxx *ci, int num, int dir, int value) static int hw_ep_set_halt(struct ci_hdrc *ci, int num, int dir, int value)
{ {
if (value != 0 && value != 1) if (value != 0 && value != 1)
return -EINVAL; return -EINVAL;
do { do {
enum ci13xxx_regs reg = OP_ENDPTCTRL + num; enum ci_hw_regs reg = OP_ENDPTCTRL + num;
u32 mask_xs = dir ? ENDPTCTRL_TXS : ENDPTCTRL_RXS; u32 mask_xs = dir ? ENDPTCTRL_TXS : ENDPTCTRL_RXS;
u32 mask_xr = dir ? ENDPTCTRL_TXR : ENDPTCTRL_RXR; u32 mask_xr = dir ? ENDPTCTRL_TXR : ENDPTCTRL_RXR;
...@@ -246,7 +246,7 @@ static int hw_ep_set_halt(struct ci13xxx *ci, int num, int dir, int value) ...@@ -246,7 +246,7 @@ static int hw_ep_set_halt(struct ci13xxx *ci, int num, int dir, int value)
* *
* This function returns true if high speed port * This function returns true if high speed port
*/ */
static int hw_port_is_high_speed(struct ci13xxx *ci) static int hw_port_is_high_speed(struct ci_hdrc *ci)
{ {
return ci->hw_bank.lpm ? hw_read(ci, OP_DEVLC, DEVLC_PSPD) : return ci->hw_bank.lpm ? hw_read(ci, OP_DEVLC, DEVLC_PSPD) :
hw_read(ci, OP_PORTSC, PORTSC_HSP); hw_read(ci, OP_PORTSC, PORTSC_HSP);
...@@ -257,7 +257,7 @@ static int hw_port_is_high_speed(struct ci13xxx *ci) ...@@ -257,7 +257,7 @@ static int hw_port_is_high_speed(struct ci13xxx *ci)
* *
* This function returns register data * This function returns register data
*/ */
static u32 hw_read_intr_enable(struct ci13xxx *ci) static u32 hw_read_intr_enable(struct ci_hdrc *ci)
{ {
return hw_read(ci, OP_USBINTR, ~0); return hw_read(ci, OP_USBINTR, ~0);
} }
...@@ -267,7 +267,7 @@ static u32 hw_read_intr_enable(struct ci13xxx *ci) ...@@ -267,7 +267,7 @@ static u32 hw_read_intr_enable(struct ci13xxx *ci)
* *
* This function returns register data * This function returns register data
*/ */
static u32 hw_read_intr_status(struct ci13xxx *ci) static u32 hw_read_intr_status(struct ci_hdrc *ci)
{ {
return hw_read(ci, OP_USBSTS, ~0); return hw_read(ci, OP_USBSTS, ~0);
} }
...@@ -279,7 +279,7 @@ static u32 hw_read_intr_status(struct ci13xxx *ci) ...@@ -279,7 +279,7 @@ static u32 hw_read_intr_status(struct ci13xxx *ci)
* *
* This function returns complete status * This function returns complete status
*/ */
static int hw_test_and_clear_complete(struct ci13xxx *ci, int n) static int hw_test_and_clear_complete(struct ci_hdrc *ci, int n)
{ {
n = ep_to_bit(ci, n); n = ep_to_bit(ci, n);
return hw_test_and_clear(ci, OP_ENDPTCOMPLETE, BIT(n)); return hw_test_and_clear(ci, OP_ENDPTCOMPLETE, BIT(n));
...@@ -291,7 +291,7 @@ static int hw_test_and_clear_complete(struct ci13xxx *ci, int n) ...@@ -291,7 +291,7 @@ static int hw_test_and_clear_complete(struct ci13xxx *ci, int n)
* *
* This function returns active interrutps * This function returns active interrutps
*/ */
static u32 hw_test_and_clear_intr_active(struct ci13xxx *ci) static u32 hw_test_and_clear_intr_active(struct ci_hdrc *ci)
{ {
u32 reg = hw_read_intr_status(ci) & hw_read_intr_enable(ci); u32 reg = hw_read_intr_status(ci) & hw_read_intr_enable(ci);
...@@ -305,7 +305,7 @@ static u32 hw_test_and_clear_intr_active(struct ci13xxx *ci) ...@@ -305,7 +305,7 @@ static u32 hw_test_and_clear_intr_active(struct ci13xxx *ci)
* *
* This function returns guard value * This function returns guard value
*/ */
static int hw_test_and_clear_setup_guard(struct ci13xxx *ci) static int hw_test_and_clear_setup_guard(struct ci_hdrc *ci)
{ {
return hw_test_and_write(ci, OP_USBCMD, USBCMD_SUTW, 0); return hw_test_and_write(ci, OP_USBCMD, USBCMD_SUTW, 0);
} }
...@@ -316,7 +316,7 @@ static int hw_test_and_clear_setup_guard(struct ci13xxx *ci) ...@@ -316,7 +316,7 @@ static int hw_test_and_clear_setup_guard(struct ci13xxx *ci)
* *
* This function returns guard value * This function returns guard value
*/ */
static int hw_test_and_set_setup_guard(struct ci13xxx *ci) static int hw_test_and_set_setup_guard(struct ci_hdrc *ci)
{ {
return hw_test_and_write(ci, OP_USBCMD, USBCMD_SUTW, USBCMD_SUTW); return hw_test_and_write(ci, OP_USBCMD, USBCMD_SUTW, USBCMD_SUTW);
} }
...@@ -328,7 +328,7 @@ static int hw_test_and_set_setup_guard(struct ci13xxx *ci) ...@@ -328,7 +328,7 @@ static int hw_test_and_set_setup_guard(struct ci13xxx *ci)
* This function explicitly sets the address, without the "USBADRA" (advance) * This function explicitly sets the address, without the "USBADRA" (advance)
* feature, which is not supported by older versions of the controller. * feature, which is not supported by older versions of the controller.
*/ */
static void hw_usb_set_address(struct ci13xxx *ci, u8 value) static void hw_usb_set_address(struct ci_hdrc *ci, u8 value)
{ {
hw_write(ci, OP_DEVICEADDR, DEVICEADDR_USBADR, hw_write(ci, OP_DEVICEADDR, DEVICEADDR_USBADR,
value << __ffs(DEVICEADDR_USBADR)); value << __ffs(DEVICEADDR_USBADR));
...@@ -340,7 +340,7 @@ static void hw_usb_set_address(struct ci13xxx *ci, u8 value) ...@@ -340,7 +340,7 @@ static void hw_usb_set_address(struct ci13xxx *ci, u8 value)
* *
* This function returns an error code * This function returns an error code
*/ */
static int hw_usb_reset(struct ci13xxx *ci) static int hw_usb_reset(struct ci_hdrc *ci)
{ {
hw_usb_set_address(ci, 0); hw_usb_set_address(ci, 0);
...@@ -369,7 +369,7 @@ static int hw_usb_reset(struct ci13xxx *ci) ...@@ -369,7 +369,7 @@ static int hw_usb_reset(struct ci13xxx *ci)
* UTIL block * UTIL block
*****************************************************************************/ *****************************************************************************/
static int add_td_to_list(struct ci13xxx_ep *hwep, struct ci13xxx_req *hwreq, static int add_td_to_list(struct ci_hw_ep *hwep, struct ci_hw_req *hwreq,
unsigned length) unsigned length)
{ {
int i; int i;
...@@ -387,7 +387,7 @@ static int add_td_to_list(struct ci13xxx_ep *hwep, struct ci13xxx_req *hwreq, ...@@ -387,7 +387,7 @@ static int add_td_to_list(struct ci13xxx_ep *hwep, struct ci13xxx_req *hwreq,
return -ENOMEM; return -ENOMEM;
} }
memset(node->ptr, 0, sizeof(struct ci13xxx_td)); memset(node->ptr, 0, sizeof(struct ci_hw_td));
node->ptr->token = cpu_to_le32(length << __ffs(TD_TOTAL_BYTES)); node->ptr->token = cpu_to_le32(length << __ffs(TD_TOTAL_BYTES));
node->ptr->token &= cpu_to_le32(TD_TOTAL_BYTES); node->ptr->token &= cpu_to_le32(TD_TOTAL_BYTES);
node->ptr->token |= cpu_to_le32(TD_STATUS_ACTIVE); node->ptr->token |= cpu_to_le32(TD_STATUS_ACTIVE);
...@@ -396,7 +396,7 @@ static int add_td_to_list(struct ci13xxx_ep *hwep, struct ci13xxx_req *hwreq, ...@@ -396,7 +396,7 @@ static int add_td_to_list(struct ci13xxx_ep *hwep, struct ci13xxx_req *hwreq,
if (length) { if (length) {
node->ptr->page[0] = cpu_to_le32(temp); node->ptr->page[0] = cpu_to_le32(temp);
for (i = 1; i < TD_PAGE_COUNT; i++) { for (i = 1; i < TD_PAGE_COUNT; i++) {
u32 page = temp + i * CI13XXX_PAGE_SIZE; u32 page = temp + i * CI_HDRC_PAGE_SIZE;
page &= ~TD_RESERVED_MASK; page &= ~TD_RESERVED_MASK;
node->ptr->page[i] = cpu_to_le32(page); node->ptr->page[i] = cpu_to_le32(page);
} }
...@@ -421,7 +421,7 @@ static int add_td_to_list(struct ci13xxx_ep *hwep, struct ci13xxx_req *hwreq, ...@@ -421,7 +421,7 @@ static int add_td_to_list(struct ci13xxx_ep *hwep, struct ci13xxx_req *hwreq,
* _usb_addr: calculates endpoint address from direction & number * _usb_addr: calculates endpoint address from direction & number
* @ep: endpoint * @ep: endpoint
*/ */
static inline u8 _usb_addr(struct ci13xxx_ep *ep) static inline u8 _usb_addr(struct ci_hw_ep *ep)
{ {
return ((ep->dir == TX) ? USB_ENDPOINT_DIR_MASK : 0) | ep->num; return ((ep->dir == TX) ? USB_ENDPOINT_DIR_MASK : 0) | ep->num;
} }
...@@ -433,9 +433,9 @@ static inline u8 _usb_addr(struct ci13xxx_ep *ep) ...@@ -433,9 +433,9 @@ static inline u8 _usb_addr(struct ci13xxx_ep *ep)
* *
* This function returns an error code * This function returns an error code
*/ */
static int _hardware_enqueue(struct ci13xxx_ep *hwep, struct ci13xxx_req *hwreq) static int _hardware_enqueue(struct ci_hw_ep *hwep, struct ci_hw_req *hwreq)
{ {
struct ci13xxx *ci = hwep->ci; struct ci_hdrc *ci = hwep->ci;
int ret = 0; int ret = 0;
unsigned rest = hwreq->req.length; unsigned rest = hwreq->req.length;
int pages = TD_PAGE_COUNT; int pages = TD_PAGE_COUNT;
...@@ -463,7 +463,7 @@ static int _hardware_enqueue(struct ci13xxx_ep *hwep, struct ci13xxx_req *hwreq) ...@@ -463,7 +463,7 @@ static int _hardware_enqueue(struct ci13xxx_ep *hwep, struct ci13xxx_req *hwreq)
while (rest > 0) { while (rest > 0) {
unsigned count = min(hwreq->req.length - hwreq->req.actual, unsigned count = min(hwreq->req.length - hwreq->req.actual,
(unsigned)(pages * CI13XXX_PAGE_SIZE)); (unsigned)(pages * CI_HDRC_PAGE_SIZE));
add_td_to_list(hwep, hwreq, count); add_td_to_list(hwep, hwreq, count);
rest -= count; rest -= count;
} }
...@@ -484,14 +484,14 @@ static int _hardware_enqueue(struct ci13xxx_ep *hwep, struct ci13xxx_req *hwreq) ...@@ -484,14 +484,14 @@ static int _hardware_enqueue(struct ci13xxx_ep *hwep, struct ci13xxx_req *hwreq)
hwreq->req.actual = 0; hwreq->req.actual = 0;
if (!list_empty(&hwep->qh.queue)) { if (!list_empty(&hwep->qh.queue)) {
struct ci13xxx_req *hwreqprev; struct ci_hw_req *hwreqprev;
int n = hw_ep_bit(hwep->num, hwep->dir); int n = hw_ep_bit(hwep->num, hwep->dir);
int tmp_stat; int tmp_stat;
struct td_node *prevlastnode; struct td_node *prevlastnode;
u32 next = firstnode->dma & TD_ADDR_MASK; u32 next = firstnode->dma & TD_ADDR_MASK;
hwreqprev = list_entry(hwep->qh.queue.prev, hwreqprev = list_entry(hwep->qh.queue.prev,
struct ci13xxx_req, queue); struct ci_hw_req, queue);
prevlastnode = list_entry(hwreqprev->tds.prev, prevlastnode = list_entry(hwreqprev->tds.prev,
struct td_node, td); struct td_node, td);
...@@ -533,7 +533,7 @@ static int _hardware_enqueue(struct ci13xxx_ep *hwep, struct ci13xxx_req *hwreq) ...@@ -533,7 +533,7 @@ static int _hardware_enqueue(struct ci13xxx_ep *hwep, struct ci13xxx_req *hwreq)
* free_pending_td: remove a pending request for the endpoint * free_pending_td: remove a pending request for the endpoint
* @hwep: endpoint * @hwep: endpoint
*/ */
static void free_pending_td(struct ci13xxx_ep *hwep) static void free_pending_td(struct ci_hw_ep *hwep)
{ {
struct td_node *pending = hwep->pending_td; struct td_node *pending = hwep->pending_td;
...@@ -549,7 +549,7 @@ static void free_pending_td(struct ci13xxx_ep *hwep) ...@@ -549,7 +549,7 @@ static void free_pending_td(struct ci13xxx_ep *hwep)
* *
* This function returns an error code * This function returns an error code
*/ */
static int _hardware_dequeue(struct ci13xxx_ep *hwep, struct ci13xxx_req *hwreq) static int _hardware_dequeue(struct ci_hw_ep *hwep, struct ci_hw_req *hwreq)
{ {
u32 tmptoken; u32 tmptoken;
struct td_node *node, *tmpnode; struct td_node *node, *tmpnode;
...@@ -619,7 +619,7 @@ static int _hardware_dequeue(struct ci13xxx_ep *hwep, struct ci13xxx_req *hwreq) ...@@ -619,7 +619,7 @@ static int _hardware_dequeue(struct ci13xxx_ep *hwep, struct ci13xxx_req *hwreq)
* This function returns an error code * This function returns an error code
* Caller must hold lock * Caller must hold lock
*/ */
static int _ep_nuke(struct ci13xxx_ep *hwep) static int _ep_nuke(struct ci_hw_ep *hwep)
__releases(hwep->lock) __releases(hwep->lock)
__acquires(hwep->lock) __acquires(hwep->lock)
{ {
...@@ -632,9 +632,8 @@ __acquires(hwep->lock) ...@@ -632,9 +632,8 @@ __acquires(hwep->lock)
while (!list_empty(&hwep->qh.queue)) { while (!list_empty(&hwep->qh.queue)) {
/* pop oldest request */ /* pop oldest request */
struct ci13xxx_req *hwreq = list_entry(hwep->qh.queue.next, struct ci_hw_req *hwreq = list_entry(hwep->qh.queue.next,
struct ci13xxx_req, struct ci_hw_req, queue);
queue);
list_for_each_entry_safe(node, tmpnode, &hwreq->tds, td) { list_for_each_entry_safe(node, tmpnode, &hwreq->tds, td) {
dma_pool_free(hwep->td_pool, node->ptr, node->dma); dma_pool_free(hwep->td_pool, node->ptr, node->dma);
...@@ -668,7 +667,7 @@ __acquires(hwep->lock) ...@@ -668,7 +667,7 @@ __acquires(hwep->lock)
static int _gadget_stop_activity(struct usb_gadget *gadget) static int _gadget_stop_activity(struct usb_gadget *gadget)
{ {
struct usb_ep *ep; struct usb_ep *ep;
struct ci13xxx *ci = container_of(gadget, struct ci13xxx, gadget); struct ci_hdrc *ci = container_of(gadget, struct ci_hdrc, gadget);
unsigned long flags; unsigned long flags;
spin_lock_irqsave(&ci->lock, flags); spin_lock_irqsave(&ci->lock, flags);
...@@ -709,7 +708,7 @@ static int _gadget_stop_activity(struct usb_gadget *gadget) ...@@ -709,7 +708,7 @@ static int _gadget_stop_activity(struct usb_gadget *gadget)
* *
* This function resets USB engine after a bus reset occurred * This function resets USB engine after a bus reset occurred
*/ */
static void isr_reset_handler(struct ci13xxx *ci) static void isr_reset_handler(struct ci_hdrc *ci)
__releases(ci->lock) __releases(ci->lock)
__acquires(ci->lock) __acquires(ci->lock)
{ {
...@@ -759,9 +758,9 @@ static void isr_get_status_complete(struct usb_ep *ep, struct usb_request *req) ...@@ -759,9 +758,9 @@ static void isr_get_status_complete(struct usb_ep *ep, struct usb_request *req)
static int _ep_queue(struct usb_ep *ep, struct usb_request *req, static int _ep_queue(struct usb_ep *ep, struct usb_request *req,
gfp_t __maybe_unused gfp_flags) gfp_t __maybe_unused gfp_flags)
{ {
struct ci13xxx_ep *hwep = container_of(ep, struct ci13xxx_ep, ep); struct ci_hw_ep *hwep = container_of(ep, struct ci_hw_ep, ep);
struct ci13xxx_req *hwreq = container_of(req, struct ci13xxx_req, req); struct ci_hw_req *hwreq = container_of(req, struct ci_hw_req, req);
struct ci13xxx *ci = hwep->ci; struct ci_hdrc *ci = hwep->ci;
int retval = 0; int retval = 0;
if (ep == NULL || req == NULL || hwep->ep.desc == NULL) if (ep == NULL || req == NULL || hwep->ep.desc == NULL)
...@@ -812,12 +811,12 @@ static int _ep_queue(struct usb_ep *ep, struct usb_request *req, ...@@ -812,12 +811,12 @@ static int _ep_queue(struct usb_ep *ep, struct usb_request *req,
* *
* This function returns an error code * This function returns an error code
*/ */
static int isr_get_status_response(struct ci13xxx *ci, static int isr_get_status_response(struct ci_hdrc *ci,
struct usb_ctrlrequest *setup) struct usb_ctrlrequest *setup)
__releases(hwep->lock) __releases(hwep->lock)
__acquires(hwep->lock) __acquires(hwep->lock)
{ {
struct ci13xxx_ep *hwep = ci->ep0in; struct ci_hw_ep *hwep = ci->ep0in;
struct usb_request *req = NULL; struct usb_request *req = NULL;
gfp_t gfp_flags = GFP_ATOMIC; gfp_t gfp_flags = GFP_ATOMIC;
int dir, num, retval; int dir, num, retval;
...@@ -878,7 +877,7 @@ __acquires(hwep->lock) ...@@ -878,7 +877,7 @@ __acquires(hwep->lock)
static void static void
isr_setup_status_complete(struct usb_ep *ep, struct usb_request *req) isr_setup_status_complete(struct usb_ep *ep, struct usb_request *req)
{ {
struct ci13xxx *ci = req->context; struct ci_hdrc *ci = req->context;
unsigned long flags; unsigned long flags;
if (ci->setaddr) { if (ci->setaddr) {
...@@ -898,10 +897,10 @@ isr_setup_status_complete(struct usb_ep *ep, struct usb_request *req) ...@@ -898,10 +897,10 @@ isr_setup_status_complete(struct usb_ep *ep, struct usb_request *req)
* *
* This function returns an error code * This function returns an error code
*/ */
static int isr_setup_status_phase(struct ci13xxx *ci) static int isr_setup_status_phase(struct ci_hdrc *ci)
{ {
int retval; int retval;
struct ci13xxx_ep *hwep; struct ci_hw_ep *hwep;
hwep = (ci->ep0_dir == TX) ? ci->ep0out : ci->ep0in; hwep = (ci->ep0_dir == TX) ? ci->ep0out : ci->ep0in;
ci->status->context = ci; ci->status->context = ci;
...@@ -919,12 +918,12 @@ static int isr_setup_status_phase(struct ci13xxx *ci) ...@@ -919,12 +918,12 @@ static int isr_setup_status_phase(struct ci13xxx *ci)
* This function returns an error code * This function returns an error code
* Caller must hold lock * Caller must hold lock
*/ */
static int isr_tr_complete_low(struct ci13xxx_ep *hwep) static int isr_tr_complete_low(struct ci_hw_ep *hwep)
__releases(hwep->lock) __releases(hwep->lock)
__acquires(hwep->lock) __acquires(hwep->lock)
{ {
struct ci13xxx_req *hwreq, *hwreqtemp; struct ci_hw_req *hwreq, *hwreqtemp;
struct ci13xxx_ep *hweptemp = hwep; struct ci_hw_ep *hweptemp = hwep;
int retval = 0; int retval = 0;
list_for_each_entry_safe(hwreq, hwreqtemp, &hwep->qh.queue, list_for_each_entry_safe(hwreq, hwreqtemp, &hwep->qh.queue,
...@@ -955,7 +954,7 @@ __acquires(hwep->lock) ...@@ -955,7 +954,7 @@ __acquires(hwep->lock)
* *
* This function handles traffic events * This function handles traffic events
*/ */
static void isr_tr_complete_handler(struct ci13xxx *ci) static void isr_tr_complete_handler(struct ci_hdrc *ci)
__releases(ci->lock) __releases(ci->lock)
__acquires(ci->lock) __acquires(ci->lock)
{ {
...@@ -963,7 +962,7 @@ __acquires(ci->lock) ...@@ -963,7 +962,7 @@ __acquires(ci->lock)
u8 tmode = 0; u8 tmode = 0;
for (i = 0; i < ci->hw_ep_max; i++) { for (i = 0; i < ci->hw_ep_max; i++) {
struct ci13xxx_ep *hwep = &ci->ci13xxx_ep[i]; struct ci_hw_ep *hwep = &ci->ci_hw_ep[i];
int type, num, dir, err = -EINVAL; int type, num, dir, err = -EINVAL;
struct usb_ctrlrequest req; struct usb_ctrlrequest req;
...@@ -1023,10 +1022,10 @@ __acquires(ci->lock) ...@@ -1023,10 +1022,10 @@ __acquires(ci->lock)
num &= USB_ENDPOINT_NUMBER_MASK; num &= USB_ENDPOINT_NUMBER_MASK;
if (dir) /* TX */ if (dir) /* TX */
num += ci->hw_ep_max/2; num += ci->hw_ep_max/2;
if (!ci->ci13xxx_ep[num].wedge) { if (!ci->ci_hw_ep[num].wedge) {
spin_unlock(&ci->lock); spin_unlock(&ci->lock);
err = usb_ep_clear_halt( err = usb_ep_clear_halt(
&ci->ci13xxx_ep[num].ep); &ci->ci_hw_ep[num].ep);
spin_lock(&ci->lock); spin_lock(&ci->lock);
if (err) if (err)
break; break;
...@@ -1076,7 +1075,7 @@ __acquires(ci->lock) ...@@ -1076,7 +1075,7 @@ __acquires(ci->lock)
num += ci->hw_ep_max/2; num += ci->hw_ep_max/2;
spin_unlock(&ci->lock); spin_unlock(&ci->lock);
err = usb_ep_set_halt(&ci->ci13xxx_ep[num].ep); err = usb_ep_set_halt(&ci->ci_hw_ep[num].ep);
spin_lock(&ci->lock); spin_lock(&ci->lock);
if (!err) if (!err)
isr_setup_status_phase(ci); isr_setup_status_phase(ci);
...@@ -1141,7 +1140,7 @@ __acquires(ci->lock) ...@@ -1141,7 +1140,7 @@ __acquires(ci->lock)
static int ep_enable(struct usb_ep *ep, static int ep_enable(struct usb_ep *ep,
const struct usb_endpoint_descriptor *desc) const struct usb_endpoint_descriptor *desc)
{ {
struct ci13xxx_ep *hwep = container_of(ep, struct ci13xxx_ep, ep); struct ci_hw_ep *hwep = container_of(ep, struct ci_hw_ep, ep);
int retval = 0; int retval = 0;
unsigned long flags; unsigned long flags;
u32 cap = 0; u32 cap = 0;
...@@ -1194,7 +1193,7 @@ static int ep_enable(struct usb_ep *ep, ...@@ -1194,7 +1193,7 @@ static int ep_enable(struct usb_ep *ep,
*/ */
static int ep_disable(struct usb_ep *ep) static int ep_disable(struct usb_ep *ep)
{ {
struct ci13xxx_ep *hwep = container_of(ep, struct ci13xxx_ep, ep); struct ci_hw_ep *hwep = container_of(ep, struct ci_hw_ep, ep);
int direction, retval = 0; int direction, retval = 0;
unsigned long flags; unsigned long flags;
...@@ -1230,12 +1229,12 @@ static int ep_disable(struct usb_ep *ep) ...@@ -1230,12 +1229,12 @@ static int ep_disable(struct usb_ep *ep)
*/ */
static struct usb_request *ep_alloc_request(struct usb_ep *ep, gfp_t gfp_flags) static struct usb_request *ep_alloc_request(struct usb_ep *ep, gfp_t gfp_flags)
{ {
struct ci13xxx_req *hwreq = NULL; struct ci_hw_req *hwreq = NULL;
if (ep == NULL) if (ep == NULL)
return NULL; return NULL;
hwreq = kzalloc(sizeof(struct ci13xxx_req), gfp_flags); hwreq = kzalloc(sizeof(struct ci_hw_req), gfp_flags);
if (hwreq != NULL) { if (hwreq != NULL) {
INIT_LIST_HEAD(&hwreq->queue); INIT_LIST_HEAD(&hwreq->queue);
INIT_LIST_HEAD(&hwreq->tds); INIT_LIST_HEAD(&hwreq->tds);
...@@ -1251,8 +1250,8 @@ static struct usb_request *ep_alloc_request(struct usb_ep *ep, gfp_t gfp_flags) ...@@ -1251,8 +1250,8 @@ static struct usb_request *ep_alloc_request(struct usb_ep *ep, gfp_t gfp_flags)
*/ */
static void ep_free_request(struct usb_ep *ep, struct usb_request *req) static void ep_free_request(struct usb_ep *ep, struct usb_request *req)
{ {
struct ci13xxx_ep *hwep = container_of(ep, struct ci13xxx_ep, ep); struct ci_hw_ep *hwep = container_of(ep, struct ci_hw_ep, ep);
struct ci13xxx_req *hwreq = container_of(req, struct ci13xxx_req, req); struct ci_hw_req *hwreq = container_of(req, struct ci_hw_req, req);
struct td_node *node, *tmpnode; struct td_node *node, *tmpnode;
unsigned long flags; unsigned long flags;
...@@ -1285,7 +1284,7 @@ static void ep_free_request(struct usb_ep *ep, struct usb_request *req) ...@@ -1285,7 +1284,7 @@ static void ep_free_request(struct usb_ep *ep, struct usb_request *req)
static int ep_queue(struct usb_ep *ep, struct usb_request *req, static int ep_queue(struct usb_ep *ep, struct usb_request *req,
gfp_t __maybe_unused gfp_flags) gfp_t __maybe_unused gfp_flags)
{ {
struct ci13xxx_ep *hwep = container_of(ep, struct ci13xxx_ep, ep); struct ci_hw_ep *hwep = container_of(ep, struct ci_hw_ep, ep);
int retval = 0; int retval = 0;
unsigned long flags; unsigned long flags;
...@@ -1305,8 +1304,8 @@ static int ep_queue(struct usb_ep *ep, struct usb_request *req, ...@@ -1305,8 +1304,8 @@ static int ep_queue(struct usb_ep *ep, struct usb_request *req,
*/ */
static int ep_dequeue(struct usb_ep *ep, struct usb_request *req) static int ep_dequeue(struct usb_ep *ep, struct usb_request *req)
{ {
struct ci13xxx_ep *hwep = container_of(ep, struct ci13xxx_ep, ep); struct ci_hw_ep *hwep = container_of(ep, struct ci_hw_ep, ep);
struct ci13xxx_req *hwreq = container_of(req, struct ci13xxx_req, req); struct ci_hw_req *hwreq = container_of(req, struct ci_hw_req, req);
unsigned long flags; unsigned long flags;
if (ep == NULL || req == NULL || hwreq->req.status != -EALREADY || if (ep == NULL || req == NULL || hwreq->req.status != -EALREADY ||
...@@ -1342,7 +1341,7 @@ static int ep_dequeue(struct usb_ep *ep, struct usb_request *req) ...@@ -1342,7 +1341,7 @@ static int ep_dequeue(struct usb_ep *ep, struct usb_request *req)
*/ */
static int ep_set_halt(struct usb_ep *ep, int value) static int ep_set_halt(struct usb_ep *ep, int value)
{ {
struct ci13xxx_ep *hwep = container_of(ep, struct ci13xxx_ep, ep); struct ci_hw_ep *hwep = container_of(ep, struct ci_hw_ep, ep);
int direction, retval = 0; int direction, retval = 0;
unsigned long flags; unsigned long flags;
...@@ -1386,7 +1385,7 @@ static int ep_set_halt(struct usb_ep *ep, int value) ...@@ -1386,7 +1385,7 @@ static int ep_set_halt(struct usb_ep *ep, int value)
*/ */
static int ep_set_wedge(struct usb_ep *ep) static int ep_set_wedge(struct usb_ep *ep)
{ {
struct ci13xxx_ep *hwep = container_of(ep, struct ci13xxx_ep, ep); struct ci_hw_ep *hwep = container_of(ep, struct ci_hw_ep, ep);
unsigned long flags; unsigned long flags;
if (ep == NULL || hwep->ep.desc == NULL) if (ep == NULL || hwep->ep.desc == NULL)
...@@ -1406,7 +1405,7 @@ static int ep_set_wedge(struct usb_ep *ep) ...@@ -1406,7 +1405,7 @@ static int ep_set_wedge(struct usb_ep *ep)
*/ */
static void ep_fifo_flush(struct usb_ep *ep) static void ep_fifo_flush(struct usb_ep *ep)
{ {
struct ci13xxx_ep *hwep = container_of(ep, struct ci13xxx_ep, ep); struct ci_hw_ep *hwep = container_of(ep, struct ci_hw_ep, ep);
unsigned long flags; unsigned long flags;
if (ep == NULL) { if (ep == NULL) {
...@@ -1440,13 +1439,13 @@ static const struct usb_ep_ops usb_ep_ops = { ...@@ -1440,13 +1439,13 @@ static const struct usb_ep_ops usb_ep_ops = {
/****************************************************************************** /******************************************************************************
* GADGET block * GADGET block
*****************************************************************************/ *****************************************************************************/
static int ci13xxx_vbus_session(struct usb_gadget *_gadget, int is_active) static int ci_udc_vbus_session(struct usb_gadget *_gadget, int is_active)
{ {
struct ci13xxx *ci = container_of(_gadget, struct ci13xxx, gadget); struct ci_hdrc *ci = container_of(_gadget, struct ci_hdrc, gadget);
unsigned long flags; unsigned long flags;
int gadget_ready = 0; int gadget_ready = 0;
if (!(ci->platdata->flags & CI13XXX_PULLUP_ON_VBUS)) if (!(ci->platdata->flags & CI_HDRC_PULLUP_ON_VBUS))
return -EOPNOTSUPP; return -EOPNOTSUPP;
spin_lock_irqsave(&ci->lock, flags); spin_lock_irqsave(&ci->lock, flags);
...@@ -1464,7 +1463,7 @@ static int ci13xxx_vbus_session(struct usb_gadget *_gadget, int is_active) ...@@ -1464,7 +1463,7 @@ static int ci13xxx_vbus_session(struct usb_gadget *_gadget, int is_active)
hw_device_state(ci, 0); hw_device_state(ci, 0);
if (ci->platdata->notify_event) if (ci->platdata->notify_event)
ci->platdata->notify_event(ci, ci->platdata->notify_event(ci,
CI13XXX_CONTROLLER_STOPPED_EVENT); CI_HDRC_CONTROLLER_STOPPED_EVENT);
_gadget_stop_activity(&ci->gadget); _gadget_stop_activity(&ci->gadget);
pm_runtime_put_sync(&_gadget->dev); pm_runtime_put_sync(&_gadget->dev);
} }
...@@ -1473,9 +1472,9 @@ static int ci13xxx_vbus_session(struct usb_gadget *_gadget, int is_active) ...@@ -1473,9 +1472,9 @@ static int ci13xxx_vbus_session(struct usb_gadget *_gadget, int is_active)
return 0; return 0;
} }
static int ci13xxx_wakeup(struct usb_gadget *_gadget) static int ci_udc_wakeup(struct usb_gadget *_gadget)
{ {
struct ci13xxx *ci = container_of(_gadget, struct ci13xxx, gadget); struct ci_hdrc *ci = container_of(_gadget, struct ci_hdrc, gadget);
unsigned long flags; unsigned long flags;
int ret = 0; int ret = 0;
...@@ -1494,9 +1493,9 @@ static int ci13xxx_wakeup(struct usb_gadget *_gadget) ...@@ -1494,9 +1493,9 @@ static int ci13xxx_wakeup(struct usb_gadget *_gadget)
return ret; return ret;
} }
static int ci13xxx_vbus_draw(struct usb_gadget *_gadget, unsigned ma) static int ci_udc_vbus_draw(struct usb_gadget *_gadget, unsigned ma)
{ {
struct ci13xxx *ci = container_of(_gadget, struct ci13xxx, gadget); struct ci_hdrc *ci = container_of(_gadget, struct ci_hdrc, gadget);
if (ci->transceiver) if (ci->transceiver)
return usb_phy_set_power(ci->transceiver, ma); return usb_phy_set_power(ci->transceiver, ma);
...@@ -1506,9 +1505,9 @@ static int ci13xxx_vbus_draw(struct usb_gadget *_gadget, unsigned ma) ...@@ -1506,9 +1505,9 @@ static int ci13xxx_vbus_draw(struct usb_gadget *_gadget, unsigned ma)
/* Change Data+ pullup status /* Change Data+ pullup status
* this func is used by usb_gadget_connect/disconnet * this func is used by usb_gadget_connect/disconnet
*/ */
static int ci13xxx_pullup(struct usb_gadget *_gadget, int is_on) static int ci_udc_pullup(struct usb_gadget *_gadget, int is_on)
{ {
struct ci13xxx *ci = container_of(_gadget, struct ci13xxx, gadget); struct ci_hdrc *ci = container_of(_gadget, struct ci_hdrc, gadget);
if (is_on) if (is_on)
hw_write(ci, OP_USBCMD, USBCMD_RS, USBCMD_RS); hw_write(ci, OP_USBCMD, USBCMD_RS, USBCMD_RS);
...@@ -1518,9 +1517,9 @@ static int ci13xxx_pullup(struct usb_gadget *_gadget, int is_on) ...@@ -1518,9 +1517,9 @@ static int ci13xxx_pullup(struct usb_gadget *_gadget, int is_on)
return 0; return 0;
} }
static int ci13xxx_start(struct usb_gadget *gadget, static int ci_udc_start(struct usb_gadget *gadget,
struct usb_gadget_driver *driver); struct usb_gadget_driver *driver);
static int ci13xxx_stop(struct usb_gadget *gadget, static int ci_udc_stop(struct usb_gadget *gadget,
struct usb_gadget_driver *driver); struct usb_gadget_driver *driver);
/** /**
* Device operations part of the API to the USB controller hardware, * Device operations part of the API to the USB controller hardware,
...@@ -1528,22 +1527,22 @@ static int ci13xxx_stop(struct usb_gadget *gadget, ...@@ -1528,22 +1527,22 @@ static int ci13xxx_stop(struct usb_gadget *gadget,
* Check "usb_gadget.h" for details * Check "usb_gadget.h" for details
*/ */
static const struct usb_gadget_ops usb_gadget_ops = { static const struct usb_gadget_ops usb_gadget_ops = {
.vbus_session = ci13xxx_vbus_session, .vbus_session = ci_udc_vbus_session,
.wakeup = ci13xxx_wakeup, .wakeup = ci_udc_wakeup,
.pullup = ci13xxx_pullup, .pullup = ci_udc_pullup,
.vbus_draw = ci13xxx_vbus_draw, .vbus_draw = ci_udc_vbus_draw,
.udc_start = ci13xxx_start, .udc_start = ci_udc_start,
.udc_stop = ci13xxx_stop, .udc_stop = ci_udc_stop,
}; };
static int init_eps(struct ci13xxx *ci) static int init_eps(struct ci_hdrc *ci)
{ {
int retval = 0, i, j; int retval = 0, i, j;
for (i = 0; i < ci->hw_ep_max/2; i++) for (i = 0; i < ci->hw_ep_max/2; i++)
for (j = RX; j <= TX; j++) { for (j = RX; j <= TX; j++) {
int k = i + j * ci->hw_ep_max/2; int k = i + j * ci->hw_ep_max/2;
struct ci13xxx_ep *hwep = &ci->ci13xxx_ep[k]; struct ci_hw_ep *hwep = &ci->ci_hw_ep[k];
scnprintf(hwep->name, sizeof(hwep->name), "ep%i%s", i, scnprintf(hwep->name, sizeof(hwep->name), "ep%i%s", i,
(j == TX) ? "in" : "out"); (j == TX) ? "in" : "out");
...@@ -1589,28 +1588,28 @@ static int init_eps(struct ci13xxx *ci) ...@@ -1589,28 +1588,28 @@ static int init_eps(struct ci13xxx *ci)
return retval; return retval;
} }
static void destroy_eps(struct ci13xxx *ci) static void destroy_eps(struct ci_hdrc *ci)
{ {
int i; int i;
for (i = 0; i < ci->hw_ep_max; i++) { for (i = 0; i < ci->hw_ep_max; i++) {
struct ci13xxx_ep *hwep = &ci->ci13xxx_ep[i]; struct ci_hw_ep *hwep = &ci->ci_hw_ep[i];
dma_pool_free(ci->qh_pool, hwep->qh.ptr, hwep->qh.dma); dma_pool_free(ci->qh_pool, hwep->qh.ptr, hwep->qh.dma);
} }
} }
/** /**
* ci13xxx_start: register a gadget driver * ci_udc_start: register a gadget driver
* @gadget: our gadget * @gadget: our gadget
* @driver: the driver being registered * @driver: the driver being registered
* *
* Interrupts are enabled here. * Interrupts are enabled here.
*/ */
static int ci13xxx_start(struct usb_gadget *gadget, static int ci_udc_start(struct usb_gadget *gadget,
struct usb_gadget_driver *driver) struct usb_gadget_driver *driver)
{ {
struct ci13xxx *ci = container_of(gadget, struct ci13xxx, gadget); struct ci_hdrc *ci = container_of(gadget, struct ci_hdrc, gadget);
unsigned long flags; unsigned long flags;
int retval = -ENOMEM; int retval = -ENOMEM;
...@@ -1631,9 +1630,9 @@ static int ci13xxx_start(struct usb_gadget *gadget, ...@@ -1631,9 +1630,9 @@ static int ci13xxx_start(struct usb_gadget *gadget,
ci->driver = driver; ci->driver = driver;
pm_runtime_get_sync(&ci->gadget.dev); pm_runtime_get_sync(&ci->gadget.dev);
if (ci->platdata->flags & CI13XXX_PULLUP_ON_VBUS) { if (ci->platdata->flags & CI_HDRC_PULLUP_ON_VBUS) {
if (ci->vbus_active) { if (ci->vbus_active) {
if (ci->platdata->flags & CI13XXX_REGS_SHARED) if (ci->platdata->flags & CI_HDRC_REGS_SHARED)
hw_device_reset(ci, USBMODE_CM_DC); hw_device_reset(ci, USBMODE_CM_DC);
} else { } else {
pm_runtime_put_sync(&ci->gadget.dev); pm_runtime_put_sync(&ci->gadget.dev);
...@@ -1651,22 +1650,22 @@ static int ci13xxx_start(struct usb_gadget *gadget, ...@@ -1651,22 +1650,22 @@ static int ci13xxx_start(struct usb_gadget *gadget,
} }
/** /**
* ci13xxx_stop: unregister a gadget driver * ci_udc_stop: unregister a gadget driver
*/ */
static int ci13xxx_stop(struct usb_gadget *gadget, static int ci_udc_stop(struct usb_gadget *gadget,
struct usb_gadget_driver *driver) struct usb_gadget_driver *driver)
{ {
struct ci13xxx *ci = container_of(gadget, struct ci13xxx, gadget); struct ci_hdrc *ci = container_of(gadget, struct ci_hdrc, gadget);
unsigned long flags; unsigned long flags;
spin_lock_irqsave(&ci->lock, flags); spin_lock_irqsave(&ci->lock, flags);
if (!(ci->platdata->flags & CI13XXX_PULLUP_ON_VBUS) || if (!(ci->platdata->flags & CI_HDRC_PULLUP_ON_VBUS) ||
ci->vbus_active) { ci->vbus_active) {
hw_device_state(ci, 0); hw_device_state(ci, 0);
if (ci->platdata->notify_event) if (ci->platdata->notify_event)
ci->platdata->notify_event(ci, ci->platdata->notify_event(ci,
CI13XXX_CONTROLLER_STOPPED_EVENT); CI_HDRC_CONTROLLER_STOPPED_EVENT);
ci->driver = NULL; ci->driver = NULL;
spin_unlock_irqrestore(&ci->lock, flags); spin_unlock_irqrestore(&ci->lock, flags);
_gadget_stop_activity(&ci->gadget); _gadget_stop_activity(&ci->gadget);
...@@ -1688,7 +1687,7 @@ static int ci13xxx_stop(struct usb_gadget *gadget, ...@@ -1688,7 +1687,7 @@ static int ci13xxx_stop(struct usb_gadget *gadget,
* This function returns IRQ_HANDLED if the IRQ has been handled * This function returns IRQ_HANDLED if the IRQ has been handled
* It locks access to registers * It locks access to registers
*/ */
static irqreturn_t udc_irq(struct ci13xxx *ci) static irqreturn_t udc_irq(struct ci_hdrc *ci)
{ {
irqreturn_t retval; irqreturn_t retval;
u32 intr; u32 intr;
...@@ -1698,7 +1697,7 @@ static irqreturn_t udc_irq(struct ci13xxx *ci) ...@@ -1698,7 +1697,7 @@ static irqreturn_t udc_irq(struct ci13xxx *ci)
spin_lock(&ci->lock); spin_lock(&ci->lock);
if (ci->platdata->flags & CI13XXX_REGS_SHARED) { if (ci->platdata->flags & CI_HDRC_REGS_SHARED) {
if (hw_read(ci, OP_USBMODE, USBMODE_CM) != if (hw_read(ci, OP_USBMODE, USBMODE_CM) !=
USBMODE_CM_DC) { USBMODE_CM_DC) {
spin_unlock(&ci->lock); spin_unlock(&ci->lock);
...@@ -1748,7 +1747,7 @@ static irqreturn_t udc_irq(struct ci13xxx *ci) ...@@ -1748,7 +1747,7 @@ static irqreturn_t udc_irq(struct ci13xxx *ci)
* udc_start: initialize gadget role * udc_start: initialize gadget role
* @ci: chipidea controller * @ci: chipidea controller
*/ */
static int udc_start(struct ci13xxx *ci) static int udc_start(struct ci_hdrc *ci)
{ {
struct device *dev = ci->dev; struct device *dev = ci->dev;
int retval = 0; int retval = 0;
...@@ -1764,15 +1763,15 @@ static int udc_start(struct ci13xxx *ci) ...@@ -1764,15 +1763,15 @@ static int udc_start(struct ci13xxx *ci)
INIT_LIST_HEAD(&ci->gadget.ep_list); INIT_LIST_HEAD(&ci->gadget.ep_list);
/* alloc resources */ /* alloc resources */
ci->qh_pool = dma_pool_create("ci13xxx_qh", dev, ci->qh_pool = dma_pool_create("ci_hw_qh", dev,
sizeof(struct ci13xxx_qh), sizeof(struct ci_hw_qh),
64, CI13XXX_PAGE_SIZE); 64, CI_HDRC_PAGE_SIZE);
if (ci->qh_pool == NULL) if (ci->qh_pool == NULL)
return -ENOMEM; return -ENOMEM;
ci->td_pool = dma_pool_create("ci13xxx_td", dev, ci->td_pool = dma_pool_create("ci_hw_td", dev,
sizeof(struct ci13xxx_td), sizeof(struct ci_hw_td),
64, CI13XXX_PAGE_SIZE); 64, CI_HDRC_PAGE_SIZE);
if (ci->td_pool == NULL) { if (ci->td_pool == NULL) {
retval = -ENOMEM; retval = -ENOMEM;
goto free_qh_pool; goto free_qh_pool;
...@@ -1790,14 +1789,14 @@ static int udc_start(struct ci13xxx *ci) ...@@ -1790,14 +1789,14 @@ static int udc_start(struct ci13xxx *ci)
ci->transceiver = NULL; ci->transceiver = NULL;
} }
if (ci->platdata->flags & CI13XXX_REQUIRE_TRANSCEIVER) { if (ci->platdata->flags & CI_HDRC_REQUIRE_TRANSCEIVER) {
if (ci->transceiver == NULL) { if (ci->transceiver == NULL) {
retval = -ENODEV; retval = -ENODEV;
goto destroy_eps; goto destroy_eps;
} }
} }
if (!(ci->platdata->flags & CI13XXX_REGS_SHARED)) { if (!(ci->platdata->flags & CI_HDRC_REGS_SHARED)) {
retval = hw_device_reset(ci, USBMODE_CM_DC); retval = hw_device_reset(ci, USBMODE_CM_DC);
if (retval) if (retval)
goto put_transceiver; goto put_transceiver;
...@@ -1844,7 +1843,7 @@ static int udc_start(struct ci13xxx *ci) ...@@ -1844,7 +1843,7 @@ static int udc_start(struct ci13xxx *ci)
* *
* No interrupts active, the IRQ has been released * No interrupts active, the IRQ has been released
*/ */
static void udc_stop(struct ci13xxx *ci) static void udc_stop(struct ci_hdrc *ci)
{ {
if (ci == NULL) if (ci == NULL)
return; return;
...@@ -1871,7 +1870,7 @@ static void udc_stop(struct ci13xxx *ci) ...@@ -1871,7 +1870,7 @@ static void udc_stop(struct ci13xxx *ci)
* *
* This function enables the gadget role, if the device is "device capable". * This function enables the gadget role, if the device is "device capable".
*/ */
int ci_hdrc_gadget_init(struct ci13xxx *ci) int ci_hdrc_gadget_init(struct ci_hdrc *ci)
{ {
struct ci_role_driver *rdrv; struct ci_role_driver *rdrv;
......
...@@ -20,7 +20,7 @@ ...@@ -20,7 +20,7 @@
#define TX 1 /* similar to USB_DIR_IN but can be used as an index */ #define TX 1 /* similar to USB_DIR_IN but can be used as an index */
/* DMA layout of transfer descriptors */ /* DMA layout of transfer descriptors */
struct ci13xxx_td { struct ci_hw_td {
/* 0 */ /* 0 */
u32 next; u32 next;
#define TD_TERMINATE BIT(0) #define TD_TERMINATE BIT(0)
...@@ -43,7 +43,7 @@ struct ci13xxx_td { ...@@ -43,7 +43,7 @@ struct ci13xxx_td {
} __attribute__ ((packed, aligned(4))); } __attribute__ ((packed, aligned(4)));
/* DMA layout of queue heads */ /* DMA layout of queue heads */
struct ci13xxx_qh { struct ci_hw_qh {
/* 0 */ /* 0 */
u32 cap; u32 cap;
#define QH_IOS BIT(15) #define QH_IOS BIT(15)
...@@ -54,7 +54,7 @@ struct ci13xxx_qh { ...@@ -54,7 +54,7 @@ struct ci13xxx_qh {
/* 1 */ /* 1 */
u32 curr; u32 curr;
/* 2 - 8 */ /* 2 - 8 */
struct ci13xxx_td td; struct ci_hw_td td;
/* 9 */ /* 9 */
u32 RESERVED; u32 RESERVED;
struct usb_ctrlrequest setup; struct usb_ctrlrequest setup;
...@@ -63,11 +63,11 @@ struct ci13xxx_qh { ...@@ -63,11 +63,11 @@ struct ci13xxx_qh {
struct td_node { struct td_node {
struct list_head td; struct list_head td;
dma_addr_t dma; dma_addr_t dma;
struct ci13xxx_td *ptr; struct ci_hw_td *ptr;
}; };
/** /**
* struct ci13xxx_req - usb request representation * struct ci_hw_req - usb request representation
* @req: request structure for gadget drivers * @req: request structure for gadget drivers
* @queue: link to QH list * @queue: link to QH list
* @ptr: transfer descriptor for this request * @ptr: transfer descriptor for this request
...@@ -75,7 +75,7 @@ struct td_node { ...@@ -75,7 +75,7 @@ struct td_node {
* @zptr: transfer descriptor for the zero packet * @zptr: transfer descriptor for the zero packet
* @zdma: dma address of the zero packet's transfer descriptor * @zdma: dma address of the zero packet's transfer descriptor
*/ */
struct ci13xxx_req { struct ci_hw_req {
struct usb_request req; struct usb_request req;
struct list_head queue; struct list_head queue;
struct list_head tds; struct list_head tds;
...@@ -83,11 +83,11 @@ struct ci13xxx_req { ...@@ -83,11 +83,11 @@ struct ci13xxx_req {
#ifdef CONFIG_USB_CHIPIDEA_UDC #ifdef CONFIG_USB_CHIPIDEA_UDC
int ci_hdrc_gadget_init(struct ci13xxx *ci); int ci_hdrc_gadget_init(struct ci_hdrc *ci);
#else #else
static inline int ci_hdrc_gadget_init(struct ci13xxx *ci) static inline int ci_hdrc_gadget_init(struct ci_hdrc *ci)
{ {
return -ENXIO; return -ENXIO;
} }
......
...@@ -16,7 +16,7 @@ ...@@ -16,7 +16,7 @@
#include <linux/io.h> #include <linux/io.h>
#include <linux/delay.h> #include <linux/delay.h>
#include "ci13xxx_imx.h" #include "ci_hdrc_imx.h"
#define USB_DEV_MAX 4 #define USB_DEV_MAX 4
......
...@@ -7,8 +7,8 @@ ...@@ -7,8 +7,8 @@
#include <linux/usb/otg.h> #include <linux/usb/otg.h>
struct ci13xxx; struct ci_hdrc;
struct ci13xxx_platform_data { struct ci_hdrc_platform_data {
const char *name; const char *name;
/* offset of the capability registers */ /* offset of the capability registers */
uintptr_t capoffset; uintptr_t capoffset;
...@@ -16,24 +16,24 @@ struct ci13xxx_platform_data { ...@@ -16,24 +16,24 @@ struct ci13xxx_platform_data {
struct usb_phy *phy; struct usb_phy *phy;
enum usb_phy_interface phy_mode; enum usb_phy_interface phy_mode;
unsigned long flags; unsigned long flags;
#define CI13XXX_REGS_SHARED BIT(0) #define CI_HDRC_REGS_SHARED BIT(0)
#define CI13XXX_REQUIRE_TRANSCEIVER BIT(1) #define CI_HDRC_REQUIRE_TRANSCEIVER BIT(1)
#define CI13XXX_PULLUP_ON_VBUS BIT(2) #define CI_HDRC_PULLUP_ON_VBUS BIT(2)
#define CI13XXX_DISABLE_STREAMING BIT(3) #define CI_HDRC_DISABLE_STREAMING BIT(3)
enum usb_dr_mode dr_mode; enum usb_dr_mode dr_mode;
#define CI13XXX_CONTROLLER_RESET_EVENT 0 #define CI_HDRC_CONTROLLER_RESET_EVENT 0
#define CI13XXX_CONTROLLER_STOPPED_EVENT 1 #define CI_HDRC_CONTROLLER_STOPPED_EVENT 1
void (*notify_event) (struct ci13xxx *ci, unsigned event); void (*notify_event) (struct ci_hdrc *ci, unsigned event);
}; };
/* Default offset of capability registers */ /* Default offset of capability registers */
#define DEF_CAPOFFSET 0x100 #define DEF_CAPOFFSET 0x100
/* Add ci13xxx device */ /* Add ci hdrc device */
struct platform_device *ci13xxx_add_device(struct device *dev, struct platform_device *ci_hdrc_add_device(struct device *dev,
struct resource *res, int nres, struct resource *res, int nres,
struct ci13xxx_platform_data *platdata); struct ci_hdrc_platform_data *platdata);
/* Remove ci13xxx device */ /* Remove ci hdrc device */
void ci13xxx_remove_device(struct platform_device *pdev); void ci_hdrc_remove_device(struct platform_device *pdev);
#endif #endif
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