# Patent

## Title
Clock control circuit for controlling an oscillation circuit in a data transfer control device according to states of a first device and a second device

## Abstract

An oscillation circuit generates a reference clock signal for a clock signal supplied to each section of a data transfer control device. In a clock output control circuit, a clock command is decoded by a clock command decoder and oscillation of the oscillation circuit is controlled. The data transfer control device including a clock control circuit transfers data as a host or a peripheral in a state being set to either a self-powered first device or a second device which can operate by using a power supply on a bus. The oscillation operation of the oscillation circuit is suspended in an idle state of the second device.

## Background
Japanese Patent Application No. 2002-126763 filed on Apr. 26, 2002, is hereby incorporated by reference in its entirety.
BACKGROUND OF THE INVENTION
The present invention relates to a clock control circuit, a data transfer control device, and electronic equipment.
In recent years, the USB (Universal Serial Bus) standard has attracted attention as an interface standard for connecting a personal computer with a peripheral device (electronic equipment in a broad sense). However, data transfer according to the USB standard cannot be performed between peripheral devices without an intermediate host. Therefore, the “USB On-The-Go (OTG) 1.0” standard hereinafter abbreviated as “OTG standard”) has been provided as a supplemental standard to the USB 2.0 standard, and has enabled data transfer according to the USB standard to be performed between peripheral devices.
In the OTG standard, a peripheral which operates as a device in the USB standard is allowed to have a host function necessary for operating as a host. This enables peripheral devices, which are devices in the conventional USB standard, to be connected, whereby data can be transferred without an intermediate host in the conventional USB standard.
BRIEF SUMMARY OF THE INVENTION
According to one aspect of the present invention, there is provided a clock control circuit of a data transfer control device having a state controller which controls switching between states of a host and a peripheral on the basis of state transition of a first device which operates as a host in a default state or state transition of a second device which operates as a peripheral in a default state, the clock control circuit comprising:
an oscillation circuit which generates a reference clock signal for a clock signal supplied to each section of the data transfer control device, and
a clock output control circuit which generates an output control signal which controls an oscillation operation of the oscillation circuit,
wherein the clock output control circuit performs oscillation control to suspend the oscillation operation of the oscillation circuit based on the output control signal in an idle state of the second device.
According to another aspect of the present invention, there is provided a clock control circuit of a data transfer control device having a state controller which controls switching between states of a host and a peripheral on the basis of state transition of a first device which operates as a host in a default state or state transition of a second device which operates as a peripheral in a default state, the clock control circuit comprising:
an oscillation circuit which generates a reference clock signal for a clock signal supplied to each section of the data transfer control device, and
a clock output control circuit which generates an output control signal which controls an oscillation output of the oscillation circuit,
wherein the clock output control circuit performs oscillation control to suspend an oscillation operation of the oscillation circuit based on the output control signal when data transfer from a connection partner is suspended in the state transition of the second device operating as a peripheral, and omits the oscillation control of the oscillation circuit in a suspend state of the first device.
According to further aspect of the present invention, there is provided a clock control circuit of a data transfer control device having a state controller which controls switching between states according to the USB (Universal Serial Bus) OTG (On-The-Go) standard, the clock control circuit comprising:
an oscillation circuit which generates a reference clock signal for a clock signal supplied to each section of the data transfer control device, and
a clock output control circuit which generates output control signal which controls an oscillation output of the oscillation circuit,
wherein the clock output control circuit performs oscillation control to suspend the oscillation operation of the oscillation circuit based on the output control signal in an idle state of a B-device.
According to still another aspect of the present invention, there is provided a clock control circuit of a data transfer control device having a state controller which controls switching between states according to the USB (Universal Serial Bus) OTG (On-The-Go) standard, the clock control circuit comprising:
an oscillation circuit which generates a reference clock signal for clock signal supplied to each section of the data transfer control device, and
a clock output control circuit which generates output control signal which controls an oscillation operation of the oscillation circuit,
wherein the clock output control circuit performs oscillation control to suspend an oscillation operation of the oscillation circuit based on the output control signal when data transfer from a connection partner is suspended when the data transfer control device operates as a peripheral of a B-device, and
wherein the clock output control circuit omits the oscillation control of the oscillation circuit when the data transfer control device is in a suspend state of an A-device.



BRIEF DESCRIPTION OF THE SEVERAL VIEWS OF THE DRAWING
FIG. 1A is a schematic view showing an outline of a USB cable having a Mini-A plug and a Mini-B plug on opposite ends; FIG. 1B is a view illustrating an A-device and a B-device; and FIG. 1C is a view showing a terminal table.
FIG. 2 is a view schematically showing an example of dual-role devices to which a USB cable is connected.
FIG. 3 is a view illustrating SRP.
FIG. 4 is a view illustrating HNP.
FIG. 5 is a view illustrating state transition of an A-device.
FIG. 6 is a view illustrating state transition of a B-device.
FIG. 7 is a functional block diagram of an OTG device controller IC.
FIG. 8 is a flowchart showing an example of state transition performed by an HC when an OTG device controller IC is an A-device.
FIG. 9 is a flowchart showing an example of state transition performed by an HC when an OTG device controller IC is a B-device.
FIG. 10 is a timing chart showing an example of HNP operation timing by an OTG device controller IC.
FIG. 11 is a block diagram showing an outline of a configuration of a clock control circuit.
FIG. 12 is a view illustrating a clock signal supplied for every circuit block.
FIG. 13 is a view showing an example of a clock control pattern.
FIG. 14 is a circuit diagram showing a detailed configuration example of a clock controller.
FIG. 15 is a timing chart showing an example of operation timing of clock signal supply control when transitioning from a default state after reset to an idle state of a B-device.
FIG. 16 is a timing chart showing an example of operation timing of clock signal supply control when suspending output of a PLL circuit in a test state.
FIG. 17 is a sequence diagram showing a first half of an example of data transfer control using an OTG device controller IC 200.
FIG. 18 is a sequence diagram showing the latter half of an example of data transfer control using an OTG device controller IC 200.
FIG. 19 is a circuit diagram showing another detailed configuration example of a clock controller.
FIG. 20 is an explanatory diagram showing an example of a register map of a clock monitor register, clock control register, and clock command register.
FIG. 21 is a timing chart showing an example of operation timing of clock signal supply control when transitioning from a default state after reset to an idle state of a B-device.
FIG. 22 is a timing chart showing an example of operation timing of clock signal supply control when suspending output of a PLL circuit in a test state.
FIG. 23 is a sequence diagram showing an example of data transfer control of an OTG device controller IC to which the clock controller shown in FIG. 19 is applied.
FIG. 24 is a timing chart showing an example of oscillation control timing of an oscillation circuit when transitioning from an idle state of a B-device to a peripheral state of the B-device.
FIG. 25 is a timing chart showing an example of oscillation control timing of an oscillation circuit when transitioning from a suspend state of an A-device to a host state of the A-device.
FIG. 26 is a timing chart showing an example of oscillation control timing of an oscillation circuit when transitioning from a PLL suspend state to a test state.
FIGS. 27A, 27B, and 27C show examples of internal block diagrams of various types of electronic equipment.
FIGS. 28A, 28B, and 28C show examples of external views of various types of electronic equipment.



DETAILED DESCRIPTION OF THE EMBODIMENT
Embodiments of the present invention are described below. However, the embodiments described below should not be construed as limiting the scope of the present invention described in the claims. The entire configuration described below is not necessarily indispensable for the present invention.
A dual-role device is defined by the OTG standard. The dual-role device can operate as either a host or a peripheral. The dual-role device is controlled by state transition defined in the OTG standard, for example. Therefore, a number of states are defined in the OTG standard, and it is necessary to control generation or detection of the signal state corresponding to each of the states.
However, since functional blocks to be used differ depending on the state, power consumption increases if an oscillation circuit is operated even in the case where functional blocks are not used at all. Therefore, it is desirable to reduce power consumption by controlling clock signal supply in a given block unit and controlling the oscillation circuit for generating a reference clock signal for a clock signal supplied to each block in each of the states. However, if clock signal supply and oscillation are controlled while distinguishing a functional block to be used in a state after transition from a functional block not to be used in the state, processing becomes complicated since there are a number of states.
According to the following embodiments, a clock control circuit, a data transfer control device, and electronic equipment capable of reducing power consumption by simplifying oscillation control and clock signal supply control can be provided.
According to one embodiment of the present invention, there is provided a clock control circuit of a data transfer control device having a state controller which controls switching between states of a host and a peripheral on the basis of state transition of a first device which operates as a host in a default state or state transition of a second device which operates as a peripheral in a default state, the clock control circuit comprising:
an oscillation circuit which generates a reference clock signal for a clock signal supplied to each section of the data transfer control device, and
a clock output control circuit which generates an output control signal which controls an oscillation operation of the oscillation circuit,
wherein the clock output control circuit performs oscillation control to suspend the oscillation operation of the oscillation circuit based on the output control signal in an idle state of the second device.
The first device may be referred to as a device which operates as a host in a default state. The first device may also be referred to as a device which transfers data by using its own power supply (self power supply) without using a power supply from a partner for data transfer. The second device may be referred to as a device which operates as a peripheral in a default state. The second device may also be referred to as a device which transfers data by using its own power supply or a power supply from a partner for data transfer (bus power supply). For example, the data transfer control device may be set to either the first device or the second device before transferring data.
A host refers to a function of a device having the initiative for data transfer control. A peripheral refers to a function of a device which does not have the initiative for data transfer control and follows instructions from the host.
In this embodiment, oscillation of the oscillation circuit is controlled in the data transfer control device including the state controller which controls switching between the host state and the peripheral state by state transition of the first device or the second device. Since the first device controls data transfer as the host, it is desirable to generate a reference clock signal for a clock signal supplied to each section even in an idle state. Since the second device operates as the peripheral in the default state, the second device cannot transfer data in an idle state unless there are instructions from the host, and power is consumed unnecessarily. Therefore, unnecessary power consumption can be efficiently reduced by suspending the oscillation operation of the oscillation circuit in the idle state of the second device while performing necessary data transfer control.
According to another embodiment of the present invention, there is provided a clock control circuit of a data transfer control device having a state controller which controls switching between states of a host and a peripheral on the basis of state transition of a first device which operates as a host in a default state or state transition of a second device which operates as a peripheral in a default state, the clock control circuit comprising:
an oscillation circuit which generates a reference clock signal for a clock signal supplied to each section of the data transfer control device, and
a clock output control circuit which generates an output control signal which controls an oscillation output of the oscillation circuit,
wherein the clock output control circuit performs oscillation control to suspend an oscillation operation of the oscillation circuit based on the output control signal when data transfer from a connection partner is suspended in the state transition of the second device operating as a peripheral, and omits the oscillation control of the oscillation circuit in a suspend state of the first device.
In this embodiment, since the second device cannot control data transfer unless there are instructions from the connection partner when the second device is operating as the peripheral and when data transfer from the connection partner is suspended, an unnecessary oscillation operation can be suspended. Since the first device must control switching between the states as the host in the suspend state, oscillation of the oscillation circuit which generates the reference clock signal for the clock signal supplied to the state controller is not controlled. This enables switching between the host state and the peripheral state to be controlled while reducing unnecessary power consumption.
This clock control circuit may comprise an activation circuit which activates the oscillation circuit based on a resume trigger signal generated based on a line state which is a state of a data signal line connected with a connection partner when data transfer from the connection partner is suspended in the state transition of the first device operating as a peripheral.
The first device cannot control data transfer in the peripheral state when data transfer from the connection partner is suspended unless there are instructions from the host. In this case, the oscillation circuit can be activated based on the trigger signal input by the hardware even if a time limit for state transition based on the change in the line state is severe. This enables oscillation to be controlled by the hardware at a timing at which the time limit is severe while controlling oscillation by the firmware, whereby it is possible to deal with various data transfer controls by making state transition control flexible.
In this clock control circuit, the clock output control circuit may include:
a clock command register in which a clock command corresponding to a clock control pattern is set, the clock control pattern indicating whether or not to perform the oscillation control of the oscillation circuit, and
a clock monitor register for monitoring contents in the clock command register,
wherein the clock command register may be set by using the resume trigger signal or a clock command generated corresponding to state transition of the first device or the second device, and
wherein the output control signal may be generated by using contents in the clock command register.
According to this embodiment, since oscillation is controlled by using a simple circuit using the clock control pattern, it is unnecessary to perform processing of determining whether or not to control oscillation after state transition, whereby the processing can be simplified.
In this clock control circuit, the clock output control circuit may suspend outputting the clock signal supplied to the state controller or may perform output control to reduce frequency of the clock signal supplied to the state controller based on the output control signal in an idle state of the second device, the clock signal being generated by using an oscillation output of the oscillation circuit.
In this embodiment, since the first device controls data transfer as the host, it is desirable to supply a clock signal to the state controller even in the idle state. Since the second device operates as the peripheral in the default state, the second device cannot transfer data in the idle state unless there are instructions from the host, and power is consumed unnecessarily. Therefore, unnecessary power consumption can be reduced by suspending output of the clock signal supplied to the state controller or by reducing the frequency of the clock signal supplied to the state controller in the idle state of the second device.
In this clock control circuit, the clock output control circuit may suspend outputting one of the clock signal supplied to the state controller or may perform output control to reduce frequency of the clock signal supplied to the state controller based on the output control signal in the state transition of the second device operating as a peripheral, the clock signal being generated by using an oscillation output of the oscillation circuit, and
wherein the clock output control circuit may omit output control of the clock signal supplied to the state controller in a suspend state of the first device.
According to this embodiment, since the second device cannot control data transfer unless there are instructions from the connection partner when data transfer from the connection partner is suspended when the second device is operating as the peripheral, unnecessary operation of the state controller can be stopped. The first device must control switching between the states as the host in the suspend state of the first device. Therefore, switching between the host state and the peripheral state can be controlled while reducing unnecessary power consumption.
In this clock control circuit, the first device may be an A-device of the USB (Universal Serial Bus) OTG (On-The-Go) standard,
wherein the second device may be a B-device of the USB OTG standard, and
wherein the state controller may control switching between states of a host and a peripheral according to the USB OTG standard.
According to this embodiment, power consumption accompanied by USB transfer using portable equipment according to the USB OTG standard can be reduced by simple processing.
According to further embodiment of the present invention, there is provided a clock control circuit of a data transfer control device having a state controller which controls switching between states according to the USB (Universal Serial Bus) OTG (On-The-Go) standard, the clock control circuit comprising:
an oscillation circuit which generates a reference clock signal for a clock signal supplied to each section of the data transfer control device, and
a clock output control circuit which generates output control signal which controls an oscillation output of the oscillation circuit,
wherein the clock output control circuit performs oscillation control to suspend the oscillation operation of the oscillation circuit based on the output control signal in an idle state of a B-device.
According to still another embodiment of the present invention, there is provided a clock control circuit of a data transfer control device having a state controller which controls switching between states according to the USB (Universal Serial Bus) OTG (On-The-Go) standard, the clock control circuit comprising:
an oscillation circuit which generates a reference clock signal for clock signal supplied to each section of the data transfer control device, and
a clock output control circuit which generates output control signal which controls an oscillation operation of the oscillation circuit,
wherein the clock output control circuit performs oscillation control to suspend an oscillation operation of the oscillation circuit based on the output control signal when data transfer from a connection partner is suspended when the data transfer control device operates as a peripheral of a B-device, and
wherein the clock output control circuit omits the oscillation control of the oscillation circuit when the data transfer control device is in a suspend state of an A-device.
The state controller may control switching between states according to a standard developed from the USB OTG standard.
A data transfer control device according to still further embodiment of the present invention comprises:
any one of the above clock control circuits,
a state controller which controls switching between states of a host and a peripheral,
a host controller which controls an operation as a host, and
a peripheral controller which controls an operation as a peripheral.
According to this embodiment, a data transfer control device capable of simplifying processing and reducing power consumption can be provided.
Electronic equipment according to the above embodiments comprises the above data transfer control device, and
a device which performs output processing, fetch processing, or storage processing of data transferred through the data transfer control device and a bus.
According to this embodiment, electronic equipment including a data transfer control device capable of simplifying processing and reducing power consumption can be provided.
The embodiments of the present invention are described below in detail with reference to the drawings.
1. OTG (On-The-Go) Standard
1.1 A-device and B-device
The OTG standard is briefly described below.
The USB (Universal Serial Bus) standard is a standard for transferring data between a host (personal computer, for example) and one or more peripherals (peripheral devices, for example). Data transfer is controlled by the host. The amount of data processed in portable equipment and the like which are peripherals in the USB standard has been increased. Therefore, a demand for transferring data according to the USB standard without an intermediate host while consuming only a small amount of power has been increased.
In view of such a situation, the OTG standard has been provided as a supplemental standard to the USB 2.0 standard. In the OTG standard, small-sized connectors, a dual-role device which allows a peripheral to have a host function necessary for operating as a host, and the like are newly standardized.
In the case of transferring data according to the OTG standard, a host is connected with a peripheral by a USB cable to which a Mini-A plug and a Mini-B plug are provided on opposite ends, as shown in FIG. 1A. The Mini-A plug has a structure which allows insertion into a Mini-A receptacle or a Mini-AB receptacle. The Mini-B plug has a structure which allows insertion into a Mini-B receptacle or a Mini-AB receptacle. A dual-role device must be equipped with a Mini-AB receptacle.
In the USB standard, a host can be connected with a peripheral only by using VBUS (power supply), GND (ground), and two data signal lines (D+ and D−). VBUS is supplied from the host. The data signal lines D+ and D− are used as differential signal lines.
In the OTG standard, a dual-role device to which a Mini-A plug is connected becomes an A-device, as shown in FIG. 1B. The A-device operates as the host at the start of a session and is capable of transferring the host function to a B-device under given conditions. A dual-role device to which a Mini-B plug is connected becomes a B-device. The B-device operates as the peripheral at the start of a session and is allowed to operate as the host by the A-device. The A-device supplies VBUS.
In the dual-role device, an ID terminal is defined in addition to the conventional terminals (VBUS, D−, D+, and GND) of the connector in order to detect the type of plug inserted into the Mini-AB receptacle, as shown in FIG. 1C. The ID terminal is connected with GND in the Mini-A plug and the ID terminal is in an open state in the Mini-B plug.
FIG. 2 schematically shows an example of dual-role devices to which a USB cable is connected.
A dual-role device 10 to which a Mini-A plug is connected and a dual-role device 20 to which a Mini-B plug is connected are connected through a USB cable. The dual-role devices 10 and 20 include ID detection circuits 12 and 22, respectively. Each of the ID detection circuits 12 and 22 pulls up a signal line electrically connected with the ID terminal and detects whether or not the ID terminal is grounded depending on the voltage of the signal line. The ID detection circuit 12 shown in FIG. 2 detects a Mini-A plug since the signal line connected with the ID terminal is grounded. The ID detection circuit 22 detects a Mini-B plug since the signal line connected with the ID terminal is pulled up.
The dual-role device 10 includes a pull-up resistor R1 for pulling up the data signal line D+ and a pull-down resistor R2 for pulling down the data signal line D+ in order to operate as either the host or the peripheral. The pull-up resistor R1 is connected with a power supply voltage line through a switch circuit SW1 for turning the pull-up on/off. The pull-down resistor R2 is connected with a ground line through a switch circuit SW2 for turning the pull-down on/off. The switch circuits SW1 and SW2 are controlled exclusively so that one of the switch circuits SW1 and SW2 is turned off when the other is turned on.
The dual-role device 20 includes a pull-up resistor R3 for pulling up the data signal line D+ and a pull-down resistor R4 for pulling down the data signal line D+. The pull-up resistor R3 is connected with a power supply voltage line through a switch circuit SW3 for turning the pull-up on/off. The pull-down resistor R4 is connected with a ground line through a switch circuit SW4 for turning the pull-down on/off. The switch circuits SW3 and SW4 are controlled exclusively so that one of the switch circuits SW3 and SW4 is turned off when the other is turned on.
In the dual-role devices 10 and 20, the data signal line D− is pulled low.
Since both the dual-role devices 10 and 20 can become the A-device, the dual-role devices 10 and 20 respectively include power supply control circuits VBA and VBB which supply current to VBUS. In FIG. 2, the dual-role device 10 supplies current to VBUS by the power supply control circuit VBA.
1.2 SRP (Session Request Protocol)
In the OTG standard, the A-device can suspend supply of current to VBUS when there is no bus activity. Therefore, unnecessary power consumption can be reduced if battery-powered portable equipment operates as the host, whereby power consumption can be reduced. In the case where the B-device starts a session in this state and transfers data, the B-device can request the A-device to supply current to VBUS according to the procedure called SRP. The session used herein refers to a period in which the voltage of VBUS is above a given threshold voltage.
FIG. 3 is a view illustrating the procedure for SRP in the FS (Full Speed) mode with reference to the configuration of the dual-role devices shown in FIG. 2.
In the FS mode, the data signal line D+ is pulled down in the host (switch circuit SW1 is turned off and switch circuit SW2 is turned on), and the data signal line D+ is pulled up in the peripheral (switch circuit SW3 is turned on and switch circuit SW4 is turned off).
When there is no bus activity and the A-device suspends supply of current to VBUS (S10), the voltage of VBUS drops below a “Vb_sess_vld” (B-DeviceSession Valid) level (S11). When the B-device detects that the voltage of VBUS drops below the “Vb_sess_vld” level, the B-device disables the pull-up resistor of the data signal line D+ by the switch circuit SW3 (S12). This allows the line state of the data signal lines to be in an “SE0” state (data signal line D+ is at “L” level and data signal line D− is at “L” level in the FS mode) (S13).
If the voltage of VBUS is lower than “Vb_sess_end” (B-Device Session End) and the “SE0” state continues for 2 ms or more, the B-device can initiate SRP. SRP can be performed by data line pulsing or VBUS pulsing. The data line pulsing is a method which causes the line state to transition to the “SE0” state, a “J” state (data signal line D+ is at “H” level and data signal line D− is at “L” level in the FS mode), and the “SE0” state in that order. The VBUS pulsing is a method which causes the voltage of VBUS to transition to an “L” level (less than Vb_sess_vld), an “H” level (higher than Va_sess_vld), and the “L” level in that order by allowing the B-device to supply current to VBUS (S14 and S15).
When the A-device detects that SRP is performed by either method by monitoring the voltages of the data signal lines or VBUS, the A-device starts supplying current to VBUS (S16). This allows the voltage of VBUS to be equal to or above “Vb_sess_vld” (S17).
When the B-device detects that the voltage of VBUS is equal to or above “Vb_sess_end”, the B-device enables the pull-up resistor of the data signal line D+ by the switch circuit SW3 (S18) to allow the line state to transition to the “J” state (S19), and starts to operate as the peripheral.
When the A-device detects that the line state is in the “J” state, the A-device starts to operate as the host (S20).
1.3 HNP (Host Negotiation Protocol)
In the OTG standard, a dual-role device becomes either the A-device or the B-device depending on the plug connected thereto. However, the host function and the peripheral function can be exchanged without plugging or unplugging. HNP is a procedure for exchanging the host function and the peripheral function.
FIG. 4 is a view illustrating the procedure for HNP in the FS mode with reference to the configuration of the dual-role devices shown in FIG. 2.
The following description is given on the assumption that the A-device operates as the host, the B-device operates as the peripheral, and HNP is enabled.
When the A-device finishes using the bus (S30), the A-device puts the line state in an idle state (“J” state in the FS mode) (S31).
When the B-device detects that the “J” state continues for 3 ms or more, the B-device disables the pull-up resistor of the data signal line D+ by the switch circuit SW3 (S32) to allow the line state to be in the “SE0” state (S33). When the A-device detects that the line state is in the “SE0” state, the A-device enables the pull-up resistor (disables the pull-down resistor) of the data signal line D+ by the switch circuit SW1 (S34). This allows the line state to be in the “J” state (S35), whereby the A-device starts to operate as the peripheral. The B-device detects that the line state is in the “J” state and starts to operate as the host (S36).
When the B-device as the host finishes using the bus (S37), the B-device allows the line state to be in the idle state by the switch circuits SW3 and SW4 (S38). The A-device detects that the line state is in the idle state and disables the pull-up resistor of the data signal line D+ (S39) to allow the line state to transition to the “SE0” state (S40). When the B-device detects that the line state is in the “SE0” state, the B-device enables the pull-up resistor (disables the pull-down resistor) of the data signal line D+ by the switch circuit SW3 (S41). This allows the line state to be in the “J” state (S42), whereby the B-device starts to operate as the peripheral. The A-device detects that the line state is in the “J” state and starts to operate as the host (S43).
Data transfer control by using such a protocol can be realized by allowing the A-device and the B-device to transition between states which specify each state according to a transition condition.
The state transition of the A-device and the B-device is described below.
1.4 State Transition of A-device
FIG. 5 is a view illustrating state transition of the A-device.
The a_idle state is the start state for the A-device (ST1).
If a Mini-A plug of the USB cable is not inserted into the Mini-AB receptacle of the dual-role device, the pulled-up ID terminal is at the “H” level (id), whereby the dual-role device transitions to the b_idle state (ST2). Specifically, the dual-role device defaults to a B-device. If a Mini-A plug is inserted, the ID terminal is at the “L” level (id/), whereby the dual-role device transitions to the a_idle state (ST1).
Supply of current to VBUS is suspended in the a_idle state. The pull-up of the data signal line D+ is disabled (turned off) (pull-down is enabled; in more detail, switch circuit SW1 is turned off and switch circuit SW2 is turned on). Therefore, the line state is in the “SE0” state. If the host application does not request dropping the voltage of VBUS (a_bus_drop/), and if the A-device wants to perform USB transfer (a_bus_req) or detects SRP from the B-device (a_srp_det), the A-device transitions to the a_wait_vrise state (ST3).
In the a_wait_vrise state, current starts to be supplied to VBUS and the voltage of VBUS rises. If the Mini-A plug is removed (id), if the host application requests dropping the voltage of VBUS (a_bus_drop), if the voltage of VBUS exceeds a given threshold voltage (a_vbus_vld), or if a predetermined period of time has elapsed in the a_wait_vrise state (a_wait_vrise_tmout), the A-device transitions to the a_wait_bcon state (ST4).
In the a_wait_bcon state, the pull-up of the data signal line D+ in the A-device is in an off state. If the pull-up of the data signal line D+ is enabled (turned on) by the B-device (switch circuit SW3 is turned on and switch circuit SW4 is turned off) to allow the data signal line D+ to be at the “H” level (line state is in the “J” state) (b_conn), the A-device transitions to the a_host state (ST5). If the Mini-A plug is removed (id), if the host application requests dropping the voltage of VBUS (a_bus_drop), or if a predetermined period of time has elapsed in the a_wait_bcon state (a_wait_bcon_tmout), the A-device transitions to the a_wait_vfall state (ST6). If the voltage of VBUS drops below the given threshold voltage (a_vbus_vld/), the A-device transitions to the a_vbus_err state (ST7).
Specifically, since the dual-role device defaults to a B-device, the data signal line D+ remains pulled down in the A-device until the a_wait_bcon state. When current starts to be supplied to VBUS in the a_wait_vrise state, the pull-up of the B-device is turned on. This allows the A-device in which the data signal line D+ is pulled down to operate as the host, and the B-device in which the data signal line D+ is pulled up to operate as the peripheral.
In the a_host state, the A-device operates as the host of the USB standard. In more detail, the A-device drives the data signal lines into the “SE0” state as a bus reset signal in order to enumerate the peripheral as the host. The peripheral is reset by allowing this state to continue for a given period of time. The host transfers configuration information, assigns an address, and the like by using control transfer, and starts USB transfer. In the a_host state, if the A-device as the host finishes using the bus (a_bus_req/), or if transition to the suspend state is requested (a_suspend_req), the A-device transitions to the a_suspend state (ST8). If the Mini-A plug is removed (id), if the line state changed to the “SE0” state from the “J” state (b_conn/), or if the host application requests dropping the voltage of VBUS (a_bus_drop), the A-device transitions to the a_wait_bcon state (ST9). If the voltage of VBUS drops below the given threshold voltage (a_vbus_vld/) for some reason, the A-device transitions to the a_vbus_err state (ST10).
In the a_suspend state, issuance of SOF (Start Of Frame) packets is suspended. The B-device operates as the peripheral and remains in the b_peripheral state. If the A-device enables HNP by the B-device (a_set_b_hnp_en), and the pull-up is turned off in the B-device to put the line state in the “SE0” state (b_conn/), the A-device transitions to the a_peripheral state (ST11). If the A-device wants to use the bus (a_bus_req), or if the B-device puts the line state in the “K” state (b_bus_resume), the A-device transitions to the a_host state (ST12). If the A-device disables HNP by the B-device (a_set_b_hnp_en/), and the pull-up is turned off in the B-device to put the line state in the “SE0” state (b_conn/), the A-device transitions to the a_wait_bcon state (ST13). If the Mini-A plug is removed (id), if the host application requests dropping the voltage of VBUS (a_bus_drop), or if a predetermined period of time has elapsed in the a_suspend state (a_aidl_bdis_tmout), the A-device transitions to the a_wait_fall state (ST14). If the voltage of VBUS drops below the given threshold voltage (a_vbus_vld/) for some reason, the A-device transitions to the a_vbus_err state (ST15).
In the a_peripheral state, since the pull-up is turned on in the A-device and the pull-up is turned off in the B-device by HNP enable from the A-device as described later, the A-device becomes the peripheral and the B-device becomes the host. If the B-device finishes using the bus such as in the case where the B-device as the host finishes data transfer (b_bus_suspend), the A-device transitions to the a_wait_bcon state (ST16). In the a_wait_bcon state, the pull-up of the A-device is turned off as described above. In the a_peripheral state, if the Mini-A plug is removed (id), or if the host application requests dropping the voltage of VBUS (a_bus_drop), the A-device transitions to the a_wait_vfall state (ST17). If the voltage of VBUS drops below the given threshold voltage (a_vbus_vld/) for some reason, the A-device transitions to the a_vbus_err state (ST18).
Since an overcurrent condition occurs in the a_bus_err state, firmware requests the A-device to drop the voltage of VBUS, for example. In the a_vbus_err state, if the Mini-A plug is removed (id), or if the host application requests dropping the voltage of VBUS (a_bus_drop), the A-device transitions to the a_wait_vfall state (ST19).
In the a_wait_vfall state, supply of current to VBUS is suspended. If the Mini-A plug is removed (id), if the A-device wants to use the bus (a_bus_req), or if the pull-up in the B-device is turned off in a state in which the voltage of VBUS is below the given threshold voltage (a_sess_vld/) to allow the line state to be in the “SE0” state (b_conn/), the A-device transitions to the a_idle state (ST20).
1.5 State Transition of B-device
FIG. 6 is a view illustrating state transition of the B-device.
The b_idle state is the start state for the B-device (ST30).
In the b_idle state, supply of current to VBUS is suspended. Therefore, the voltage of VBUS is below the given threshold voltage. The pull-up of the data signal line D+ is turned off. If a Mini-A plug is inserted, since the ID terminal is at the “L” level (id/), the B-device transitions to the a_idle state (ST31). If the voltage of VBUS rises above the given threshold voltage (b_sess_vld), the B-device transitions to the b_peripheral state (ST32).
In the b_peripheral state, since the pull-up of the data signal line D+ is turned on, b_conn can be detected in the a_wait_bcon state of the A-device. In the b_peripheral state, the B-device operates as the peripheral in response to a request from the A-device. If the B-device detects that the A-device is in the a_suspend state (a_bus_suspend), the host application of the B-device requests the host operation (b_bus_req), and HNP is enabled by the A-device (b_hnp_en), the B-device transitions to the b_wait_acon state (ST33). In the b_peripheral state, if a Mini-A plug is inserted (id/), or if the voltage of VBUS drops below the given threshold voltage (b_sess_vld/), the B-device transitions to the b_idle state (ST34). As a result, the pull-up is turned off in the b_idle state, whereby the A-device transitions from the a_wait_vfall state to the a_idle state, for example.
In the b_wait_acon state, the B-device turns off the pull-up of the data signal line D+ and waits for the A-device to pull up the data signal line D+. If the pull-up of the data signal line D+ is turned on in the A-device (a_conn), the B-device transitions to the b_host state (ST35). In the b_wait_acon state, if the B-device detects that the A-device puts the line state in the “K” state (a_bus_resume), or if a predetermined period of time has elapsed in the b_wait_acon state (b_ase0_brst_tmout), the B-device transitions to the b_peripheral state (ST36). If a Mini-A plug is inserted (id/), or if the voltage of VBUS is below the given threshold voltage (b_sess_vld/), the B-device transitions to the b_idle state (ST37).
The host processing is performed in the b_host state. Specifically, the B-device resets the bus and starts generating SOF packets. The A-device responds to a request from the B-device which operates as the host. If the B-device completes data transfer as the host and finishes using the bus (b_bus_req/), or if the B-device detects that the pull-up is turned off in the A-device (a_conn/), the B-device transitions to the b_peripheral state (ST38). The A-device detects the b_peripheral state as the b_bus_suspend of the B-device, whereby the A-device transitions from the a_peripheral state to the a_wait_bcon state. As a result, the pull-up of the A-device is turned off. In the b_peripheral state, the pull-up of the B-device is turned on. In the b_host state, if a Mini-A plug is inserted (id/), or if the voltage of VBUS is below the given threshold voltage (b_sess_vld/), the B-device transitions to the b_idle state (ST39).
The B-device requests start of a session by SRP when the A-device is in the suspend state. Specifically, in the b_idle state, if the host application of the B-device requests use of the bus (b_bus_req), the voltage of VBUS is below a session end threshold voltage of the B-device (b_sess_end), and a predetermined period of time has elapsed in a state in which the line state is in the “SE0” state (b_se0_srp), the B-device transitions to the b_srp_init state (ST40).
In the b_srp_init state, the B-device requests the A-device to start a session by SRP. If the B-device completes SRP (b_srp_done), or if a Mini-A plug is inserted (id/), the B-device transitions to the b_idle state (ST41).
2. Data Transfer Control Device
An OTG device controller IC (data transfer control device in a broad sense) which controls USB data transfer by switching between the host function and the peripheral function by the above-described state transition is described below.
FIG. 7 is a functional block diagram showing an OTG device controller IC.
An OTG device controller IC 200 includes an OTG controller (state controller in a broad sense) 210, an HC 220, a PC 230, a register section 240, a packet buffer 250, a buffer controller 260, a host/peripheral switch circuit 270, a transceiver 280, a CPU interface (I/F) 290, a DMA handler 292, a clock controller (clock control circuit in a broad sense) 294, and a test module 296.
The OTG controller 210 generates a control signal corresponding to each state by state transition shown in FIGS. 5 and 6 while monitor the states of the data lines and VBUS, and controls the data lines by controlling switching between the host and the peripheral, for example.
The OTG controller 210 includes an OTG management circuit 212, an ID detection circuit 214, a VBUS detection circuit 216, and a line state detection circuit 218. The OTG management circuit 212 manages an OTG state (each state shown in FIGS. 5 and 6) for functioning as a dual-role device. In more detail, the OTG management circuit 212 generates a control signal corresponding to the OTG state set by a CPU based on an OTG state command corresponding to the OTG state set by the CPU. The ID detection circuit 214 detects the state of the ID terminal as shown in FIG. 2. The VBUS detection circuit 216 detects whether or not the state of VBUS satisfies the detection condition corresponding to the OTG state. The line state detection circuit 218 detects whether or not the line state from the transceiver 280 satisfies the detection condition corresponding to the OTG state.
An ID signal is a signal connected to the ID terminal. The ID detection circuit 214 judges either an A-device or a B-device by the ID signal.
A 1.0V level detection signal COMPIN10 is a detection signal which indicates whether or not the voltage of VBUS/2 is 1.0V or more. A 2.2V level detection signal COMPIN22 is a detection signal which indicates whether or not the voltage of VBUS/2 is 2.2V or more. The VBUS detection circuit 216 detects whether or not the state of VBUS satisfies the detection condition in a given state by referring to the 1.0V level detection signal COMPIN10 or the 2.2V level detection signal COMPIN22.
A VBUS drive signal BUSPWRSEL is an enable signal for switching current to be supplied to VBUS to either 8 mA or 500 mA when using a 5V power supply. A VBUS drive signal VBUSDRV5 is an enable signal for supplying current to VBUS with a 5V power supply. A VBUS drive signal VBUSDRV3 is an enable signal for supplying current to VBUS with a 3.3V power supply. An Rpu enable signal xRPUEN is a pull-up enable signal of the data signal line D+. An Rpd enable signal RPDEN is a pull-down enable signal of the data signal line D+.
The OTG management circuit 212 generates control signals (VBUS drive signals BUSPWRSEL, VBUSDRV5, and VBUSDRV3, Rpu enable signal xRPUEN, Rpd enable signal RPDEN, HC enable signal HCEnb, PC enable signal PCEnb, etc.) corresponding to the OTG state.
The HC 220 controls the operation of the host function when enabled by the HC enable signal HCEnb from the OTG controller 210. The state control of the HC 220 may be performed by the CPU (firmware). In more detail, the firmware may instruct the HC to generate the USB data line state (“J”, “K”, or “SE0”) in each state by performing state transition of the host using various events (event which indicates transition to the OTG state a_host, for example) as a trigger, and setting an HC state command (Suspend, Reset, Operational, or Resume) corresponding to the destination state of the host in a given control register. The HC 220 generates a data line state corresponding to the state command set in the given control register. In the case where a time limit (timeout condition) is set in the state, state transition may be controlled by, allowing the firmware to measure time. The HC 220 enabled in the A-device performs state transition of the host according to a flowchart shown in FIG. 8. USB transfer is performed in the “Operational” state. The HC 220 enabled in the B-device performs state transition of the host according to a flowchart shown in FIG. 9.
The PC 230 controls the operation of the peripheral function when enabled by the PC enable signal PCEnb from the OTG controller 210. The PC 230 detects Reset, Suspend, or Resume in the case of a peripheral in OTG state transition based on the line state detected by the OTG controller 210 and the like, and notifies the CPU of the detected results by an interrupt. Remote wakeup detection is enabled in the case of a host in OTG state transition. The HC 220 and the PC 230 are enabled exclusively.
The register section 240 is a group of registers for controlling the operations as the host and the peripheral.
The packet buffer 250 is a buffer which stores packets transferred as the host or the peripheral.
The buffer controller 260 manages an access address to the packet buffer 250 which is input or output through the CPU I/F 290 or the DMA handler 292, and manages the access address to the packet buffer 250 which is input or output when performing USB transfer.
The host/peripheral switch circuit 270 includes a line state controller 272 and an HC/PC selector 274. The line state controller 272 instructs the transceiver 280 to generate the signal line state. The HC/PC selector 274 switches a path for connecting the transceiver 280 with either the HC 220 or the PC 230.
The transceiver 280 transmits or receives the USB data signal, generates the USB data line state, and performs parallel/serial conversion, bit stuffing/unstuffing, and the like. The USB positive signal DP is output to the data signal line D+. The USB negative signal DM is output to the data signal line D−.
The CPU I/F 290 controls PIO transfer and generates an interrupt signal to the CPU. CPU address CA[7:0] is a CPU address bus. CPU data CD[15:0] is a CPU data bus and also used as a DMA data bus. A chip select xCS is a chip select signal. A read strobe xRD is a CPU read strobe and is used in common as a DMA read strobe. A write strobe xWR is a CPU write strobe and is used in common as a DMA write strobe. A wait signal xWAIT is a wait signal to the CPU. An interrupt signal xINT is an interrupt signal to the CPU.
The DMA handler 292 controls DMA transfer. A DMA request xDREQ is a DMA transfer request signal. A DMA acknowledge xDACK is a DMA transfer enable signal.
The clock controller (clock control circuit) 294 distributes and controls clock signals supplied to each of the abovedescribed functional blocks. The clock controller 294 generates a clock signal by multiplying an oscillation output using an oscillator connected with an oscillator input XI and an oscillator output XO by means of a PLL circuit. The clock controller 294 may have a configuration in which a PLL filter circuit is connected with the PLL filter VC, or may be able to select either a clock signal from an external clock input CLKIN or a clock signal using the oscillator by a clock select signal CLKSEL [1:0].
A test module 296 is a module for performing an operability test of each section of the OTG device controller IC 200. The test module 296 performs a test in a test mode selected by a test mode TIN [1:0] when enabled by a test enable TEST, and monitors an internal test through a test monitor TESTMON.
In the OTG device controller IC 200 having such a configuration, the CPU is notified of the transition condition detected by the OTG controller 210 as an interrupt signal through the CPU I/F 290, and the CPU (firmware) is allowed to control state transition. The CPU sets an OTG state command corresponding to a destination OTG state in the OTG controller 210 through the CPU interface 290. The OTG controller 210 generates a control signal corresponding to the OTG state command set therein and controls each functional block. Specifically, transition between each state is controlled by the firmware. The H/W interrupt signal or instructions from the host application (software) is the state transition condition.
The HC 220 may control transition between each state for performing the host function in the same manner as described above. In more detail, the HC 220 controls state transition of the HC state by the firmware, as shown in FIGS. 8 and 9. The HC 220 in which the HC state command corresponding to the destination HC state is set controls the host by a control signal corresponding to the HC state command.
This enables the operation as the dual-role device to be realized while exchanging the host function and the peripheral function by HNP, as shown in FIG. 10. In FIG. 10, the firmware controls the operation of the dual-role device by setting the OTG state command and the HC state command by an interrupt signal.
3. Clock Controller (Clock Control Circuit)
The OTG device controller IC 200 switches between the host function and the peripheral function by transitioning between a plurality of states shown in FIGS. 5 and 6 when realizing the function as the dual-role device. However, since the OTG device controller IC 200 exclusively switches between these functions, power consumption is unnecessarily increased by steadily supplying clock signals to each functional block shown in FIG. 7. There may be a case where power consumption can be further reduced by suspending the oscillation operation of the oscillation circuit depending on the state.
Therefore, the clock controller 294 is capable of generating clock signals which can be controlled so that the output of the clock signals can be suspended or the frequency of the clock signals can be reduced corresponding to state transition for each circuit block in a unit of functional blocks of the OTG device controller IC 200 to which the clock signals can be supplied in common. The clock controller 294 is capable of suspending the oscillation operation of the oscillation circuit corresponding to state transition.
If the clock signal supply or oscillation is controlled while distinguishing functional blocks to be used in the state after transition from functional blocks not to be used in the state after transition, processing becomes complicated. Moreover, since control timing differs between each state, it is difficult to control the clock signal supply or oscillation by using the hardware in the case of controlling the clock signal supply or oscillation after a predetermined procedure in the state after transition. Therefore, in the clock controller 294, a clock control pattern which indicates whether or not to supply clock signals in a unit of circuit blocks and whether or not to control oscillation (at least a clock control pattern which indicates whether or not to control oscillation) is set by the firmware, and clock output and oscillation are controlled by decoding the clock control pattern. This enables unnecessary power consumption to be prevented by simplified clock signal supply control and oscillation control in the case where the device is controlled by a number of state transitions and the functional blocks may not be used depending on each state.
3.1 Outline of Configuration
FIG. 11 shows an outline of a configuration of a clock control circuit which is applied to the clock controller 294.
A clock control circuit 300 includes a clock generating circuit 310 and a clock output control circuit 320.
The clock generating circuit 310 includes an oscillation circuit 312. The oscillation circuit 312 generates an oscillation clock signal (reference clock signal in a broad sense) corresponding to an oscillation frequency of an externally connected oscillator 318. The oscillation clock signal is used as a reference clock signal for clock signals generated in a unit of the circuit blocks, for example.
The oscillation circuit 312 starts or suspends the oscillation operation by an oscillation enable signal OSCen (output control signal in a broad sense).
The clock output control circuit 320 may include a clock control register 322, a clock monitor register 324, a clock command register 326, a clock command decoder 328, and an activation circuit 330.
Clock control data is set in the clock control register 322 by the firmware. As an example of the clock control data, the number of waits until the oscillation circuit is allowed to become stable can be given.
Monitoring results for the clock generating circuit 310 by the clock output control circuit 320 are set in the clock monitor register 324. As the monitoring results, the state of the oscillation enable signal OSCen output from the activation circuit 330, or the state of the output control signal output from the clock command decoder 328 may be set, for example. The CPU which processes the firmware may refer to clock monitor data read from the clock monitor register 324, for example.
A clock command is set in the clock command register 326 by the firmware or hardware. The clock command is a clock control pattern which indicates at least whether or not to control oscillation. In the case where the clock output control circuit 320 controls output of clock signals in a unit of the circuit blocks generated by the clock generating circuit 310, instructions which indicate whether or not to control oscillation and whether or not to control output of the clock signals in a unit of the circuit blocks may be set as the clock control pattern.
The clock command decoder 328 decodes the clock control pattern set in the clock command register 326, and generates output control signals. The oscillation of oscillation circuit 312 can be controlled by the output control signal. In this case, starting and suspending oscillation can be controlled by controlling whether or not to fix a given oscillation node in the oscillation circuit 312.
When a trigger signal is input to the activation circuit 330, the activation circuit 330 outputs the oscillation enable signal OSCen which allows the oscillation circuit 312 to start the oscillation operation. The activation circuit 330 controls oscillation by using the results decoded by the clock command decoder 328. The activation circuit 330 may control oscillation based on the contents set in the clock control register 322.
The clock generating circuit 310 may include a PLL circuit. In this case, the PLL circuit generates a PLL clock signal by multiplying the oscillation clock signal of the oscillation circuit 312. Clock signals supplied to each circuit block are generated by using the PLL clock signal. The activation circuit 330 may include an oscillation circuit wakeup circuit, for example. In this case, the activation circuit 330 allows the oscillation circuit 312 to start the oscillation operation when the trigger signal is input to the activation circuit 330, and allows the oscillation circuit wakeup circuit to count a period of time until the oscillation operation of the oscillation circuit 312 becomes stable. The oscillation circuit wakeup circuit informs the PLL circuit connected to the subsequent stage of the oscillation circuit 312 that the oscillation clock signal is stable when timed out. A case where the clock generating circuit 310 includes the PLL circuit is described below.
The OTG device controller IC 200 is set to either a self-powered A-device (first device in a broad sense) or a B-device which can operate with power on the bus (second device in a broad sense) when connected with a USB cable. The OTG device controller IC 200 set to either the A-device or the B-device controls switching between the host (host which has the initiative for data transfer control) function and the peripheral (peripheral which does not have the initiative for data transfer control) function. Therefore, it is important to control the clock signal supply to each section of the OTG device controller IC 200 corresponding to complicated state transition. The clock signal supply control of the OTG device controller IC 200 is described below in detail.
3.2 Circuit Block
FIG. 12 is a view illustrating an example of circuit blocks which are output control units of the clock controller 294 to which the clock control circuit 300 is applied.
In FIG. 12, sections the same as the functional blocks of the OTG device controller IC 200 shown in FIG. 7 are indicated by the same symbols.
In the present embodiment, the OTG device controller IC 200 is divided into five circuit blocks, for example, and generation and output control of clock signals are performed in a unit of the circuit blocks. In more detail, the clock controller 294 generates a transceiver clock signal Xcvr_CLK, an HC clock signal HC_CLK, a PC clock signal PC_CLK, a main clock signal Main_CLK, and an OTGC clock signal OTGC_CLK. The transceiver clock signal Xcvr_CLK is supplied to the transceiver 280. The HC clock signal HC_CLK is supplied to the HC 220. The PC clock signal PC_CLK is supplied to the PC 230. The main clock signal Main_CLX is supplied to the register section 240, the packet buffer 250, the buffer controller 260, and the DMA handler 292. The OTG clock signal OTGC_CLK is supplied to the OTG controller 210, the host/peripheral switch circuit 270, and the CPU interface 290.
3.3 Clock Control Pattern
FIG. 13 shows an example of the clock control pattern.
The clock control pattern indicates whether or not to control output in a unit of the circuit blocks corresponding to the OTG state shown in FIGS. 5 and 6.
In the OTG device controller IC 200, state transition is controlled by the firmware. A state command corresponding to a designation state is set in the OTG controller 210, and a control signal which controls the destination state is generated by decoding the state command. Therefore, since a state command is set in the OTG device controller IC 200 by the firmware in principle, a clock signal must be supplied to the OTG controller 210 which generates a control signal corresponding to a state and the CPU interface 290 for setting a state command corresponding to the state. Therefore, the OTGC clock signal OTGC_CLK is supplied in almost all the states.
In the case of supplying a clock signal to at least one circuit block in each state, it is necessary to allow the oscillation circuit to perform the oscillation operation. In a state in which it is unnecessary to supply clock signals to all the circuit blocks, power consumption can be reduced by suspending the oscillation operation of the oscillation circuit.
In the a_idle state when set to the A-device, current is not supplied to VBUS and the data signal lines D+ and D− are not driven. However, since the A-device must detect SRP from the B-device which is the connection partner, it is necessary to supply a clock signal to the OTG controller 210 and the CPU interface 290. Therefore, only the OTGC clock signal OTGC_CLK is supplied in the a_idle state.
The a_wait_vrise state is a state which waits for the voltage of VBUS to reach a given threshold voltage. The a_wait_bcon state is a state which waits for the data signal line to be pulled up in the B-device. Therefore, it is necessary to supply a clock signal to the OTG controller 210 and the CPU interface 290 in these states.
In the a_host state, the host operation is performed by the HC 220. Therefore, it is unnecessary to supply a clock signal to the PC 230 which controls the operation of the peripheral function which is exclusively switched to or from the host function. Therefore, power consumption can be reduced by suspending supply of only the PC clock signal PC_CLK in the a_host state.
In the a_suspend state, the B-device can initiate SRP or HNP. Therefore, it is necessary to supply a clock signal to the OTG controller 210 and the CPU interface 290.
In the a_peripheral state, the peripheral operation is performed by the PC 230. Therefore, it is unnecessary to supply a clock signal to the HC 220 which controls the operation of the host function which is exclusively switched to or from the peripheral function. Therefore, power consumption can be reduced by suspending supply of only the HC clock signal HC_CLK in the a_peripheral state.
The a_wait_vfall state is a state which waits for the voltage of VBUS to drop below the given threshold voltage. Therefore, it is necessary to supply a clock signal to the OTG controller 210 and the CPU interface 290.
The a_vbus_err state is a state which waits for the voltage of VBUS to drop due to overcurrent. Therefore, it is necessary to supply a clock signal to the OTG controller 210 and the CPU interface 290.
When set to the B-device, the b_idle state is a default state when the USB cable is not connected. Therefore, supply of clock signals to each section of the OTG device controller IC 200 is suspended in order to prevent current from being consumed without controlling data transfer. When transitioning from the b_idle state to another state, the oscillation circuit and the PLL circuit are allowed to start the operations using an interrupt corresponding to the transition condition (ChangeID interrupt or Cross44V interrupt as described later, for example) as a trigger. After a clock signal is steadily supplied to the OTG controller 210 and CPU interface 290 to enable a state command to be set in the OTG controller 210, a state command corresponding to the destination state is set.
The b_srp_init state is a state in which the B-device initiates SRP. In the b_srp_init state, it is necessary to supply a clock signal to the OTG controller 210 and the CPU interface 290 in order to enable data line pulsing or VBUS pulsing by SRP.
In the b_peripheral state, the peripheral operation is performed by the PC 230. Therefore, it is unnecessary to supply a clock signal to the HC 220 which controls the operation of the host function which is exclusively switched to or from the peripheral function. Therefore, power consumption can be reduced by suspending supply of only the HC clock signal HC_CLK in the b_peripheral state.
However, according to the USB 2.0 standard, if the B-device as the downstream device detects that the A-device as the upstream device which is the connection partner puts the bus in the suspend state for 3 ms or more even in the b_peripheral state, the A-device is in the suspend state of the USB host. In this case, since the A-device which operates as the host is in the USB suspend state, the B-device cannot operate. Therefore, power consumption can be reduced by suspending supply of clock signals to all the blocks.
The b_wait_acon state is a state which waits for the A-device to become a peripheral by HNP. Therefore, it suffices to supply a clock signal to only the OTG controller 210 and the CPU interface 290. However, the b_wait_acon state is generally in the middle of transition from the b_peripheral state to the b_host state. In the case, where a period of time in the b_wait_acon state is short, clock signal supply control is simplified by controlling clock signal supply in the same manner as in the b_peripheral state. Therefore, the clock control pattern is the same as the clock control pattern in the b_peripheral state in FIG. 13.
In the b_host state, the host operation is performed by the HC 220. However, it is unnecessary to supply a clock signal to the PC 230 which controls the operation of the peripheral function which is exclusively switched to or from the host function. Therefore, power consumption can be reduced by suspending supply of only the PC clock signal PC_CLK in the b_host state.
In the test mode, clock signals are supplied to all the functional blocks in order to perform a given test for all the functional blocks.
As described above, in the case of controlling clock signals in a unit of the circuit blocks in each state of the A-device and the B-device, the clock control patterns consist of the Wait mode, the Host mode, the Peripheral mode, the AllSleep mode, and the AllActive mode (five patterns).
In the Wait mode, a clock signal (OTGC clock signal OTGC_CLK) is supplied to the OTG controller 210, the CPU interface 290, and the host/peripheral switch circuit 270.
In the Host mode, clock signals (OTGC clock signal OTGC_CLK and HC clock signal HC_CLK) are supplied to the OTG controller 210, the CPU interface 290, the host/peripheral switch circuit 270, and the HC 220.
In the Peripheral mode, clock signals (OTGC clock signal OTGC_CLK and PC clock signal PC_CLK) are supplied to the OTG controller 210, the CPU interface 290, the host/peripheral switch circuit 270, and the PC 230.
In the AllSleep mode, not only all the functional blocks but also the oscillation operations of the oscillation circuit and the PLL circuit are suspended.
In the AllActive mode, clock signals are supplied to all the functional blocks.
One of these five patterns is set in the clock control circuit 300 by the firmware as the clock control pattern. The clock control circuit 300 decodes the clock control pattern and controls clock output in a unit of the circuit blocks.
3.4 Detailed Configuration Example
FIG. 14 shows a detailed configuration example of the clock controller 294.
In FIG. 14, sections the same as the sections of the clock control circuit 300 shown in FIG. 11 are indicated by the same symbols. Description of these sections is appropriately omitted.
The clock generating circuit 310 includes the oscillation circuit 312, the PLL circuit 314, and the clock distribution control circuit 316.
In the clock generating circuit 310, an oscillation clock signal XCLK is output from the oscillation circuit 312, and a PLL clock signal PLL_CLK is generated in the PLL circuit 314 by multiplying the oscillation clock signal XCLK. The PLL clock signal PLL_CLK is supplied to the clock distribution control circuit 316.
The clock distribution control circuit 316 generates clock signals (transceiver clock signal Xcvr_CLK, HC clock signal HC_CLK, PC clock signal PC_CLK, main clock signal Main_CLK, and OTGC clock signal OTGC_CLK in FIG. 14) in a unit of the circuit blocks by using the PLL clock signal PLL_CLK. The clock distribution control circuit 316 includes an Xcvr_CLK generating circuit 350, an HC_CLK generating circuit 352, a PC_CLK generating circuit 354, a Main_CLK generating circuit 356, and an OTGC_CLK generating circuit 358. The Xcvr_CLK generating circuit 350 generates the transceiver clock signal Xcvr_CLK at a given frequency by using the PLL clock signal PLL_CLK, and suspends the transceiver clock signal Xcvr_CLK or reduces the frequency of the transceiver clock signal Xcvr_CLK based on an output control signal XcvrSleep from the clock command decoder 328. The HC_CLX generating circuit 352 generates the HC clock signal HC_CLK at a given frequency by using the PLL clock signal PLL_CLK, and controls output of the HC clock signal HC_CLK based on an output control signal HCSleep from the clock command decoder 328. The PC_CLK generating circuit 354 generates the PC clock signal PC_CLK at a given frequency by using the PLL clock signal PLL_CLK, and controls output of the PC clock signal PC_CLK based on an output control signal PCSleep from the clock command decoder 328. The Main_CLK generating circuit 356 generates the main clock signal Main_CLK at a given frequency by using the PLL clock signal PLL_CLK, and controls output of the main clock signal Main_CLK based on an output control signal MainSleep from the clock command decoder 328. The OTGC_CLK generating circuit 358 generates the OTGC clock signal OTGC_CLK at a given frequency by using the PLL clock signal PLL_CLK, and controls output of the OTGC clock signal OTGC_CLK based on an output control signal OTGCSleep from the clock command decoder 328.
The activation circuit 330 of the clock output control circuit 320 includes an oscillation circuit start-up timer 360, a PLL circuit start-up timer 362, an oscillation circuit wakeup (OSCWakeUp) circuit 364, and a PLL circuit wakeup (PLLWakeUp) circuit 366.
The oscillation circuit start-up timer 360 outputs a PLL circuit activation signal when a period for the number of waits set in the clock control register 322 as an oscillation output stable period has elapsed after the timer is started. This allows the PLL circuit 314 to start PLL oscillation and the PLL circuit start-up timer 362 to start.
The PLL circuit start-up timer 362 outputs a PLL circuit wakeup signal to the PLL wakeup circuit 366 when a period for the number of waits set in the clock control register 322 as a PLL oscillation output stable period has elapsed after the timer is started.
An oscillation circuit oscillation enable signal which is output from the clock command decoder 328 is input to the oscillation circuit wakeup circuit 364. The oscillation circuit wakeup circuit 364 enabled by the oscillation circuit oscillation enable signal is activated by a resume trigger signal, and outputs the oscillation enable signal OSCen to the oscillation circuit 312. In more detail, the oscillation circuit wakeup circuit 364 enabled by the oscillation circuit oscillation enable signal is activated by a RemoteWakeUp trigger or a LocalWakeUp trigger, and outputs the oscillation enable signal OSCen to the oscillation circuit 312. The RemoteWakeUp trigger goes active when the A-device detects that the B-device puts the line state in the “K” state when the A-device transitions from the a_suspend state to the a_host state. The LocalWakeUp trigger goes active when the ChangeID interrupt, DetnonJ interrupt, or Cross44V interrupt occurs. The ChangeID interrupt occurs as the change of the ID terminal as a trigger, such as in the case where a Mini-A plug is inserted when transitioning from the b_idle state to the a_idle state. The DetnonJ interrupt occurs when detecting that the line state is not in the “J” state when transitioning from the b_idle state to the b_peripheral state. The Cross44V interrupt occurs when the voltage of VBUS is changed across a given threshold voltage of 4.4V in the A-device.
A PLL circuit oscillation enable signal which is output from the clock command decoder 328 is input to the PLL circuit wakeup circuit 366. The PLL circuit wakeup circuit 366 enabled by the PLL circuit oscillation enable signal is activated by the PLL circuit wakeup signal output from the PLL circuit start-up timer 362, and outputs a PLL circuit output enable signal.
The number of waits of the oscillation circuit or the PLL circuit is set in the clock control register 322 as CPU_WData by the firmware based on a write enable signal CPU_Ctl_wr.
A clock command from the firmware or a clock command from the OTG controller 210 is set in the clock command register 326 based on a write enable signal CPU_Cmd_wr from the firmware or a write enable signal OTGC_Cmd_wr from the OTG controller 210. The write enable signal OTGC_Cmd_wr includes a trigger signal generated based on the monitoring results for the line state (RemoteWakeUp trigger or LocalWakeUp trigger, for example).
In the clock monitor register 324, the state of the oscillation enable signal OSCen output from the oscillation circuit wakeup circuit 364 is set in a bit field assigned as EnOSC. The state of a PLL enable signal PLLen output from the oscillation circuit start-up timer 360 is set in a bit field of the clock monitor register 324 assigned as EnPLL. The state of the PLL circuit output enable signal output from the PLL circuit wakeup circuit 366 is set in a bit field of the clock monitor register 324 assigned as PLLClkActive. The state of the clock distribution control signal OTGCSleep output from the clock command decoder 328 is set in a bit field of the clock monitor register 324 assigned as CPUClkActive. The contents of the clock command register 326 are read as CPU_RData based on a read enable signal CPU_Mon_r from the firmware.
The clock command decoder 328 decodes the clock command set in the clock command register 326 and generates the oscillation circuit oscillation enable signal, the PLL circuit oscillation enable signal, and the clock distribution control signals XcvrSleep, HCSleep, PCSleep, MainSleep, and OTGCSleep (output control signals in a broad sense). The clock distribution control signals are supplied to the Xcvr_CLK generating circuit 350, the HC_CLK generating circuit 352, the PC_CLK generating circuit 354, the Main_CLK generating circuit 356, and the OTGC_CLK generating circuit 358.
The operation of the clock controller 294 having such a configuration is described below.
FIG. 15 shows an example of the clock signal supply control operation timing when transitioning from the default state after reset to the idle state of the B-device. When the clock controller 294 is reset, a clock command corresponding to the AllActive mode in which clock signals are supplied to all the functional blocks for initializing the internal state is set in the clock command register 326. This allows the clock distribution control signals (output control signals in a broad sense) XcvrSleep, HCSleep, PCSleep, MainSleep, and OTGCSleep at an “L” level to be output. The oscillation circuit oscillation enable signal and the PLL circuit oscillation enable signal (output control signals in a broad sense) in an enable state are output. Therefore, the oscillation circuit and the PLL circuit perform the oscillation operations, whereby the PLL clock signal PLL_CLK is output. The transceiver clock signal Xcvr_CLK, the HC clock signal HC_CLK, the PC clock signal PC_CLK, the main clock signal Main_CLK, and the OTGC clock signal OTGC_CLK are then output from the clock distribution control circuit 316.
When entering the idle state of the B-device, the firmware sets a clock command corresponding to the AllSleep mode in the clock command register 326. This allows the clock distribution control signals (output control signals in a broad sense) XcvrSleep, HCSleep, PCSleep, MainSleep, and OTGCSleep at an “H” level to be output. Therefore, output of the transceiver clock signal Xcvr_CLK, the HC clock signal HC_CLK, the PC clock signal PC_CLK, the main clock signal Main_CLK, and the OTGC clock signal OTGC_CLK from the clock distribution control circuit 316 is suspended. Since the PLL circuit oscillation enable signal and the oscillation circuit oscillation enable signal (output control signals in a broad sense) are decoded to be in a disable state, the oscillation operations are suspended.
FIG. 16 shows an example of the clock signal supply control operation timing when suspending output of the PLL circuit in the test state. A clock command for disabling the PLL circuit output enable signal is set in the clock command register in which the clock command corresponding to the AllActive mode has been set by the firmware. In this case, when the PLL circuit oscillation enable signal is disabled, the PLL circuit output enable signal is disabled. Output of all the clock signals excluding the oscillation output of oscillation circuit 312 is suspended.
The clock command may be set at the same timing as the state command corresponding to the destination state, or may be set while providing a time lag between the clock command and the state command. The clock command may be set at an arbitrary timing in the destination state.
FIGS. 17 and 18 show an example of data transfer control using the OTG device controller IC 200 to which the above clock control circuit is applied to the clock controller.
FIGS. 17 and 18 illustrate firmware processing and communication with a connection partner performed when the A-device transitions from the b_idle state (default) to the a_host state.
Connect(J)Det refers to a function of detecting that the line state is in the “J” state so as to detect connection with the connection partner. Disconnect(SE0)Det refers to a function of detecting that the line state is in the “SE0” state so as to detect disconnection from the connection partner.
The dual-role device defaults to the b_idle state as described above. A clock command corresponding to the AllSleep mode is set in the clock command register by the CPU (firmware). This allows output of all the clock signals to be suspended as shown in FIG. 15.
When a Mini-B plug is inserted into the connection partner and a Mini-A plug is inserted into the OTG device controller IC 200, the CPU (firmware) is notified of the ChangeID interrupt which indicates that the ID signal is changed. The interrupt signal of which the CPU is notified is controlled to be deactivated by the CPU.
The CPU judges that the destination state is the a_idle state as shown in FIG. 5, and sets the OTG state command. Therefore, each block of the OTG device controller IC 200 is controlled based on the control signal in the a_idle state. The CPU judges that the clock control pattern in the a_idle state is the Wait mode as shown in FIG. 13, and sets a clock command corresponding to the Wait mode in the clock command register. This allows only the OTGC clock signal OTGC_CLK to be output, and supplied to the OTG controller 210, the CPU interface 290, and the host/peripheral switch circuit 270.
When the host application requests use of the bus (a_bus_req), the CPU judges that the destination state is the a_wait_vrise state and sets the OTG state command. The CPU judges that the clock control pattern in the a_wait_vrise state is the Wait mode as shown in FIG. 13, and sets a clock command corresponding to the Wait mode in the clock command register. In this case, the output state of each clock signal remains the same as in the a_idle state.
When a state command corresponding to the a_wait_vrise state is set and the A-device transitions to the a_wait_vrise state, the CPU starts a 200-ms timer. When the voltage of VBUS is detected to rise above the given threshold voltage, the CPU stops the timer in the a_wait_vrise state by the Cross44V interrupt, judges that the destination state is the a_wait_bcon state, and sets the OTG state command. In the case where the timer has timed out (200 ms has elapsed), the CPU also judges that the destination state is the a_wait_bcon state and sets the OTG state command corresponding to the a_wait_bcon state. The CPU judges that the clock control pattern in the a_wait_bcon state is the Wait mode as shown in FIG. 13, and sets a clock command corresponding to the Wait mode in the clock command register. In this case, the output state of each clock signal remains the same as in the a_wait_vrise state.
When the A-device transitions to the a_wait_bcon state, the CPU starts a 200-ms timer. When the line state is detected to be in the “J” state for a predetermined period of time, the CPU stops the timer by a ChangeConnStat interrupt, judges that the destination state is the a_host state, and sets the OTG state command. The CPU judges that the clock control pattern in the a_host state is the Host mode as shown in FIG. 13, and sets a clock command corresponding to the Host mode in the clock command register. This allows output of the HC clock signal HC_CLK, the main clock signal Main_CLK, and the transceiver clock signal Xcrv_CLK to be started, as shown in FIG. 16.
3.5 Another Configuration Example
The clock control circuit does not necessarily set a clock command corresponding to all the clock control patterns as shown FIG. 14. It suffices that the clock control circuit can set a clock command corresponding to at least one clock control pattern.
FIG. 19 shows another configuration example of the clock controller shown in FIG. 14.
In FIG. 19, sections the same as the sections of the clock controller 294 shown in FIG. 14 are indicated by the same symbols. Description of these sections is appropriately omitted.
A clock command decoder 400 decodes a clock command set in a clock command register 402 and generates an output control signal. In FIG. 19, OTGCSleep (clock distribution control signal), the oscillation circuit oscillation enable signal, and the PLL circuit oscillation enable signal are generated as the output control signals.
Clock control data is set in a clock control register 404 by the firmware or hardware such as the OTG controller 210. In a clock controller 390, an oscillation circuit wakeup time OSCWakeUpTime [1:0] as the number of oscillation waits, a PLL circuit wakeup time PLLWakeUpTime [1:0] as the number of PLL oscillation waits, and the clock distribution control signals XcvrSleep, HCSleep, PCSleep, and MainSleep which control clock signal supply in a unit of the circuit blocks are set in the clock control register, as shown in FIG. 20.
A clock command is set in the clock command register 402 by the firmware or hardware such as the OTG controller 210, as shown in FIG. 20.
The presence or absence of supply of the OTGC clock signal OTGC_CLK, the presence or absence of output of the PLL clock signal PLL_CLK, enable/disable EnPLL of the PLL circuit, and enable/disable EnOSC of the oscillation circuit are set in the clock monitor register 406, as shown in FIG. 20.
The processing can be simplified and unnecessary power consumption can be prevented by controlling clock signal supply by using at least one clock control pattern. Moreover, clock signal supply can be controlled in more detail by controlling clock signal supply in a unit of the circuit blocks by using the clock control register in combination.
FIGS. 21 and 22 show examples of operation timing of the clock controller 390.
The following description is given on the assumption that clock control is OSC wakeup when the clock command is “55h”, OSC sleep when “aah”, PLL wakeup when “3ch”, PLL sleep when “c3h”, OTGC_CLK wakeup when “69h”, and OTGC_CLK sleep when “96h”, for example.
FIG. 21 shows an example of the clock signal supply control operation timing when transitioning from the default state after reset to the idle state of the B-device. When the clock controller 390 is reset, “00h” is set in the clock command register 402, whereby all the clock signals are output. The CPU (firmware) sets the clock distribution control signals Xcvr_Cleep, HCSleep, PCSleep, and MainSleep at an “H” level by using the clock control register 404, whereby output of the HC clock signal HC_CLK, PC clock signal PC_CLK, the main clock signal Main_CLK, and the transceiver clock signal Xcvr_CLK is suspended.
When entering the idle state of the B-device, the firmware sequentially sets “69h”, “c3h”, “aah”, and “00h” in the clock command register 402 to allow output of the OTGC clock signal OTGC_CLK, the PLL clock signal PLL_CLK, and the oscillation clock signal XCLK to be suspended in that order.
FIG. 22 shows an example of the clock signal supply control operation timing when suspending output of the PLL circuit in the test state. In the test state, “00h” is set in the clock command register 402 of the clock controller 390 by the firmware, whereby all the clock signals are output. In the case of suspending the PLL circuit thereafter, the CPU (firmware) sets the clock distribution control signals HCSleep, PCSleep, MainSleep, and Xcvr_Cleep at an “H” level by the using clock control register 404, whereby output of the HC clock signal HC_CLK, PC clock signal PC_CLK, the main clock signal Main_CLK, and the transceiver clock signal Xcvr_CLK is suspended.
The firmware then sequentially sets “69h”, “c3h”, and “00h” in the clock command register 402 to allow output of the OTGC clock signal OTGC_CLK, the PLL clock signal PLL_CLK, and the oscillation clock signal XCLK to be suspended in that order.
FIG. 23 shows an example of data transfer control of the OTG device controller IC to which the clock controller shown in FIG. 19 is applied.
FIG. 23 shows a sequence when transitioning to the a_host state as an A-device after turning the power on through the b_idle state which is the default state.
In the initial state after turning the power on, clock signals are supplied to all the functional blocks in the AllActive mode.
The oscillation circuit wakeup time OSCWakeUptime [1:0] and the PLL circuit wakeup time PLLWakeUptime [1:0] shown in FIG. 20 are set in the clock control register 404 by the firmware.
The firmware transitions to the b_idle state of the B-device which is the default by detecting the voltage of the ID terminal of the plug, and sets an OSC state command corresponding to the b_idle state in the OTG controller. The firmware sets the clock controller register 404 so that the clock distribution control signals XcvrSleep, HCSleep, PCSleep, and MainSleep are enabled and sets a clock command in the clock command register so that the oscillation circuit oscillation enable signal, the PLL circuit oscillation enable signal, and the clock distribution control signal OTGCSleep are disabled in order to allow transition to the AllSleep mode.
When a Mini-B plug is inserted into the connection partner and a Mini-A plug is inserted into the OTG device controller IC, the CPU (firmware) is notified of the ChangeID interrupt which indicates that the ID signal is changed. The interrupt signal of which the CPU is notified is controlled to be deactivated by the CPU.
After the timeout period set in the oscillation circuit wakeup time OSCWakeUpTime [1:0] and the PLL circuit wakeup time PLLWakeUptime [1:0] has elapsed, supply from the oscillation circuit and the PLL circuit is started.
The CPU judges that the destination state is the a_idle state as shown in FIG. 5, and sets the OTG state command. Therefore, each block of the OTG device controller IC is controlled based on the control signal in the a_idle state. The CPU sets control data in the clock command register corresponding to the Wait mode which is the clock control pattern in the a_idle state as shown in FIG. 13, and sets a clock command in the clock command register. This allows only the OTGC clock signal OTGC_CLK to be output, and supplied to the OTG controller 210, the CPU interface 290, and the host/peripheral switch circuit 270.
FIGS. 24 to 26 show examples of oscillation control of the oscillation circuit
FIG. 24 shows an example of oscillation control timing of the oscillation circuit when transitioning from the idle state of the B-device to the peripheral state of the B-device.
When the OTG device controller IC detects that the line state is not in the “J” state by the OTG controller in the b_idle state of the B-device, a hardware interrupt (DetNonJ) occurs during firmware processing. The firmware transitions the state from the b_idle state to the b_peripheral state. The firmware sets the Peripheral mode as the clock command.
When a resume trigger signal is input to the clock controller 390 from the OTG controller which detects the DetNonJ interrupt, the oscillation circuit wakeup circuit 364 which is enabled by the oscillation circuit oscillation enable signal sets the oscillation enable signal OSCen at an “H” level to allow the oscillation circuit 312 to start the oscillation operation.
The oscillation circuit start-up timer 360 starts to count the time-out period set in the oscillation circuit wakeup time OSCWakeUpTime [1:0] of the clock control register 404. After the time-out period has elapsed, the PLL circuit activation signal is output to the PLL circuit start-up timer 362 and the PLL circuit 314 is allowed to start PLL oscillation by the PLL enable signal PLLen. The PLL circuit start-up timer 362 which is enabled by the PLL circuit oscillation enable signal set in the clock command register 402 as the clock command counts the time-out period set in the PLL circuit wakeup time PLLWakeUpTime [1:0].
After the time-out period has elapsed, the PLL clock signal PLL_CLK is output from the PLL circuit 314 by the PLL circuit output enable signal.
Clock signals start to be supplied to each section necessary for the peripheral operation by the clock distribution control signals PCSleep, MainSleep, XcvrSleep, and OTGCSleep from the clock command register or the clock control register.
FIG. 25 shows an example of oscillation control timing of the oscillation circuit when transitioning from the suspend state of the A-device to the host state of the A-device.
When the OTG device controller IC detects that the line state is in the “K” state by the OTG controller in the a_suspend state of the A-device, a remote wakeup trigger signal is generated. This allows a clock command corresponding to the Host mode to be set in the clock command register. This causes output of the HC clock signal HC_CLK, the main clock signal Main_CLK, and the transceiver clock signal Xcvr_CLK to be started with the PC clock signal PC_CLK remaining in a suspend state.
Since the clock command is set with the detection results for the hardware as a trigger, it is possible to easily deal with a case where state transition must be performed within a short period of 900 μs, for example.
FIG. 26 shows an example of oscillation control timing of the oscillation circuit when transitioning from the PLL suspend state to the test operation state.
When the resume trigger signal is input to the oscillation circuit start-up timer 360 from the hardware in the PLL suspend state, for example, the PLL circuit activation signal is output from the oscillation circuit wakeup circuit 364 after a period set by the oscillation circuit wakeup time OSCWakeUpTime has elapsed, and the PLL enable signal PLLen is output to the PLL circuit 314. This allows the PLL circuit start-up timer 362 to output the PLL circuit wakeup signal after a period set by the PLL circuit wakeup time PLLWakeUpTime has elapsed. As a result, the PLL circuit output enable signal goes active.
4. Electronic Equipment
Examples of electronic equipment including a data transfer control device to which the clock control circuit of the present embodiment is applied are described below.
FIG. 27A is an internal block diagram of a printer which is an example of the electronic equipment. FIG. 28A is an external view of the printer. A CPU (microcomputer) 510 controls the entire system and the like. An operating section 511 allows the user to operate the printer. A control program, fonts, and the like are stored in a ROM 516, A RAM 517 functions as a work area for the CPU 510. A DMAC 518 is a DMA controller for transferring data without the CPU 510. A display panel 519 notifies the user of the operation state of the printer.
Serial print data sent from another device such as a personal computer through the USB is converted into parallel print data by a data transfer control device 500. The converted parallel print data is sent to a print processing section (printer engine) 512 by the CPU 510 or the DMAC 518. The parallel print data is subjected to given processing in the print processing section 512 and output and printed on paper by a print section (device which performs output processing of data) 514 consisting of a print head and the like.
FIG. 27B shows an internal block diagram of a digital camera which is another example of electronic equipment. FIG. 28B is an external view of the digital camera. A CPU 520 controls the entire system and the like. An operating section 521 allows the user to operate the digital camera. A control program and the like are stored in a ROM 526. A RAM 527 functions as a work area for the CPU 520. A DMAC 528 is a DMA controller.
An image of an object is taken by an imaging section 522 consisting of a CCD and the like. The image data is processed by an image processing section 524. The processed image data is sent to the data transfer control device 500 by the CPU 520 or the DMAC 528. The data transfer control device 500 converts the parallel image data into serial data and sends the serial data to another device such as a personal computer through the USB.
FIG. 27C is an internal block diagram of a CD-RW drive which is still another example of electronic equipment. FIG. 28C is an external view of the CD-RW drive. A CPU 530 controls the entire system and the like. An operating section 531 allows the user to operate the CD-RW drive. A control program and the like are stored in a ROM 536. A RAM 537 functions as a work area for the CPU 530. A DMAC 538 is a DMA controller.
Data read from a CD-RW 532 by a read/write section (device which performs fetch processing or storage processing of data) 533 consisting of a laser, motor, optical system, and the like is input to a signal processing section 534 and subjected to given signal processing such as error correction processing. The data subjected to the signal processing is sent to the data transfer control device 500 by the CPU 530 or the DMAC 538. The data transfer control device 500 converts the parallel data into serial data and sends the serial data to another device such as a personal compute through the USB.
Serial data sent from another device through the USB is converted into parallel data by the data transfer control device 500. The parallel data is sent to the signal processing section 534 by the CPU 530 or the DMAC 538. The parallel data is subjected to given signal processing in the signal processing section 534 and stored on the CD-RW 532 by the read/write section 533.
In FIGS. 27A, 27B, and 27C, another CPU for controlling data transfer by the data transfer control device 500 may be provided in addition to the CPU 510, 520 or 530.
USB transfer can be performed without connecting the electronic equipment with a personal computer which performs the host operation by providing the data transfer control device of the present embodiment in electronic equipment. In particular, it is made unnecessary for the user to carry a personal computer by providing the data transfer control device in portable electronic equipment, whereby USB transfer can be readily performed. For example, USB transfer can be performed between a printer or a CD-RW drive without using a personal computer.
A processing load of firmware which operates on the CPU is reduced by providing the data transfer control device of the present embodiment in electronic equipment, whereby an inexpensive CPU can be used. Moreover, since cost and scale of the data transfer control device can be reduced, cost and scale of the electronic equipment can also be reduced.
As other examples of electronic equipment to which the data transfer control device of the present embodiment can be applied, various types of optical disk drives (CD-ROM and DVD), magneto-optical disk drives (MO), hard disk drives, TVs, VTRs, video cameras, audio equipment, telephones, projectors, personal computers, electronic notebooks, word processors, and the like can be given.
The present invention is not limited to the present embodiment. Various modifications and variations are possible within the spirit and scope of the present invention.
The present invention is particularly desirably applied to data transfer according to the OTG standard. However, the application of the present invention is not limited thereto. For example, the present invention may be applied to data transfer in a standard based on the same idea as the OTG standard and a standard developed from the OTG standard.
The method of dividing the circuit blocks is not limited to the above-described method of dividing the functional blocks. The functional blocks may be appropriately divided into a plurality of circuit blocks depending on the operating frequency, layout arrangement, and circuit scale of each functional block of the OTG device controller IC.
The above embodiment illustrates a case where clock signal supply is controlled by the clock control patterns shown in FIG. 13 as data transfer of the OTG standard. However, the present invention is not limited thereto. Clock signal supply can be controlled in more detail by providing a larger number of clock control patterns.
The above embodiment illustrates a case where a device into which a Mini-A plug is inserted before transfer is an A-device and a device into which a Mini-B plug is inserted is a B-device. However, the present invention may also be applied to a case where the supply source of VBUS is changed by exchanging the A-device and the B-device during transfer control.

## Claims

1. A clock control circuit of a data transfer control device having a state controller which controls switching between states of a host and a peripheral on the basis of state transition of a first device which operates as a host in a default state or state transition of a second device which operates as a peripheral in a default state, the clock control circuit comprising:
an oscillation circuit which generates a reference clock signal for a clock signal supplied to each section of the data transfer control device,
a clock output control circuit which generates an output control signal which controls an oscillation output of the oscillation circuit, and
an activation circuit which activates the oscillation circuit based on a resume trigger signal generated based on a line state which is a state of a data signal line connected with a connection partner when data transfer from the connection partner is suspended in the state transition of the first device operating as a peripheral,
wherein the clock output control circuit performs oscillation control to suspend an oscillation operation of the oscillation circuit based on the output control signal when data transfer from a connection partner is suspended in the state transition of the second device operating as a peripheral, and omits the oscillation control of the oscillation circuit in a suspend state of the first device.

2. The clock control circuit as defined in claim 1,
wherein the clock output control circuit includes:
a clock command register in which a clock command corresponding to a clock control pattern is set, the clock control pattern indicating whether or not to perform the oscillation control of the oscillation circuit, and
a clock monitor register for monitoring contents in the clock command register,
wherein the clock command register is set by using the resume trigger signal or a clock command generated corresponding to state transition of the first device or the second device, and
wherein the output control signal is generated by using contents in the clock command register.

3. The clock control circuit as defined in claim 1,
wherein the clock output control circuit suspends outputting the clock signal supplied to the state controller or performs output control to reduce frequency of the clock signal supplied to the state controller based on the output control signal in an idle state of the second device, the clock signal being generated by using an oscillation output of the oscillation circuit.

4. The clock control circuit as defined in claim 1,
wherein the clock output control circuit suspends outputting one of the clock signal supplied to the state controller or performs output control to reduce frequency of the clock signal supplied to the state controller based on the output control signal in the state transition of the second device operating as a peripheral, the clock signal being generated by using an oscillation output of the oscillation circuit, and
wherein the clock output control circuit omits output control of the clock signal supplied to the state controller in a suspend state of the first device.

5. The clock control circuit as defined in claim 1,
wherein the first device is an A-device of the USB (Universal Serial Bus) OTG (On-The-Go) standard,
wherein the second device is a B-device of the USB OTG standard, and
wherein the state controller controls switching between states of a host and a peripheral according to the USB OTG standard.

6. A data transfer control device comprising:
the clock control circuit as defined in claim 1,
a state controller which controls switching between states of a host and a peripheral,
a host controller which controls an operation as a host, and
a peripheral controller which controls an operation as a peripheral.

7. Electronic equipment comprising:
the data transfer control device as defined in claim 6, and
a device which performs output processing, fetch processing, or storage processing of data transferred through the data transfer control device and a bus.

8. A data transfer control device which transfers data to or from a first device and controls data transfer on the basis of state transition of a second device, the second device operating as a peripheral in a default state, the data transfer control device comprising:
a state controller which switches between states of a host and a peripheral of the second device by state transition,
a plurality of circuit blocks,
an oscillation circuit which generates a reference clock signal for a clock signal supplied to each section of the circuit blocks,
a first clock generating circuit which generates a clock signal supplied to state controller,
a second clock generating circuit which generates a clock signal supplied to at least one of the circuit blocks, and
a clock output control circuit which generates an output control signal which controls an oscillation operation of the oscillation circuit,
wherein the clock output control circuit performs oscillation control to operate the oscillation circuit based on the output control signal, performs output control to operate the first clock generating circuit based on the output control signal and performs output control to suspend an operation of the second clock generating circuit, in an idle state of the first device, and
wherein the clock output control circuit performs oscillation control to suspend the oscillation operation of the oscillation circuit based on the output control signal in an idle state of the second device.

9. The data transfer control device as defined in claim 8,
wherein the clock output control circuit suspends outputting one of the clock signal supplied to the state controller or performs output control to reduce frequency of the clock signal supplied to the state controller based on the output control signal in the state transition of the second device operating as a peripheral, the clock signal being generated by using an oscillation output of the oscillation circuit, and
wherein the clock output control circuit omits output control of the clock signal supplied to the state controller in a suspend state of the first device.

10. The data transfer control device as defined in claim 8,
wherein the first device is an A-device of the USB (Universal Serial Bus) OTG (On-The-Go) standard,
wherein the second device is a B-device of the USB OTG standard, and
wherein the state controller controls switching between states of a host and a peripheral according to the USB OTG standard.

11. The data transfer control device as defined in claim 8,
wherein the data transfer control device include:
a state controller which controls switching between states of a host and a peripheral,
a host controller which controls an operation as a host, and
a peripheral controller which controls an operation as a peripheral.

12. Electronic equipment comprising:
the data transfer control device as defined in claim 11, and
a device which performs output processing, fetch processing, or storage processing of data transferred through the data transfer control device and a bus.

13. The data transfer control device as defined in claim 8,
wherein the clock output control circuit performs oscillation control to suspend an oscillation operation of the oscillation circuit based on the output control signal when data transfer from a connection partner is suspended in the state transition of the second device operating as a peripheral.