[PATCH v2 5/6] pwm: enable TI PWMSS if the IIO tiecap driver is selected
The IIO TI ECAP driver depends on the TI PWMSS management driver in this subsystem. Enable PWMSS when the IIO TI ECAP driver is selected. Signed-off-by: Matt Porter mpor...@linaro.org --- drivers/pwm/Kconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/pwm/Kconfig b/drivers/pwm/Kconfig index 22f2f28..bd3cc65 100644 --- a/drivers/pwm/Kconfig +++ b/drivers/pwm/Kconfig @@ -219,7 +219,7 @@ config PWM_TIEHRPWM config PWM_TIPWMSS bool - default y if SOC_AM33XX (PWM_TIECAP || PWM_TIEHRPWM) + default y if SOC_AM33XX (IIO_TIECAP || PWM_TIECAP || PWM_TIEHRPWM) help PWM Subsystem driver support for AM33xx SOC. -- 1.8.4 -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH v2 3/6] iio: enable selection and build of pulse drivers
Add the pulse driver subdirectory when configuring and building IIO. Signed-off-by: Matt Porter mpor...@linaro.org --- drivers/iio/Kconfig | 1 + drivers/iio/Makefile | 1 + 2 files changed, 2 insertions(+) diff --git a/drivers/iio/Kconfig b/drivers/iio/Kconfig index 5dd0e12..286acc3 100644 --- a/drivers/iio/Kconfig +++ b/drivers/iio/Kconfig @@ -74,6 +74,7 @@ if IIO_TRIGGER source drivers/iio/trigger/Kconfig endif #IIO_TRIGGER source drivers/iio/pressure/Kconfig +source drivers/iio/pulse/Kconfig source drivers/iio/temperature/Kconfig endif # IIO diff --git a/drivers/iio/Makefile b/drivers/iio/Makefile index 887d390..9a953c9 100644 --- a/drivers/iio/Makefile +++ b/drivers/iio/Makefile @@ -24,5 +24,6 @@ obj-y += light/ obj-y += magnetometer/ obj-y += orientation/ obj-y += pressure/ +obj-y += pulse/ obj-y += temperature/ obj-y += trigger/ -- 1.8.4 -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH v2 1/6] iio: add support for pulse width capture devices
Add a channel type to support pulse width capture devices. These devices capture the timing of a PWM signal based on a configurable trigger Signed-off-by: Matt Porter mpor...@linaro.org --- drivers/iio/industrialio-core.c | 1 + include/linux/iio/types.h | 1 + 2 files changed, 2 insertions(+) diff --git a/drivers/iio/industrialio-core.c b/drivers/iio/industrialio-core.c index acc911a..6ea0cf8 100644 --- a/drivers/iio/industrialio-core.c +++ b/drivers/iio/industrialio-core.c @@ -70,6 +70,7 @@ static const char * const iio_chan_type_name_spec[] = { [IIO_CCT] = cct, [IIO_PRESSURE] = pressure, [IIO_HUMIDITYRELATIVE] = humidityrelative, + [IIO_PULSE] = pulse, }; static const char * const iio_modifier_names[] = { diff --git a/include/linux/iio/types.h b/include/linux/iio/types.h index 084d882..4fa8840 100644 --- a/include/linux/iio/types.h +++ b/include/linux/iio/types.h @@ -30,6 +30,7 @@ enum iio_chan_type { IIO_CCT, IIO_PRESSURE, IIO_HUMIDITYRELATIVE, + IIO_PULSE, }; enum iio_modifier { -- 1.8.4 -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH v2 2/6] iio: pulse: add TI ECAP driver
Adds support for capturing PWM signals using the TI ECAP peripheral. This driver supports triggered buffer capture of pulses on multiple ECAP instances. In addition, the driver supports configurable polarity of the signal to be captured. Signed-off-by: Matt Porter mpor...@linaro.org --- drivers/iio/pulse/Kconfig | 20 ++ drivers/iio/pulse/Makefile | 6 + drivers/iio/pulse/tiecap.c | 493 + 3 files changed, 519 insertions(+) create mode 100644 drivers/iio/pulse/Kconfig create mode 100644 drivers/iio/pulse/Makefile create mode 100644 drivers/iio/pulse/tiecap.c diff --git a/drivers/iio/pulse/Kconfig b/drivers/iio/pulse/Kconfig new file mode 100644 index 000..9864d4b --- /dev/null +++ b/drivers/iio/pulse/Kconfig @@ -0,0 +1,20 @@ +# +# Pulse Capture Devices +# +# When adding new entries keep the list in alphabetical order + +menu Pulse Capture Devices + +config IIO_TIECAP + tristate TI ECAP Pulse Capture + depends on SOC_AM33XX + select IIO_BUFFER + select IIO_TRIGGERED_BUFFER + help +If you say yes here you get support for the TI ECAP peripheral +in pulse capture mode. + +This driver can also be built as a module. If so, the module +will be called tiecap + +endmenu diff --git a/drivers/iio/pulse/Makefile b/drivers/iio/pulse/Makefile new file mode 100644 index 000..94d4b00 --- /dev/null +++ b/drivers/iio/pulse/Makefile @@ -0,0 +1,6 @@ +# +# Makefile for IIO PWM Capture Devices +# + +# When adding new entries keep the list in alphabetical order +obj-$(CONFIG_IIO_TIECAP) += tiecap.o diff --git a/drivers/iio/pulse/tiecap.c b/drivers/iio/pulse/tiecap.c new file mode 100644 index 000..3d21080 --- /dev/null +++ b/drivers/iio/pulse/tiecap.c @@ -0,0 +1,493 @@ +/* + * ECAP IIO pulse capture driver + * + * Copyright (C) 2014 Linaro Limited + * Author: Matt Porter mpor...@linaro.org + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + */ + +#include linux/clk.h +#include linux/err.h +#include linux/iio/buffer.h +#include linux/iio/iio.h +#include linux/iio/sysfs.h +#include linux/iio/trigger.h +#include linux/iio/trigger_consumer.h +#include linux/iio/triggered_buffer.h +#include linux/io.h +#include linux/interrupt.h +#include linux/irq.h +#include linux/module.h +#include linux/of_device.h +#include linux/platform_device.h +#include linux/pm_runtime.h + +#include ../../pwm/pwm-tipwmss.h + +/* ECAP regs and bits */ +#define CAP1 0x08 +#define CAP2 0x0c +#define ECCTL1 0x28 +#define ECCTL1_RUN_FREEBIT(15) +#define ECCTL1_CAPLDEN BIT(8) +#define ECCTL1_CAP2POL BIT(2) +#define ECCTL1_CTRRST1 BIT(1) +#define ECCTL1_CAP1POL BIT(0) +#define ECCTL2 0x2a +#define ECCTL2_SYNCO_SEL_DIS BIT(7) +#define ECCTL2_TSCTR_FREERUN BIT(4) +#define ECCTL2_REARM BIT(3) +#define ECCTL2_STOP_WRAP_2 BIT(1) +#define ECEINT 0x2c +#define ECFLG 0x2e +#define ECCLR 0x30 +#define ECINT_CTRCMP BIT(7) +#define ECINT_CTRPRD BIT(6) +#define ECINT_CTROVF BIT(5) +#define ECINT_CEVT4BIT(4) +#define ECINT_CEVT3BIT(3) +#define ECINT_CEVT2BIT(2) +#define ECINT_CEVT1BIT(1) +#define ECINT_ALL (ECINT_CTRCMP | \ + ECINT_CTRPRD | \ + ECINT_CTROVF | \ + ECINT_CEVT4 | \ + ECINT_CEVT3 | \ + ECINT_CEVT2 | \ + ECINT_CEVT1) + +/* ECAP driver flags */ +#define ECAP_POLARITY_HIGH BIT(1) +#define ECAP_ENABLED BIT(0) + +struct ecap_context { + u32 cap1; + u32 cap2; + u16 ecctl1; + u16 ecctl2; + u16 eceint; +}; + +struct ecap_state { + unsigned long flags; + unsigned intclk_rate; + void __iomem*regs; + u32 *buf; + struct ecap_context ctx; +}; + +#define dev_to_ecap_state(d) iio_priv(dev_to_iio_dev(d)) + +static const struct iio_chan_spec ecap_channels[] = { + { + .type = IIO_PULSE, + .channel= 0, + .info_mask_separate = + BIT(IIO_CHAN_INFO_RAW) | BIT(IIO_CHAN_INFO_SCALE), + .scan_index = 0, + .scan_type = { + .sign = 'u', + .realbits = 32, + .storagebits= 32, + .endianness = IIO_LE
[PATCH v2 4/6] iio: Add ABI docs for pulse capture devices
Add standard ABI entries for pulse capture devices. Also add a separate ABI entry for the TI ECAP driver polarity option. Signed-off-by: Matt Porter mpor...@linaro.org --- Documentation/ABI/testing/sysfs-bus-iio | 18 ++ Documentation/ABI/testing/sysfs-bus-iio-pulse-tiecap | 9 + 2 files changed, 27 insertions(+) create mode 100644 Documentation/ABI/testing/sysfs-bus-iio-pulse-tiecap diff --git a/Documentation/ABI/testing/sysfs-bus-iio b/Documentation/ABI/testing/sysfs-bus-iio index 6e02c50..918a201 100644 --- a/Documentation/ABI/testing/sysfs-bus-iio +++ b/Documentation/ABI/testing/sysfs-bus-iio @@ -210,6 +210,14 @@ Contact: linux-...@vger.kernel.org Description: Scaled humidity measurement in milli percent. +What: /sys/bus/iio/devices/iio:deviceX/in_pulseY_raw +What: /sys/bus/iio/devices/iio:deviceX/in_pulse_raw +KernelVersion: 3.15 +Contact: linux-...@vger.kernel.org +Description: + Raw pulse measurement from channel Y. Units after + application of scale and offset are nanoseconds. + What: /sys/bus/iio/devices/iio:deviceX/in_accel_offset What: /sys/bus/iio/devices/iio:deviceX/in_accel_x_offset What: /sys/bus/iio/devices/iio:deviceX/in_accel_y_offset @@ -220,6 +228,8 @@ What: /sys/bus/iio/devices/iio:deviceX/in_tempY_offset What: /sys/bus/iio/devices/iio:deviceX/in_temp_offset What: /sys/bus/iio/devices/iio:deviceX/in_pressureY_offset What: /sys/bus/iio/devices/iio:deviceX/in_pressure_offset +What: /sys/bus/iio/devices/iio:deviceX/in_pulseY_offset +What: /sys/bus/iio/devices/iio:deviceX/in_pulse_offset KernelVersion: 2.6.35 Contact: linux-...@vger.kernel.org Description: @@ -251,6 +261,8 @@ What: /sys/bus/iio/devices/iio:deviceX/in_magn_y_scale What: /sys/bus/iio/devices/iio:deviceX/in_magn_z_scale What: /sys/bus/iio/devices/iio:deviceX/in_pressureY_scale What: /sys/bus/iio/devices/iio:deviceX/in_pressure_scale +What: /sys/bus/iio/devices/iio:deviceX/in_pulseY_scale +What: /sys/bus/iio/devices/iio:deviceX/in_pulse_scale KernelVersion: 2.6.35 Contact: linux-...@vger.kernel.org Description: @@ -784,6 +796,8 @@ What: /sys/.../iio:deviceX/scan_elements/in_incli_x_en What: /sys/.../iio:deviceX/scan_elements/in_incli_y_en What: /sys/.../iio:deviceX/scan_elements/in_pressureY_en What: /sys/.../iio:deviceX/scan_elements/in_pressure_en +What: /sys/.../iio:deviceX/scan_elements/in_pulseY_en +What: /sys/.../iio:deviceX/scan_elements/in_pulse_en KernelVersion: 2.6.37 Contact: linux-...@vger.kernel.org Description: @@ -799,6 +813,8 @@ What: /sys/.../iio:deviceX/scan_elements/in_voltageY_supply_type What: /sys/.../iio:deviceX/scan_elements/in_timestamp_type What: /sys/.../iio:deviceX/scan_elements/in_pressureY_type What: /sys/.../iio:deviceX/scan_elements/in_pressure_type +What: /sys/.../iio:deviceX/scan_elements/in_pulseY_type +What: /sys/.../iio:deviceX/scan_elements/in_pulse_type KernelVersion: 2.6.37 Contact: linux-...@vger.kernel.org Description: @@ -845,6 +861,8 @@ What: /sys/.../iio:deviceX/scan_elements/in_incli_y_index What: /sys/.../iio:deviceX/scan_elements/in_timestamp_index What: /sys/.../iio:deviceX/scan_elements/in_pressureY_index What: /sys/.../iio:deviceX/scan_elements/in_pressure_index +What: /sys/.../iio:deviceX/scan_elements/in_pulseY_index +What: /sys/.../iio:deviceX/scan_elements/in_pulse_index KernelVersion: 2.6.37 Contact: linux-...@vger.kernel.org Description: diff --git a/Documentation/ABI/testing/sysfs-bus-iio-pulse-tiecap b/Documentation/ABI/testing/sysfs-bus-iio-pulse-tiecap new file mode 100644 index 000..a9e4a9f --- /dev/null +++ b/Documentation/ABI/testing/sysfs-bus-iio-pulse-tiecap @@ -0,0 +1,9 @@ +What: /sys/bus/iio/devices/iio:deviceX/pulse_polarityY +What: /sys/bus/iio/devices/iio:deviceX/pulse_polarity +Date: January 2014 +KernelVersion: 3.15 +Contact: Matt Porter mpor...@linaro.org +Description: + Get and set the polarity of the pulse signal to be captured + for channel Y. 1 indicates a high pulse signal and 0 + indicates a low pulse signal. -- 1.8.4 -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH] usb: gadget: s3c-hsotg: fix build on x86 and other architectures
The readsl and writesl I/O accessors are only defined on some architectures. The driver currently depends on CONFIG_ARM because the build breaks on x86, in particular. Switch to use of ioread32_rep and iowrite32_rep to fix build on all architectures and remove the CONFIG_ARM dependency. Also update printk formatting to handle a long long dma_addr_t to avoid warnings on !32-bit architectures. Signed-off-by: Matt Porter mpor...@linaro.org --- drivers/usb/gadget/Kconfig | 1 - drivers/usb/gadget/s3c-hsotg.c | 12 ++-- 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/drivers/usb/gadget/Kconfig b/drivers/usb/gadget/Kconfig index 8154165..782f43a 100644 --- a/drivers/usb/gadget/Kconfig +++ b/drivers/usb/gadget/Kconfig @@ -301,7 +301,6 @@ config USB_PXA27X gadget drivers to also be dynamically linked. config USB_S3C_HSOTG - depends on ARM tristate Designware/S3C HS/OtG USB Device controller help The Designware USB2.0 high-speed gadget controller diff --git a/drivers/usb/gadget/s3c-hsotg.c b/drivers/usb/gadget/s3c-hsotg.c index 1172eae..0449b76 100644 --- a/drivers/usb/gadget/s3c-hsotg.c +++ b/drivers/usb/gadget/s3c-hsotg.c @@ -617,7 +617,7 @@ static int s3c_hsotg_write_fifo(struct s3c_hsotg *hsotg, to_write = DIV_ROUND_UP(to_write, 4); data = hs_req-req.buf + buf_pos; - writesl(hsotg-regs + EPFIFO(hs_ep-index), data, to_write); + iowrite32_rep(hsotg-regs + EPFIFO(hs_ep-index), data, to_write); return (to_write = can_write) ? -ENOSPC : 0; } @@ -720,8 +720,8 @@ static void s3c_hsotg_start_req(struct s3c_hsotg *hsotg, ureq-length, ureq-actual); if (0) dev_dbg(hsotg-dev, - REQ buf %p len %d dma 0x%08x noi=%d zp=%d snok=%d\n, - ureq-buf, length, ureq-dma, + REQ buf %p len %d dma 0x%08llx noi=%d zp=%d snok=%d\n, + ureq-buf, length, (unsigned long long)ureq-dma, ureq-no_interrupt, ureq-zero, ureq-short_not_ok); maxreq = get_ep_limit(hs_ep); @@ -789,8 +789,8 @@ static void s3c_hsotg_start_req(struct s3c_hsotg *hsotg, dma_reg = dir_in ? DIEPDMA(index) : DOEPDMA(index); writel(ureq-dma, hsotg-regs + dma_reg); - dev_dbg(hsotg-dev, %s: 0x%08x = 0x%08x\n, - __func__, ureq-dma, dma_reg); + dev_dbg(hsotg-dev, %s: 0x%08llx = 0x%08x\n, + __func__, (unsigned long long)ureq-dma, dma_reg); } ctrl |= DxEPCTL_EPEna; /* ensure ep enabled */ @@ -1488,7 +1488,7 @@ static void s3c_hsotg_rx_data(struct s3c_hsotg *hsotg, int ep_idx, int size) * note, we might over-write the buffer end by 3 bytes depending on * alignment of the data. */ - readsl(fifo, hs_req-req.buf + read_ptr, to_read); + ioread32_rep(fifo, hs_req-req.buf + read_ptr, to_read); } /** -- 1.8.4 -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH 2/2] iio: Add AS3935 lightning sensor support
On Fri, Jan 31, 2014 at 10:05:07PM +0100, Alexandre Belloni wrote: > Hi Matt, > > On 30/01/2014 at 02:11:13 -0800, Matt Ranostay wrote : > > AS3935 chipset can detect lightning strikes and reports those > > back as events and the esimated distance to the storm. > > > > Signed-off-by: Matt Ranostay > > --- > > .../devicetree/bindings/iio/distance/as3935.txt| 25 ++ > > Maybe I'm wrong but wasn't the agreement that the bindings documentation > has to be sent separately to the devicetree mailing list ? That's correct. It needs to be separated for ease of review. -anothermatt -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH 2/2] iio: Add AS3935 lightning sensor support
On Fri, Jan 31, 2014 at 10:05:07PM +0100, Alexandre Belloni wrote: Hi Matt, On 30/01/2014 at 02:11:13 -0800, Matt Ranostay wrote : AS3935 chipset can detect lightning strikes and reports those back as events and the esimated distance to the storm. Signed-off-by: Matt Ranostay mranos...@gmail.com --- .../devicetree/bindings/iio/distance/as3935.txt| 25 ++ Maybe I'm wrong but wasn't the agreement that the bindings documentation has to be sent separately to the devicetree mailing list ? That's correct. It needs to be separated for ease of review. -anothermatt -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH 1/5] iio: add support for pulse width capture devices
Add a channel type to support pulse width capture devices. These devices capture the timing of a PWM signal based on a configurable trigger Signed-off-by: Matt Porter --- drivers/iio/industrialio-core.c | 1 + include/linux/iio/types.h | 1 + 2 files changed, 2 insertions(+) diff --git a/drivers/iio/industrialio-core.c b/drivers/iio/industrialio-core.c index acc911a..6ea0cf8 100644 --- a/drivers/iio/industrialio-core.c +++ b/drivers/iio/industrialio-core.c @@ -70,6 +70,7 @@ static const char * const iio_chan_type_name_spec[] = { [IIO_CCT] = "cct", [IIO_PRESSURE] = "pressure", [IIO_HUMIDITYRELATIVE] = "humidityrelative", + [IIO_PULSE] = "pulse", }; static const char * const iio_modifier_names[] = { diff --git a/include/linux/iio/types.h b/include/linux/iio/types.h index 084d882..4fa8840 100644 --- a/include/linux/iio/types.h +++ b/include/linux/iio/types.h @@ -30,6 +30,7 @@ enum iio_chan_type { IIO_CCT, IIO_PRESSURE, IIO_HUMIDITYRELATIVE, + IIO_PULSE, }; enum iio_modifier { -- 1.8.4 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH 5/5] ARM: dts: AM33XX: Add ecap interrupt properties
Add missing interrupt properties to the ecap0, ecap1, and ecap2 nodes. Signed-off-by: Matt Porter --- arch/arm/boot/dts/am33xx.dtsi | 6 ++ 1 file changed, 6 insertions(+) diff --git a/arch/arm/boot/dts/am33xx.dtsi b/arch/arm/boot/dts/am33xx.dtsi index 6d95d3d..b4139ba 100644 --- a/arch/arm/boot/dts/am33xx.dtsi +++ b/arch/arm/boot/dts/am33xx.dtsi @@ -582,6 +582,8 @@ compatible = "ti,am33xx-ecap"; #pwm-cells = <3>; reg = <0x48300100 0x80>; + interrupts = <31>; + interrupt-names = "ecap0"; ti,hwmods = "ecap0"; status = "disabled"; }; @@ -610,6 +612,8 @@ compatible = "ti,am33xx-ecap"; #pwm-cells = <3>; reg = <0x48302100 0x80>; + interrupts = <47>; + interrupt-names = "ecap1"; ti,hwmods = "ecap1"; status = "disabled"; }; @@ -638,6 +642,8 @@ compatible = "ti,am33xx-ecap"; #pwm-cells = <3>; reg = <0x48304100 0x80>; + interrupts = <61>; + interrupt-names = "ecap2"; ti,hwmods = "ecap2"; status = "disabled"; }; -- 1.8.4 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH 4/5] pwm: enable TI PWMSS if the IIO tiecap driver is selected
The IIO TI ECAP driver depends on the TI PWMSS management driver in this subsystem. Enable PWMSS when the IIO TI ECAP driver is selected. Signed-off-by: Matt Porter --- drivers/pwm/Kconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/pwm/Kconfig b/drivers/pwm/Kconfig index 22f2f28..bd3cc65 100644 --- a/drivers/pwm/Kconfig +++ b/drivers/pwm/Kconfig @@ -219,7 +219,7 @@ config PWM_TIEHRPWM config PWM_TIPWMSS bool - default y if SOC_AM33XX && (PWM_TIECAP || PWM_TIEHRPWM) + default y if SOC_AM33XX && (IIO_TIECAP || PWM_TIECAP || PWM_TIEHRPWM) help PWM Subsystem driver support for AM33xx SOC. -- 1.8.4 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH 2/5] iio: pulse: add TI ECAP driver
Adds support for capturing PWM signals using the TI ECAP peripheral. This driver supports triggered buffer capture of pulses on multiple ECAP instances. In addition, the driver supports configurable polarity of the signal to be captured. Signed-off-by: Matt Porter --- drivers/iio/pulse/Kconfig | 20 ++ drivers/iio/pulse/Makefile | 6 + drivers/iio/pulse/tiecap.c | 493 + 3 files changed, 519 insertions(+) create mode 100644 drivers/iio/pulse/Kconfig create mode 100644 drivers/iio/pulse/Makefile create mode 100644 drivers/iio/pulse/tiecap.c diff --git a/drivers/iio/pulse/Kconfig b/drivers/iio/pulse/Kconfig new file mode 100644 index 000..9864d4b --- /dev/null +++ b/drivers/iio/pulse/Kconfig @@ -0,0 +1,20 @@ +# +# Pulse Capture Devices +# +# When adding new entries keep the list in alphabetical order + +menu "Pulse Capture Devices" + +config IIO_TIECAP + tristate "TI ECAP Pulse Capture" + depends on SOC_AM33XX + select IIO_BUFFER + select IIO_TRIGGERED_BUFFER + help +If you say yes here you get support for the TI ECAP peripheral +in pulse capture mode. + +This driver can also be built as a module. If so, the module +will be called tiecap + +endmenu diff --git a/drivers/iio/pulse/Makefile b/drivers/iio/pulse/Makefile new file mode 100644 index 000..94d4b00 --- /dev/null +++ b/drivers/iio/pulse/Makefile @@ -0,0 +1,6 @@ +# +# Makefile for IIO PWM Capture Devices +# + +# When adding new entries keep the list in alphabetical order +obj-$(CONFIG_IIO_TIECAP) += tiecap.o diff --git a/drivers/iio/pulse/tiecap.c b/drivers/iio/pulse/tiecap.c new file mode 100644 index 000..8e2b3a0 --- /dev/null +++ b/drivers/iio/pulse/tiecap.c @@ -0,0 +1,493 @@ +/* + * ECAP IIO pulse capture driver + * + * Copyright (C) 2014 Linaro Limited + * Author: Matt Porter + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "../../pwm/pwm-tipwmss.h" + +/* ECAP regs and bits */ +#define CAP1 0x08 +#define CAP2 0x0c +#define ECCTL1 0x28 +#define ECCTL1_RUN_FREEBIT(15) +#define ECCTL1_CAPLDEN BIT(8) +#define ECCTL1_CAP2POL BIT(2) +#define ECCTL1_CTRRST1 BIT(1) +#define ECCTL1_CAP1POL BIT(0) +#define ECCTL2 0x2a +#define ECCTL2_SYNCO_SEL_DIS BIT(7) +#define ECCTL2_TSCTR_FREERUN BIT(4) +#define ECCTL2_REARM BIT(3) +#define ECCTL2_STOP_WRAP_2 BIT(1) +#define ECEINT 0x2c +#define ECFLG 0x2e +#define ECCLR 0x30 +#define ECINT_CTRCMP BIT(7) +#define ECINT_CTRPRD BIT(6) +#define ECINT_CTROVF BIT(5) +#define ECINT_CEVT4BIT(4) +#define ECINT_CEVT3BIT(3) +#define ECINT_CEVT2BIT(2) +#define ECINT_CEVT1BIT(1) +#define ECINT_ALL (ECINT_CTRCMP | \ + ECINT_CTRPRD | \ + ECINT_CTROVF | \ + ECINT_CEVT4 | \ + ECINT_CEVT3 | \ + ECINT_CEVT2 | \ + ECINT_CEVT1) + +/* ECAP driver flags */ +#define ECAP_POLARITY_HIGH BIT(1) +#define ECAP_ENABLED BIT(0) + +struct ecap_context { + u32 cap1; + u32 cap2; + u16 ecctl1; + u16 ecctl2; + u16 eceint; +}; + +struct ecap_state { + unsigned long flags; + unsigned intclk_rate; + void __iomem*regs; + u32 *buf; + struct ecap_context ctx; +}; + +#define dev_to_ecap_state(d) iio_priv(dev_to_iio_dev(d)) + +static const struct iio_chan_spec ecap_channels[] = { + { + .type = IIO_PULSE, + .channel= 0, + .info_mask_separate = + BIT(IIO_CHAN_INFO_RAW) | BIT(IIO_CHAN_INFO_SCALE), + .scan_index = 0, + .scan_type = { + .sign = 'u', + .realbits = 32, + .storagebits= 32, + .endianness = IIO_LE, + }, + .modified = 0, + }, + IIO_CHAN_SOFT_TIMESTAMP(1) +}; + +static ssize_t ecap_attr_show(struct device *dev, + struct device_attribute *attr, char *buf) +{ + struct ecap_state *state = dev_to_eca
[PATCH 0/5] IIO pulse capture support for TI ECAP
This series adds support for PWM capture devices within IIO and adds a TI ECAP IIO driver. PWM capture devices are supported using a new IIO "pulse" channel type. The IIO ECAP driver implements interrupt driven triggered buffer capture only as raw sample reads are not applicable to this hardware. Initially, the driver supports a single pulse width measurement with configurable polarity. The ECAP hardware can support measurement of a complete period and duty cycle but this is not yet implemented. Matt Porter (5): iio: add support for pulse width capture devices iio: pulse: add TI ECAP driver iio: enable selection and build of pulse drivers pwm: enable TI PWMSS if the IIO tiecap driver is selected ARM: dts: AM33XX: Add ecap interrupt properties arch/arm/boot/dts/am33xx.dtsi | 6 + drivers/iio/Kconfig | 1 + drivers/iio/Makefile| 1 + drivers/iio/industrialio-core.c | 1 + drivers/iio/pulse/Kconfig | 20 ++ drivers/iio/pulse/Makefile | 6 + drivers/iio/pulse/tiecap.c | 493 drivers/pwm/Kconfig | 2 +- include/linux/iio/types.h | 1 + 9 files changed, 530 insertions(+), 1 deletion(-) create mode 100644 drivers/iio/pulse/Kconfig create mode 100644 drivers/iio/pulse/Makefile create mode 100644 drivers/iio/pulse/tiecap.c -- 1.8.4 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH 3/5] iio: enable selection and build of pulse drivers
Add the pulse driver subdirectory when configuring and building IIO. Signed-off-by: Matt Porter --- drivers/iio/Kconfig | 1 + drivers/iio/Makefile | 1 + 2 files changed, 2 insertions(+) diff --git a/drivers/iio/Kconfig b/drivers/iio/Kconfig index 5dd0e12..286acc3 100644 --- a/drivers/iio/Kconfig +++ b/drivers/iio/Kconfig @@ -74,6 +74,7 @@ if IIO_TRIGGER source "drivers/iio/trigger/Kconfig" endif #IIO_TRIGGER source "drivers/iio/pressure/Kconfig" +source "drivers/iio/pulse/Kconfig" source "drivers/iio/temperature/Kconfig" endif # IIO diff --git a/drivers/iio/Makefile b/drivers/iio/Makefile index 887d390..9a953c9 100644 --- a/drivers/iio/Makefile +++ b/drivers/iio/Makefile @@ -24,5 +24,6 @@ obj-y += light/ obj-y += magnetometer/ obj-y += orientation/ obj-y += pressure/ +obj-y += pulse/ obj-y += temperature/ obj-y += trigger/ -- 1.8.4 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH 3/5] iio: enable selection and build of pulse drivers
Add the pulse driver subdirectory when configuring and building IIO. Signed-off-by: Matt Porter mpor...@linaro.org --- drivers/iio/Kconfig | 1 + drivers/iio/Makefile | 1 + 2 files changed, 2 insertions(+) diff --git a/drivers/iio/Kconfig b/drivers/iio/Kconfig index 5dd0e12..286acc3 100644 --- a/drivers/iio/Kconfig +++ b/drivers/iio/Kconfig @@ -74,6 +74,7 @@ if IIO_TRIGGER source drivers/iio/trigger/Kconfig endif #IIO_TRIGGER source drivers/iio/pressure/Kconfig +source drivers/iio/pulse/Kconfig source drivers/iio/temperature/Kconfig endif # IIO diff --git a/drivers/iio/Makefile b/drivers/iio/Makefile index 887d390..9a953c9 100644 --- a/drivers/iio/Makefile +++ b/drivers/iio/Makefile @@ -24,5 +24,6 @@ obj-y += light/ obj-y += magnetometer/ obj-y += orientation/ obj-y += pressure/ +obj-y += pulse/ obj-y += temperature/ obj-y += trigger/ -- 1.8.4 -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH 0/5] IIO pulse capture support for TI ECAP
This series adds support for PWM capture devices within IIO and adds a TI ECAP IIO driver. PWM capture devices are supported using a new IIO pulse channel type. The IIO ECAP driver implements interrupt driven triggered buffer capture only as raw sample reads are not applicable to this hardware. Initially, the driver supports a single pulse width measurement with configurable polarity. The ECAP hardware can support measurement of a complete period and duty cycle but this is not yet implemented. Matt Porter (5): iio: add support for pulse width capture devices iio: pulse: add TI ECAP driver iio: enable selection and build of pulse drivers pwm: enable TI PWMSS if the IIO tiecap driver is selected ARM: dts: AM33XX: Add ecap interrupt properties arch/arm/boot/dts/am33xx.dtsi | 6 + drivers/iio/Kconfig | 1 + drivers/iio/Makefile| 1 + drivers/iio/industrialio-core.c | 1 + drivers/iio/pulse/Kconfig | 20 ++ drivers/iio/pulse/Makefile | 6 + drivers/iio/pulse/tiecap.c | 493 drivers/pwm/Kconfig | 2 +- include/linux/iio/types.h | 1 + 9 files changed, 530 insertions(+), 1 deletion(-) create mode 100644 drivers/iio/pulse/Kconfig create mode 100644 drivers/iio/pulse/Makefile create mode 100644 drivers/iio/pulse/tiecap.c -- 1.8.4 -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH 2/5] iio: pulse: add TI ECAP driver
Adds support for capturing PWM signals using the TI ECAP peripheral. This driver supports triggered buffer capture of pulses on multiple ECAP instances. In addition, the driver supports configurable polarity of the signal to be captured. Signed-off-by: Matt Porter mpor...@linaro.org --- drivers/iio/pulse/Kconfig | 20 ++ drivers/iio/pulse/Makefile | 6 + drivers/iio/pulse/tiecap.c | 493 + 3 files changed, 519 insertions(+) create mode 100644 drivers/iio/pulse/Kconfig create mode 100644 drivers/iio/pulse/Makefile create mode 100644 drivers/iio/pulse/tiecap.c diff --git a/drivers/iio/pulse/Kconfig b/drivers/iio/pulse/Kconfig new file mode 100644 index 000..9864d4b --- /dev/null +++ b/drivers/iio/pulse/Kconfig @@ -0,0 +1,20 @@ +# +# Pulse Capture Devices +# +# When adding new entries keep the list in alphabetical order + +menu Pulse Capture Devices + +config IIO_TIECAP + tristate TI ECAP Pulse Capture + depends on SOC_AM33XX + select IIO_BUFFER + select IIO_TRIGGERED_BUFFER + help +If you say yes here you get support for the TI ECAP peripheral +in pulse capture mode. + +This driver can also be built as a module. If so, the module +will be called tiecap + +endmenu diff --git a/drivers/iio/pulse/Makefile b/drivers/iio/pulse/Makefile new file mode 100644 index 000..94d4b00 --- /dev/null +++ b/drivers/iio/pulse/Makefile @@ -0,0 +1,6 @@ +# +# Makefile for IIO PWM Capture Devices +# + +# When adding new entries keep the list in alphabetical order +obj-$(CONFIG_IIO_TIECAP) += tiecap.o diff --git a/drivers/iio/pulse/tiecap.c b/drivers/iio/pulse/tiecap.c new file mode 100644 index 000..8e2b3a0 --- /dev/null +++ b/drivers/iio/pulse/tiecap.c @@ -0,0 +1,493 @@ +/* + * ECAP IIO pulse capture driver + * + * Copyright (C) 2014 Linaro Limited + * Author: Matt Porter mpor...@linaro.org + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + */ + +#include linux/clk.h +#include linux/err.h +#include linux/iio/buffer.h +#include linux/iio/iio.h +#include linux/iio/sysfs.h +#include linux/iio/trigger.h +#include linux/iio/trigger_consumer.h +#include linux/iio/triggered_buffer.h +#include linux/io.h +#include linux/interrupt.h +#include linux/irq.h +#include linux/module.h +#include linux/of_device.h +#include linux/platform_device.h +#include linux/pm_runtime.h + +#include ../../pwm/pwm-tipwmss.h + +/* ECAP regs and bits */ +#define CAP1 0x08 +#define CAP2 0x0c +#define ECCTL1 0x28 +#define ECCTL1_RUN_FREEBIT(15) +#define ECCTL1_CAPLDEN BIT(8) +#define ECCTL1_CAP2POL BIT(2) +#define ECCTL1_CTRRST1 BIT(1) +#define ECCTL1_CAP1POL BIT(0) +#define ECCTL2 0x2a +#define ECCTL2_SYNCO_SEL_DIS BIT(7) +#define ECCTL2_TSCTR_FREERUN BIT(4) +#define ECCTL2_REARM BIT(3) +#define ECCTL2_STOP_WRAP_2 BIT(1) +#define ECEINT 0x2c +#define ECFLG 0x2e +#define ECCLR 0x30 +#define ECINT_CTRCMP BIT(7) +#define ECINT_CTRPRD BIT(6) +#define ECINT_CTROVF BIT(5) +#define ECINT_CEVT4BIT(4) +#define ECINT_CEVT3BIT(3) +#define ECINT_CEVT2BIT(2) +#define ECINT_CEVT1BIT(1) +#define ECINT_ALL (ECINT_CTRCMP | \ + ECINT_CTRPRD | \ + ECINT_CTROVF | \ + ECINT_CEVT4 | \ + ECINT_CEVT3 | \ + ECINT_CEVT2 | \ + ECINT_CEVT1) + +/* ECAP driver flags */ +#define ECAP_POLARITY_HIGH BIT(1) +#define ECAP_ENABLED BIT(0) + +struct ecap_context { + u32 cap1; + u32 cap2; + u16 ecctl1; + u16 ecctl2; + u16 eceint; +}; + +struct ecap_state { + unsigned long flags; + unsigned intclk_rate; + void __iomem*regs; + u32 *buf; + struct ecap_context ctx; +}; + +#define dev_to_ecap_state(d) iio_priv(dev_to_iio_dev(d)) + +static const struct iio_chan_spec ecap_channels[] = { + { + .type = IIO_PULSE, + .channel= 0, + .info_mask_separate = + BIT(IIO_CHAN_INFO_RAW) | BIT(IIO_CHAN_INFO_SCALE), + .scan_index = 0, + .scan_type = { + .sign = 'u', + .realbits = 32, + .storagebits= 32, + .endianness = IIO_LE
[PATCH 1/5] iio: add support for pulse width capture devices
Add a channel type to support pulse width capture devices. These devices capture the timing of a PWM signal based on a configurable trigger Signed-off-by: Matt Porter mpor...@linaro.org --- drivers/iio/industrialio-core.c | 1 + include/linux/iio/types.h | 1 + 2 files changed, 2 insertions(+) diff --git a/drivers/iio/industrialio-core.c b/drivers/iio/industrialio-core.c index acc911a..6ea0cf8 100644 --- a/drivers/iio/industrialio-core.c +++ b/drivers/iio/industrialio-core.c @@ -70,6 +70,7 @@ static const char * const iio_chan_type_name_spec[] = { [IIO_CCT] = cct, [IIO_PRESSURE] = pressure, [IIO_HUMIDITYRELATIVE] = humidityrelative, + [IIO_PULSE] = pulse, }; static const char * const iio_modifier_names[] = { diff --git a/include/linux/iio/types.h b/include/linux/iio/types.h index 084d882..4fa8840 100644 --- a/include/linux/iio/types.h +++ b/include/linux/iio/types.h @@ -30,6 +30,7 @@ enum iio_chan_type { IIO_CCT, IIO_PRESSURE, IIO_HUMIDITYRELATIVE, + IIO_PULSE, }; enum iio_modifier { -- 1.8.4 -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH 4/5] pwm: enable TI PWMSS if the IIO tiecap driver is selected
The IIO TI ECAP driver depends on the TI PWMSS management driver in this subsystem. Enable PWMSS when the IIO TI ECAP driver is selected. Signed-off-by: Matt Porter mpor...@linaro.org --- drivers/pwm/Kconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/pwm/Kconfig b/drivers/pwm/Kconfig index 22f2f28..bd3cc65 100644 --- a/drivers/pwm/Kconfig +++ b/drivers/pwm/Kconfig @@ -219,7 +219,7 @@ config PWM_TIEHRPWM config PWM_TIPWMSS bool - default y if SOC_AM33XX (PWM_TIECAP || PWM_TIEHRPWM) + default y if SOC_AM33XX (IIO_TIECAP || PWM_TIECAP || PWM_TIEHRPWM) help PWM Subsystem driver support for AM33xx SOC. -- 1.8.4 -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH 5/5] ARM: dts: AM33XX: Add ecap interrupt properties
Add missing interrupt properties to the ecap0, ecap1, and ecap2 nodes. Signed-off-by: Matt Porter mpor...@linaro.org --- arch/arm/boot/dts/am33xx.dtsi | 6 ++ 1 file changed, 6 insertions(+) diff --git a/arch/arm/boot/dts/am33xx.dtsi b/arch/arm/boot/dts/am33xx.dtsi index 6d95d3d..b4139ba 100644 --- a/arch/arm/boot/dts/am33xx.dtsi +++ b/arch/arm/boot/dts/am33xx.dtsi @@ -582,6 +582,8 @@ compatible = ti,am33xx-ecap; #pwm-cells = 3; reg = 0x48300100 0x80; + interrupts = 31; + interrupt-names = ecap0; ti,hwmods = ecap0; status = disabled; }; @@ -610,6 +612,8 @@ compatible = ti,am33xx-ecap; #pwm-cells = 3; reg = 0x48302100 0x80; + interrupts = 47; + interrupt-names = ecap1; ti,hwmods = ecap1; status = disabled; }; @@ -638,6 +642,8 @@ compatible = ti,am33xx-ecap; #pwm-cells = 3; reg = 0x48304100 0x80; + interrupts = 61; + interrupt-names = ecap2; ti,hwmods = ecap2; status = disabled; }; -- 1.8.4 -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH] pinctrl: Rename Broadcom Capri pinctrl driver
On Tue, Jan 21, 2014 at 04:59:35PM -0800, Olof Johansson wrote: > Hi, > > > On Tue, Jan 21, 2014 at 2:38 PM, Sherman Yin wrote: > > To be consistent with other Broadcom drivers, the Broadcom Capri pinctrl > > driver and its related CONFIG option are renamed to bcm281xx. > > > > Devicetree compatible string and binding documentation use > > "brcm,bcm11351-pinctrl" to match the machine binding here: > > Documentation/devicetree/bindings/arm/bcm/bcm11351.txt > > > > This driver supports pinctrl on BCM11130, BCM11140, BCM11351, BCM28145 > > and BCM28155 SoCs. > > > > Signed-off-by: Sherman Yin > > Reviewed-by: Matt Porter > > --- > > ...capri-pinctrl.txt => brcm,bcm11351-pinctrl.txt} |8 +- > > arch/arm/boot/dts/bcm11351.dtsi|2 +- > > arch/arm/configs/bcm_defconfig |2 +- > > drivers/pinctrl/Kconfig|8 +- > > drivers/pinctrl/Makefile |2 +- > > .../{pinctrl-capri.c => pinctrl-bcm281xx.c}| 1521 > > ++-- > > 6 files changed, 775 insertions(+), 768 deletions(-) > > rename Documentation/devicetree/bindings/pinctrl/{brcm,capri-pinctrl.txt > > => brcm,bcm11351-pinctrl.txt} (98%) > > rename drivers/pinctrl/{pinctrl-capri.c => pinctrl-bcm281xx.c} (25%) > > > > diff --git > > a/Documentation/devicetree/bindings/pinctrl/brcm,capri-pinctrl.txt > > b/Documentation/devicetree/bindings/pinctrl/brcm,bcm11351-pinctrl.txt > > similarity index 98% > > rename from Documentation/devicetree/bindings/pinctrl/brcm,capri-pinctrl.txt > > rename to > > Documentation/devicetree/bindings/pinctrl/brcm,bcm11351-pinctrl.txt > > index 9e9e9ef..c119deb 100644 > > --- a/Documentation/devicetree/bindings/pinctrl/brcm,capri-pinctrl.txt > > +++ b/Documentation/devicetree/bindings/pinctrl/brcm,bcm11351-pinctrl.txt > > @@ -1,4 +1,4 @@ > > -Broadcom Capri Pin Controller > > +Broadcom BCM281xx Pin Controller > > > > This is a pin controller for the Broadcom BCM281xx SoC family, which > > includes > > BCM11130, BCM11140, BCM11351, BCM28145, and BCM28155 SoCs. > > @@ -7,14 +7,14 @@ BCM11130, BCM11140, BCM11351, BCM28145, and BCM28155 SoCs. > > > > Required Properties: > > > > -- compatible: Must be "brcm,capri-pinctrl". > > +- compatible: Must be "brcm,bcm11351-pinctrl" > > Since the original binding is queued for 3.14 (I believe?), if this > rename isn't merged for 3.14 then you will still need to accept the > old compatible string (binding). You can document it as deprecated, > but the driver needs to still probe with it. Linus had mentioned that he could take a rename in 3.14-rc for this driver which is really what we had in mind here. Since the binding doesn't become stable until 3.14 is actually released I was under the impression that this is ok without keeping a deprecated compatible string. I notice that Tomasz had comments about this type of situation in http://www.spinics.net/lists/devicetree/msg18010.html -Matt -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
libusbg 0.1.0 (formerly libgadget)
libusbg 0.1.0 is released. libusbg is a library that provides a C API to the kernel USB gadget configfs API. It simplifies creation and management of USB gadget devices from C applications. Get it at: git://github.com/libusbg/libusbg.git API docs at: http://libusbg.github.com/group__libusbg.html http://libusbg.github.com/examples.html Changes since libgadget 0.0.1: - libusbg now has a new name to avoid conflicts with an existing libgadget libary - use the standard /sys/kernel/config mount path in examples - a new project home on github Going forward we have a couple contributors with clean up and bug fixes that will be rolled into libusbg once comments are addressed. Support for FunctionFS (merged for 3.14) will also be added. -Matt -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH v4 3/4] ARM: pinctrl: Add Broadcom Capri pinctrl driver
On Mon, Jan 20, 2014 at 09:16:24AM +0100, Linus Walleij wrote: > On Sat, Jan 18, 2014 at 3:56 AM, Matt Porter wrote: > > > I wonder if Linus would accept a rename at this point (too late for 3.14 > > presumably, but for 3.15) of s/capri/bcm281xx throughout, bcm11351 for > > the compatible string, as we have for the machine compatible, and also > > BCM281XX for the Kconfig option. > > Yes, if there is some consensus that this is what we want to do. > > I can certainly merge that during the 3.14-rc phase for that matter. Ok, sounds great, thanks. -Matt -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH v4 3/4] ARM: pinctrl: Add Broadcom Capri pinctrl driver
On Mon, Jan 20, 2014 at 09:16:24AM +0100, Linus Walleij wrote: On Sat, Jan 18, 2014 at 3:56 AM, Matt Porter mpor...@linaro.org wrote: I wonder if Linus would accept a rename at this point (too late for 3.14 presumably, but for 3.15) of s/capri/bcm281xx throughout, bcm11351 for the compatible string, as we have for the machine compatible, and also BCM281XX for the Kconfig option. Yes, if there is some consensus that this is what we want to do. I can certainly merge that during the 3.14-rc phase for that matter. Ok, sounds great, thanks. -Matt -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
libusbg 0.1.0 (formerly libgadget)
libusbg 0.1.0 is released. libusbg is a library that provides a C API to the kernel USB gadget configfs API. It simplifies creation and management of USB gadget devices from C applications. Get it at: git://github.com/libusbg/libusbg.git API docs at: http://libusbg.github.com/group__libusbg.html http://libusbg.github.com/examples.html Changes since libgadget 0.0.1: - libusbg now has a new name to avoid conflicts with an existing libgadget libary - use the standard /sys/kernel/config mount path in examples - a new project home on github Going forward we have a couple contributors with clean up and bug fixes that will be rolled into libusbg once comments are addressed. Support for FunctionFS (merged for 3.14) will also be added. -Matt -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH] pinctrl: Rename Broadcom Capri pinctrl driver
On Tue, Jan 21, 2014 at 04:59:35PM -0800, Olof Johansson wrote: Hi, On Tue, Jan 21, 2014 at 2:38 PM, Sherman Yin s...@broadcom.com wrote: To be consistent with other Broadcom drivers, the Broadcom Capri pinctrl driver and its related CONFIG option are renamed to bcm281xx. Devicetree compatible string and binding documentation use brcm,bcm11351-pinctrl to match the machine binding here: Documentation/devicetree/bindings/arm/bcm/bcm11351.txt This driver supports pinctrl on BCM11130, BCM11140, BCM11351, BCM28145 and BCM28155 SoCs. Signed-off-by: Sherman Yin s...@broadcom.com Reviewed-by: Matt Porter mpor...@linaro.org --- ...capri-pinctrl.txt = brcm,bcm11351-pinctrl.txt} |8 +- arch/arm/boot/dts/bcm11351.dtsi|2 +- arch/arm/configs/bcm_defconfig |2 +- drivers/pinctrl/Kconfig|8 +- drivers/pinctrl/Makefile |2 +- .../{pinctrl-capri.c = pinctrl-bcm281xx.c}| 1521 ++-- 6 files changed, 775 insertions(+), 768 deletions(-) rename Documentation/devicetree/bindings/pinctrl/{brcm,capri-pinctrl.txt = brcm,bcm11351-pinctrl.txt} (98%) rename drivers/pinctrl/{pinctrl-capri.c = pinctrl-bcm281xx.c} (25%) diff --git a/Documentation/devicetree/bindings/pinctrl/brcm,capri-pinctrl.txt b/Documentation/devicetree/bindings/pinctrl/brcm,bcm11351-pinctrl.txt similarity index 98% rename from Documentation/devicetree/bindings/pinctrl/brcm,capri-pinctrl.txt rename to Documentation/devicetree/bindings/pinctrl/brcm,bcm11351-pinctrl.txt index 9e9e9ef..c119deb 100644 --- a/Documentation/devicetree/bindings/pinctrl/brcm,capri-pinctrl.txt +++ b/Documentation/devicetree/bindings/pinctrl/brcm,bcm11351-pinctrl.txt @@ -1,4 +1,4 @@ -Broadcom Capri Pin Controller +Broadcom BCM281xx Pin Controller This is a pin controller for the Broadcom BCM281xx SoC family, which includes BCM11130, BCM11140, BCM11351, BCM28145, and BCM28155 SoCs. @@ -7,14 +7,14 @@ BCM11130, BCM11140, BCM11351, BCM28145, and BCM28155 SoCs. Required Properties: -- compatible: Must be brcm,capri-pinctrl. +- compatible: Must be brcm,bcm11351-pinctrl Since the original binding is queued for 3.14 (I believe?), if this rename isn't merged for 3.14 then you will still need to accept the old compatible string (binding). You can document it as deprecated, but the driver needs to still probe with it. Linus had mentioned that he could take a rename in 3.14-rc for this driver which is really what we had in mind here. Since the binding doesn't become stable until 3.14 is actually released I was under the impression that this is ok without keeping a deprecated compatible string. I notice that Tomasz had comments about this type of situation in http://www.spinics.net/lists/devicetree/msg18010.html -Matt -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH v4 3/4] ARM: pinctrl: Add Broadcom Capri pinctrl driver
On Fri, Jan 17, 2014 at 11:59:21AM -0800, Sherman Yin wrote: > On 14-01-16 05:19 AM, Linus Walleij wrote: > >On Sat, Dec 21, 2013 at 3:13 AM, Sherman Yin wrote: > > > >'> Adds pinctrl driver for Broadcom Capri (BCM281xx) SoCs. > >> > >>Signed-off-by: Sherman Yin > >>Reviewed-by: Christian Daudt > >>Reviewed-by: Matt Porter > >>--- > >>v4: - PINCTRL selected in Kconfig, PINCTRL_CAPRI selected in bcm_defconfig > >> - make use of regmap > >> - change CAPRI_PIN_UPDATE from macro to inline function. > >> - Handle pull-up strength arg in Ohm instead of enum > > > >Patch applied. It is really good now! It's late before the merge > >window, but you've done a tremendous work on this driver and > >I don't want to delay its deployment further. > > Great, thanks for the support and reviews! Very nice! Now after having completely missing something fundamental on my reviews, I feel compelled to bring it up at the 11^H^H12th hour. That is, this is the *only* BCM281xx driver to be named Capri, both in the filename and driver code, but also in the binding compatible. We didn't do that on anything else that's gone upstream to date. This really introduces an unfortunate inconsistency as it obscures which SoC family this binding and driver belong with. I wonder if Linus would accept a rename at this point (too late for 3.14 presumably, but for 3.15) of s/capri/bcm281xx throughout, bcm11351 for the compatible string, as we have for the machine compatible, and also BCM281XX for the Kconfig option. If not, I'll survive, but it pains me to see one thing completely different out of this entire family. If nothing else, it would be great to address the compatible string before this hits the 3.14 release. Linus? -Matt -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH v4 3/4] ARM: pinctrl: Add Broadcom Capri pinctrl driver
On Fri, Jan 17, 2014 at 11:59:21AM -0800, Sherman Yin wrote: On 14-01-16 05:19 AM, Linus Walleij wrote: On Sat, Dec 21, 2013 at 3:13 AM, Sherman Yin s...@broadcom.com wrote: ' Adds pinctrl driver for Broadcom Capri (BCM281xx) SoCs. Signed-off-by: Sherman Yin s...@broadcom.com Reviewed-by: Christian Daudt b...@fixthebug.org Reviewed-by: Matt Porter matt.por...@linaro.org --- v4: - PINCTRL selected in Kconfig, PINCTRL_CAPRI selected in bcm_defconfig - make use of regmap - change CAPRI_PIN_UPDATE from macro to inline function. - Handle pull-up strength arg in Ohm instead of enum Patch applied. It is really good now! It's late before the merge window, but you've done a tremendous work on this driver and I don't want to delay its deployment further. Great, thanks for the support and reviews! Very nice! Now after having completely missing something fundamental on my reviews, I feel compelled to bring it up at the 11^H^H12th hour. That is, this is the *only* BCM281xx driver to be named Capri, both in the filename and driver code, but also in the binding compatible. We didn't do that on anything else that's gone upstream to date. This really introduces an unfortunate inconsistency as it obscures which SoC family this binding and driver belong with. I wonder if Linus would accept a rename at this point (too late for 3.14 presumably, but for 3.15) of s/capri/bcm281xx throughout, bcm11351 for the compatible string, as we have for the machine compatible, and also BCM281XX for the Kconfig option. If not, I'll survive, but it pains me to see one thing completely different out of this entire family. If nothing else, it would be great to address the compatible string before this hits the 3.14 release. Linus? -Matt -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH v9 0/9] USB Device Controller support for BCM281xx
Changes since v8: - Fix build issue in s3c-hsotg on !ARM by guarding with a "depends on ARM". Will fix by replacing use of readsl/writesl for 3.15 and dropping the Kconfig workaround.. Changes since v7: - Register phy provider with generic phy subsystem only after the generic phy has been allocated and configured. Changes since v6: - Drop dependency on the Exynos generic phy conversion series - Bring back original patch that converts s3c-hsotg to use the generic phy layer with a fall back to the old usb style phy support. Changes since v5: - tweak s3c-hsotg Kconfig help message to be more generic Changes since v4: - phy_set/get_bus_width now use an int for bus_width Changes since v3: - Rebased on 3.13-rc3 - Move struct phy bus_width attribute back into struct phy_attrs - Fix build issue on !GENERIC_PHY - Update dwc2 binding to reflect optional phy properties - Rename bcm-kona-phy.txt binding to bcm-phy.txt - Reorder bcm kona phy includes and use bitops - phy-names changed to "usb2-phy" to match updated s3c-hsotg generic phy-ification series Changes since v2: - Rebased on 3.13-rc1 - Fix braces in phy_get_bus_width()/phy_set_bus_width() - Drop generic phy conversion to use the same support from the Exynos generic phy conversion series - Modify dts support to match the "device" phy name required in the v3 Exynos generic phy conversion - Add s3c-hsotg phy_init/phy_exit support - Fix typo on reg property in kona phy binding - Replace phy driver reg struct with offset defines - Move phy soft reset to phy driver init - Fix dts node names to match ePAPR conventions Changes since v1: - Convert USB phy driver to generic phy subsystem - Add phy bus width apis - Drop dwc2 phy bus width DT property in favor of querying the phy provider for bus width - Add generic phy/clock properties to dwc2 DT binding - Add generic phy subsystem support to s3c-hsotg with the existing usb phy and pdata phy methods as a fallback - Split bindings out to separate patches to match the latest DT binding review guidelines This series adds USB Device Controller support for the Broadcom BCM281xx family of parts. BCM281xx contains a DWC2 OTG block and s3c-hsotg is used to support UDC operation. Part 1 adds phy bus width support to the generic phy subsystem Parts 2-6 allows s3c-hsotg to build on non-Samsung platforms, supports the dwc2 binding, adds generic phy layer support, and supports fetching phy bus width using the generic phy layer. Parts 7-8 add a generic phy binding and driver for the BCM Kona USB PHY. Part 9 adds the DT nodes to enable UDC support on both BCM281xx boards in the kernel. This series depends on: - "Update Kona drivers to use clocks" v4 series https://lkml.org/lkml/2013/12/5/508 (relevant portion now queued for 3.14) Matt Porter (9): phy: add phy_get_bus_width()/phy_set_bus_width() calls staging: dwc2: update DT binding to add generic clock/phy properties usb: gadget: s3c-hsotg: enable build for other platforms usb: gadget: s3c-hsotg: add snps,dwc2 compatible string usb: gadget: s3c-hsotg: enable generic phy support usb: gadget: s3c-hsotg: get phy bus width from phy subsystem phy: add Broadcom Kona USB2 PHY DT binding phy: add Broadcom Kona USB2 PHY driver ARM: dts: add usb udc support to bcm281xx Documentation/devicetree/bindings/phy/bcm-phy.txt | 15 ++ Documentation/devicetree/bindings/staging/dwc2.txt | 12 ++ arch/arm/boot/dts/bcm11351-brt.dts | 6 + arch/arm/boot/dts/bcm11351.dtsi| 18 +++ arch/arm/boot/dts/bcm28155-ap.dts | 8 ++ drivers/phy/Kconfig| 6 + drivers/phy/Makefile | 1 + drivers/phy/phy-bcm-kona-usb2.c| 158 + drivers/usb/gadget/Kconfig | 8 +- drivers/usb/gadget/s3c-hsotg.c | 72 +++--- drivers/usb/gadget/s3c-hsotg.h | 1 + include/linux/phy/phy.h| 28 12 files changed, 310 insertions(+), 23 deletions(-) create mode 100644 Documentation/devicetree/bindings/phy/bcm-phy.txt create mode 100644 drivers/phy/phy-bcm-kona-usb2.c -- 1.8.4 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH v9 2/9] staging: dwc2: update DT binding to add generic clock/phy properties
dwc2/s3c-hsotg require a single clock to be specified and optionally a generic phy. On the s3c-hsotg driver old style USB phy support is present as a fallback so the generic phy properties are optional. Signed-off-by: Matt Porter Acked-by: Kishon Vijay Abraham I --- Documentation/devicetree/bindings/staging/dwc2.txt | 12 1 file changed, 12 insertions(+) diff --git a/Documentation/devicetree/bindings/staging/dwc2.txt b/Documentation/devicetree/bindings/staging/dwc2.txt index 1a1b7cf..a1753ed 100644 --- a/Documentation/devicetree/bindings/staging/dwc2.txt +++ b/Documentation/devicetree/bindings/staging/dwc2.txt @@ -5,6 +5,14 @@ Required properties: - compatible : "snps,dwc2" - reg : Should contain 1 register range (address and length) - interrupts : Should contain 1 interrupt +- clocks: clock provider specifier +- clock-names: shall be "otg" +Refer to clk/clock-bindings.txt for generic clock consumer properties + +Optional properties: +- phys: phy provider specifier +- phy-names: shall be "device" +Refer to phy/phy-bindings.txt for generic phy consumer properties Example: @@ -12,4 +20,8 @@ Example: compatible = "ralink,rt3050-usb, snps,dwc2"; reg = <0x101c 4>; interrupts = <18>; + clocks = <_otg_ahb_clk>; + clock-names = "otg"; + phys = <>; + phy-names = "usb2-phy"; }; -- 1.8.4 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH v9 4/9] usb: gadget: s3c-hsotg: add snps,dwc2 compatible string
Enable support for the dwc2 binding. Signed-off-by: Matt Porter --- drivers/usb/gadget/s3c-hsotg.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/usb/gadget/s3c-hsotg.c b/drivers/usb/gadget/s3c-hsotg.c index db797f2..cbfbf41 100644 --- a/drivers/usb/gadget/s3c-hsotg.c +++ b/drivers/usb/gadget/s3c-hsotg.c @@ -3726,6 +3726,7 @@ static int s3c_hsotg_remove(struct platform_device *pdev) #ifdef CONFIG_OF static const struct of_device_id s3c_hsotg_of_ids[] = { { .compatible = "samsung,s3c6400-hsotg", }, + { .compatible = "snps,dwc2", }, { /* sentinel */ } }; MODULE_DEVICE_TABLE(of, s3c_hsotg_of_ids); -- 1.8.4 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH v9 3/9] usb: gadget: s3c-hsotg: enable build for other platforms
Remove unused Samsung-specific machine include and Kconfig dependency on S3C. Signed-off-by: Matt Porter Reviewed-by: Markus Mayer Reviewed-by: Tim Kryger --- drivers/usb/gadget/Kconfig | 8 drivers/usb/gadget/s3c-hsotg.c | 2 -- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/drivers/usb/gadget/Kconfig b/drivers/usb/gadget/Kconfig index a91e642..cf955f5 100644 --- a/drivers/usb/gadget/Kconfig +++ b/drivers/usb/gadget/Kconfig @@ -294,11 +294,11 @@ config USB_PXA27X gadget drivers to also be dynamically linked. config USB_S3C_HSOTG - tristate "S3C HS/OtG USB Device controller" - depends on S3C_DEV_USB_HSOTG + tristate "Designware/S3C HS/OtG USB Device controller" + depends on ARM help - The Samsung S3C64XX USB2.0 high-speed gadget controller - integrated into the S3C64XX series SoC. + The Designware USB2.0 high-speed gadget controller + integrated into many SoCs. config USB_S3C2410 tristate "S3C2410 USB Device Controller" diff --git a/drivers/usb/gadget/s3c-hsotg.c b/drivers/usb/gadget/s3c-hsotg.c index 9875d9c..db797f2 100644 --- a/drivers/usb/gadget/s3c-hsotg.c +++ b/drivers/usb/gadget/s3c-hsotg.c @@ -36,8 +36,6 @@ #include #include -#include - #include "s3c-hsotg.h" static const char * const s3c_hsotg_supply_names[] = { -- 1.8.4 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH v9 5/9] usb: gadget: s3c-hsotg: enable generic phy support
Adds support for the generic PHY subsystem. Generic PHY support is probed and then the driver falls back to checking for an old style USB PHY and pdata if not found. Signed-off-by: Matt Porter --- drivers/usb/gadget/s3c-hsotg.c | 55 ++ 1 file changed, 39 insertions(+), 16 deletions(-) diff --git a/drivers/usb/gadget/s3c-hsotg.c b/drivers/usb/gadget/s3c-hsotg.c index cbfbf41..8f9bcdb 100644 --- a/drivers/usb/gadget/s3c-hsotg.c +++ b/drivers/usb/gadget/s3c-hsotg.c @@ -30,6 +30,8 @@ #include #include #include +#include +#include #include #include @@ -138,6 +140,7 @@ struct s3c_hsotg_ep { * @dev: The parent device supplied to the probe function * @driver: USB gadget driver * @phy: The otg phy transceiver structure for phy control. + * @uphy: The otg phy transceiver structure for old USB phy control. * @plat: The platform specific configuration data. This can be removed once * all SoCs support usb transceiver. * @regs: The memory area mapped for accessing registers. @@ -159,7 +162,8 @@ struct s3c_hsotg_ep { struct s3c_hsotg { struct device*dev; struct usb_gadget_driver *driver; - struct usb_phy *phy; + struct phy *phy; + struct usb_phy *uphy; struct s3c_hsotg_plat*plat; spinlock_t lock; @@ -2901,8 +2905,11 @@ static void s3c_hsotg_phy_enable(struct s3c_hsotg *hsotg) dev_dbg(hsotg->dev, "pdev 0x%p\n", pdev); - if (hsotg->phy) - usb_phy_init(hsotg->phy); + if (hsotg->phy) { + phy_init(hsotg->phy); + phy_power_on(hsotg->phy); + } else if (hsotg->uphy) + usb_phy_init(hsotg->uphy); else if (hsotg->plat->phy_init) hsotg->plat->phy_init(pdev, hsotg->plat->phy_type); } @@ -2918,8 +2925,11 @@ static void s3c_hsotg_phy_disable(struct s3c_hsotg *hsotg) { struct platform_device *pdev = to_platform_device(hsotg->dev); - if (hsotg->phy) - usb_phy_shutdown(hsotg->phy); + if (hsotg->phy) { + phy_power_off(hsotg->phy); + phy_exit(hsotg->phy); + } else if (hsotg->uphy) + usb_phy_shutdown(hsotg->uphy); else if (hsotg->plat->phy_exit) hsotg->plat->phy_exit(pdev, hsotg->plat->phy_type); } @@ -3526,7 +3536,8 @@ static void s3c_hsotg_delete_debug(struct s3c_hsotg *hsotg) static int s3c_hsotg_probe(struct platform_device *pdev) { struct s3c_hsotg_plat *plat = dev_get_platdata(>dev); - struct usb_phy *phy; + struct phy *phy; + struct usb_phy *uphy; struct device *dev = >dev; struct s3c_hsotg_ep *eps; struct s3c_hsotg *hsotg; @@ -3541,19 +3552,26 @@ static int s3c_hsotg_probe(struct platform_device *pdev) return -ENOMEM; } - phy = devm_usb_get_phy(dev, USB_PHY_TYPE_USB2); + /* +* Attempt to find a generic PHY, then look for an old style +* USB PHY, finally fall back to pdata +*/ + phy = devm_phy_get(>dev, "usb2-phy"); if (IS_ERR(phy)) { - /* Fallback for pdata */ - plat = dev_get_platdata(>dev); - if (!plat) { - dev_err(>dev, "no platform data or transceiver defined\n"); - return -EPROBE_DEFER; - } else { + uphy = devm_usb_get_phy(dev, USB_PHY_TYPE_USB2); + if (IS_ERR(uphy)) { + /* Fallback for pdata */ + plat = dev_get_platdata(>dev); + if (!plat) { + dev_err(>dev, + "no platform data or transceiver defined\n"); + return -EPROBE_DEFER; + } hsotg->plat = plat; - } - } else { + } else + hsotg->uphy = uphy; + } else hsotg->phy = phy; - } hsotg->dev = dev; @@ -3620,6 +3638,9 @@ static int s3c_hsotg_probe(struct platform_device *pdev) goto err_supplies; } + if (hsotg->phy) + phy_init(hsotg->phy); + /* usb phy enable */ s3c_hsotg_phy_enable(hsotg); @@ -3713,6 +3734,8 @@ static int s3c_hsotg_remove(struct platform_device *pdev) } s3c_hsotg_phy_disable(hsotg); + if (hsotg->phy) + phy_exit(hsotg->phy); clk_disable_unprepare(hsotg->clk); return 0; -- 1.8.4 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH v9 8/9] phy: add Broadcom Kona USB2 PHY driver
Add a driver for the internal Broadcom Kona USB 2.0 PHY found on the BCM281xx family of SoCs. Signed-off-by: Matt Porter --- drivers/phy/Kconfig | 6 ++ drivers/phy/Makefile| 1 + drivers/phy/phy-bcm-kona-usb2.c | 158 3 files changed, 165 insertions(+) create mode 100644 drivers/phy/phy-bcm-kona-usb2.c diff --git a/drivers/phy/Kconfig b/drivers/phy/Kconfig index a344f3d..2e87fa8 100644 --- a/drivers/phy/Kconfig +++ b/drivers/phy/Kconfig @@ -51,4 +51,10 @@ config PHY_EXYNOS_DP_VIDEO help Support for Display Port PHY found on Samsung EXYNOS SoCs. +config BCM_KONA_USB2_PHY + tristate "Broadcom Kona USB2 PHY Driver" + depends on GENERIC_PHY + help + Enable this to support the Broadcom Kona USB 2.0 PHY. + endmenu diff --git a/drivers/phy/Makefile b/drivers/phy/Makefile index d0caae9..c447f1a 100644 --- a/drivers/phy/Makefile +++ b/drivers/phy/Makefile @@ -3,6 +3,7 @@ # obj-$(CONFIG_GENERIC_PHY) += phy-core.o +obj-$(CONFIG_BCM_KONA_USB2_PHY)+= phy-bcm-kona-usb2.o obj-$(CONFIG_PHY_EXYNOS_DP_VIDEO) += phy-exynos-dp-video.o obj-$(CONFIG_PHY_EXYNOS_MIPI_VIDEO)+= phy-exynos-mipi-video.o obj-$(CONFIG_OMAP_USB2)+= phy-omap-usb2.o diff --git a/drivers/phy/phy-bcm-kona-usb2.c b/drivers/phy/phy-bcm-kona-usb2.c new file mode 100644 index 000..efc5c1a --- /dev/null +++ b/drivers/phy/phy-bcm-kona-usb2.c @@ -0,0 +1,158 @@ +/* + * phy-bcm-kona-usb2.c - Broadcom Kona USB2 Phy Driver + * + * Copyright (C) 2013 Linaro Limited + * Matt Porter + * + * This software is licensed under the terms of the GNU General Public + * License version 2, as published by the Free Software Foundation, and + * may be copied, distributed, and modified under those terms. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + */ + +#include +#include +#include +#include +#include +#include +#include +#include + +#define OTGCTL (0) +#define OTGCTL_OTGSTAT2BIT(31) +#define OTGCTL_OTGSTAT1BIT(30) +#define OTGCTL_PRST_N_SW BIT(11) +#define OTGCTL_HRESET_NBIT(10) +#define OTGCTL_UTMI_LINE_STATE1BIT(9) +#define OTGCTL_UTMI_LINE_STATE0BIT(8) + +#define P1CTL (8) +#define P1CTL_SOFT_RESET BIT(1) +#define P1CTL_NON_DRIVING BIT(0) + +struct bcm_kona_usb { + void __iomem *regs; +}; + +static void bcm_kona_usb_phy_power(struct bcm_kona_usb *phy, int on) +{ + u32 val; + + val = readl(phy->regs + OTGCTL); + if (on) { + /* Configure and power PHY */ + val &= ~(OTGCTL_OTGSTAT2 | OTGCTL_OTGSTAT1 | +OTGCTL_UTMI_LINE_STATE1 | OTGCTL_UTMI_LINE_STATE0); + val |= OTGCTL_PRST_N_SW | OTGCTL_HRESET_N; + } else { + val &= ~(OTGCTL_PRST_N_SW | OTGCTL_HRESET_N); + } + writel(val, phy->regs + OTGCTL); +} + +static int bcm_kona_usb_phy_init(struct phy *gphy) +{ + struct bcm_kona_usb *phy = phy_get_drvdata(gphy); + u32 val; + + /* Soft reset PHY */ + val = readl(phy->regs + P1CTL); + val &= ~P1CTL_NON_DRIVING; + val |= P1CTL_SOFT_RESET; + writel(val, phy->regs + P1CTL); + writel(val & ~P1CTL_SOFT_RESET, phy->regs + P1CTL); + /* Reset needs to be asserted for 2ms */ + mdelay(2); + writel(val | P1CTL_SOFT_RESET, phy->regs + P1CTL); + + return 0; +} + +static int bcm_kona_usb_phy_power_on(struct phy *gphy) +{ + struct bcm_kona_usb *phy = phy_get_drvdata(gphy); + + bcm_kona_usb_phy_power(phy, 1); + + return 0; +} + +static int bcm_kona_usb_phy_power_off(struct phy *gphy) +{ + struct bcm_kona_usb *phy = phy_get_drvdata(gphy); + + bcm_kona_usb_phy_power(phy, 0); + + return 0; +} + +static struct phy_ops ops = { + .init = bcm_kona_usb_phy_init, + .power_on = bcm_kona_usb_phy_power_on, + .power_off = bcm_kona_usb_phy_power_off, + .owner = THIS_MODULE, +}; + +static int bcm_kona_usb2_probe(struct platform_device *pdev) +{ + struct device *dev = >dev; + struct bcm_kona_usb *phy; + struct resource *res; + struct phy *gphy; + struct phy_provider *phy_provider; + + phy = devm_kzalloc(dev, sizeof(*phy), GFP_KERNEL); + if (!phy) + return -ENOMEM; + + res = platform_get_resource(pdev, IORESOURCE_MEM, 0); + phy->regs = devm_ioremap_resource(>dev, res); + if (IS_ERR(phy->regs)) + return PTR_ERR(phy->regs); + + platform_set_drvdata(pdev, phy); + + g
[PATCH v9 6/9] usb: gadget: s3c-hsotg: get phy bus width from phy subsystem
Adds support for querying the phy bus width from the generic phy subsystem. Configure UTMI bus width in GUSBCFG based on this value. Signed-off-by: Matt Porter Acked-by: Kishon Vijay Abraham I --- drivers/usb/gadget/s3c-hsotg.c | 14 +- drivers/usb/gadget/s3c-hsotg.h | 1 + 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/drivers/usb/gadget/s3c-hsotg.c b/drivers/usb/gadget/s3c-hsotg.c index 8f9bcdb..93ba8b6 100644 --- a/drivers/usb/gadget/s3c-hsotg.c +++ b/drivers/usb/gadget/s3c-hsotg.c @@ -146,6 +146,7 @@ struct s3c_hsotg_ep { * @regs: The memory area mapped for accessing registers. * @irq: The IRQ number we are using * @supplies: Definition of USB power supplies + * @phyif: PHY interface width * @dedicated_fifos: Set if the hardware has dedicated IN-EP fifos. * @num_of_eps: Number of available EPs (excluding EP0) * @debug_root: root directrory for debugfs. @@ -174,6 +175,7 @@ struct s3c_hsotg { struct regulator_bulk_data supplies[ARRAY_SIZE(s3c_hsotg_supply_names)]; + u32 phyif; unsigned intdedicated_fifos:1; unsigned char num_of_eps; @@ -2279,7 +2281,7 @@ static void s3c_hsotg_core_init(struct s3c_hsotg *hsotg) */ /* set the PLL on, remove the HNP/SRP and set the PHY */ - writel(GUSBCFG_PHYIf16 | GUSBCFG_TOutCal(7) | + writel(hsotg->phyif | GUSBCFG_TOutCal(7) | (0x5 << 10), hsotg->regs + GUSBCFG); s3c_hsotg_init_fifo(hsotg); @@ -3638,6 +3640,16 @@ static int s3c_hsotg_probe(struct platform_device *pdev) goto err_supplies; } + /* Set default UTMI width */ + hsotg->phyif = GUSBCFG_PHYIf16; + + /* +* If using the generic PHY framework, check if the PHY bus +* width is 8-bit and set the phyif appropriately. +*/ + if (hsotg->phy && (phy_get_bus_width(phy) == 8)) + hsotg->phyif = GUSBCFG_PHYIf8; + if (hsotg->phy) phy_init(hsotg->phy); diff --git a/drivers/usb/gadget/s3c-hsotg.h b/drivers/usb/gadget/s3c-hsotg.h index d650b12..85f549f 100644 --- a/drivers/usb/gadget/s3c-hsotg.h +++ b/drivers/usb/gadget/s3c-hsotg.h @@ -55,6 +55,7 @@ #define GUSBCFG_HNPCap (1 << 9) #define GUSBCFG_SRPCap (1 << 8) #define GUSBCFG_PHYIf16(1 << 3) +#define GUSBCFG_PHYIf8 (0 << 3) #define GUSBCFG_TOutCal_MASK (0x7 << 0) #define GUSBCFG_TOutCal_SHIFT (0) #define GUSBCFG_TOutCal_LIMIT (0x7) -- 1.8.4 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH v9 9/9] ARM: dts: add usb udc support to bcm281xx
Adds USB OTG/PHY and clock support to BCM281xx and enables UDC support on the bcm11351-brt and bcm28155-ap boards. Signed-off-by: Matt Porter Reviewed-by: Markus Mayer Reviewed-by: Tim Kryger --- arch/arm/boot/dts/bcm11351-brt.dts | 6 ++ arch/arm/boot/dts/bcm11351.dtsi| 18 ++ arch/arm/boot/dts/bcm28155-ap.dts | 8 3 files changed, 32 insertions(+) diff --git a/arch/arm/boot/dts/bcm11351-brt.dts b/arch/arm/boot/dts/bcm11351-brt.dts index 23cd16d..396b704 100644 --- a/arch/arm/boot/dts/bcm11351-brt.dts +++ b/arch/arm/boot/dts/bcm11351-brt.dts @@ -44,5 +44,11 @@ status = "okay"; }; + usbotg: usb@3f12 { + status = "okay"; + }; + usbphy: usb-phy@3f13 { + status = "okay"; + }; }; diff --git a/arch/arm/boot/dts/bcm11351.dtsi b/arch/arm/boot/dts/bcm11351.dtsi index 1246885..0fbb455 100644 --- a/arch/arm/boot/dts/bcm11351.dtsi +++ b/arch/arm/boot/dts/bcm11351.dtsi @@ -243,4 +243,22 @@ #clock-cells = <0>; }; }; + + usbotg: usb@3f12 { + compatible = "snps,dwc2"; + reg = <0x3f12 0x1>; + interrupts = ; + clocks = <_otg_ahb_clk>; + clock-names = "otg"; + phys = <>; + phy-names = "usb2-phy"; + status = "disabled"; + }; + + usbphy: usb-phy@3f13 { + compatible = "brcm,kona-usb2-phy"; + reg = <0x3f13 0x28>; + #phy-cells = <0>; + status = "disabled"; + }; }; diff --git a/arch/arm/boot/dts/bcm28155-ap.dts b/arch/arm/boot/dts/bcm28155-ap.dts index 08e47c2..a3bc436 100644 --- a/arch/arm/boot/dts/bcm28155-ap.dts +++ b/arch/arm/boot/dts/bcm28155-ap.dts @@ -43,4 +43,12 @@ cd-gpios = < 14 0>; status = "okay"; }; + + usbotg: usb@3f12 { + status = "okay"; + }; + + usbphy: usb-phy@3f13 { + status = "okay"; + }; }; -- 1.8.4 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH v9 7/9] phy: add Broadcom Kona USB2 PHY DT binding
Add a binding that describes the Broadcom Kona USB2 PHY found on the BCM281xx family of SoCs. Signed-off-by: Matt Porter Acked-by: Kishon Vijay Abraham I --- Documentation/devicetree/bindings/phy/bcm-phy.txt | 15 +++ 1 file changed, 15 insertions(+) create mode 100644 Documentation/devicetree/bindings/phy/bcm-phy.txt diff --git a/Documentation/devicetree/bindings/phy/bcm-phy.txt b/Documentation/devicetree/bindings/phy/bcm-phy.txt new file mode 100644 index 000..3dc8b3d --- /dev/null +++ b/Documentation/devicetree/bindings/phy/bcm-phy.txt @@ -0,0 +1,15 @@ +BROADCOM KONA USB2 PHY + +Required properties: + - compatible: brcm,kona-usb2-phy + - reg: offset and length of the PHY registers + - #phy-cells: must be 0 +Refer to phy/phy-bindings.txt for the generic PHY binding properties + +Example: + + usbphy: usb-phy@3f13 { + compatible = "brcm,kona-usb2-phy"; + reg = <0x3f13 0x28>; + #phy-cells = <0>; + }; -- 1.8.4 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH v9 1/9] phy: add phy_get_bus_width()/phy_set_bus_width() calls
This adds a pair of APIs that allows the generic PHY subsystem to provide information on the PHY bus width. The PHY provider driver may use phy_set_bus_width() to set the bus width that the PHY supports. The controller driver may then use phy_get_bus_width() to fetch the PHY bus width in order to properly configure the controller. Signed-off-by: Matt Porter Acked-by: Kishon Vijay Abraham I --- include/linux/phy/phy.h | 28 1 file changed, 28 insertions(+) diff --git a/include/linux/phy/phy.h b/include/linux/phy/phy.h index 6d72269..e273e5a 100644 --- a/include/linux/phy/phy.h +++ b/include/linux/phy/phy.h @@ -38,6 +38,14 @@ struct phy_ops { }; /** + * struct phy_attrs - represents phy attributes + * @bus_width: Data path width implemented by PHY + */ +struct phy_attrs { + u32 bus_width; +}; + +/** * struct phy - represents the phy device * @dev: phy device * @id: id of the phy device @@ -46,6 +54,7 @@ struct phy_ops { * @mutex: mutex to protect phy_ops * @init_count: used to protect when the PHY is used by multiple consumers * @power_count: used to protect when the PHY is used by multiple consumers + * @phy_attrs: used to specify PHY specific attributes */ struct phy { struct device dev; @@ -55,6 +64,7 @@ struct phy { struct mutexmutex; int init_count; int power_count; + struct phy_attrsattrs; }; /** @@ -127,6 +137,14 @@ int phy_init(struct phy *phy); int phy_exit(struct phy *phy); int phy_power_on(struct phy *phy); int phy_power_off(struct phy *phy); +static inline int phy_get_bus_width(struct phy *phy) +{ + return phy->attrs.bus_width; +} +static inline void phy_set_bus_width(struct phy *phy, int bus_width) +{ + phy->attrs.bus_width = bus_width; +} struct phy *phy_get(struct device *dev, const char *string); struct phy *devm_phy_get(struct device *dev, const char *string); void phy_put(struct phy *phy); @@ -199,6 +217,16 @@ static inline int phy_power_off(struct phy *phy) return -ENOSYS; } +static inline int phy_get_bus_width(struct phy *phy) +{ + return -ENOSYS; +} + +static inline void phy_set_bus_width(struct phy *phy, int bus_width) +{ + return; +} + static inline struct phy *phy_get(struct device *dev, const char *string) { return ERR_PTR(-ENOSYS); -- 1.8.4 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH v8 3/9] usb: gadget: s3c-hsotg: enable build for other platforms
On Mon, Dec 23, 2013 at 05:30:41PM +0100, Tomasz Figa wrote: > On Monday 23 of December 2013 10:25:57 Felipe Balbi wrote: > > On Thu, Dec 19, 2013 at 09:23:04AM -0500, Matt Porter wrote: > > > Remove unused Samsung-specific machine include and Kconfig > > > dependency on S3C. > > > > > > Signed-off-by: Matt Porter > > > Reviewed-by: Markus Mayer > > > Reviewed-by: Tim Kryger > > > --- > > > drivers/usb/gadget/Kconfig | 7 +++ > > > drivers/usb/gadget/s3c-hsotg.c | 2 -- > > > 2 files changed, 3 insertions(+), 6 deletions(-) > > > > > > diff --git a/drivers/usb/gadget/Kconfig b/drivers/usb/gadget/Kconfig > > > index a91e642..181e760 100644 > > > --- a/drivers/usb/gadget/Kconfig > > > +++ b/drivers/usb/gadget/Kconfig > > > @@ -294,11 +294,10 @@ config USB_PXA27X > > > gadget drivers to also be dynamically linked. > > > > > > config USB_S3C_HSOTG > > > - tristate "S3C HS/OtG USB Device controller" > > > - depends on S3C_DEV_USB_HSOTG > > > + tristate "Designware/S3C HS/OtG USB Device controller" > > > > causes build failure in x86. Sorry dropping from my queue. > > Maybe depends on ARM would be a good enough stepping stone? Yes, we could then move from readsl/writesl to ioread_read/io_write_rep next time around as that fixes the portability issue. Felipe, since depending on ARM is a trivial fix for this, can you take an updated version at this point? -Matt -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH v8 3/9] usb: gadget: s3c-hsotg: enable build for other platforms
On Mon, Dec 23, 2013 at 05:30:41PM +0100, Tomasz Figa wrote: On Monday 23 of December 2013 10:25:57 Felipe Balbi wrote: On Thu, Dec 19, 2013 at 09:23:04AM -0500, Matt Porter wrote: Remove unused Samsung-specific machine include and Kconfig dependency on S3C. Signed-off-by: Matt Porter mpor...@linaro.org Reviewed-by: Markus Mayer markus.ma...@linaro.org Reviewed-by: Tim Kryger tim.kry...@linaro.org --- drivers/usb/gadget/Kconfig | 7 +++ drivers/usb/gadget/s3c-hsotg.c | 2 -- 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/drivers/usb/gadget/Kconfig b/drivers/usb/gadget/Kconfig index a91e642..181e760 100644 --- a/drivers/usb/gadget/Kconfig +++ b/drivers/usb/gadget/Kconfig @@ -294,11 +294,10 @@ config USB_PXA27X gadget drivers to also be dynamically linked. config USB_S3C_HSOTG - tristate S3C HS/OtG USB Device controller - depends on S3C_DEV_USB_HSOTG + tristate Designware/S3C HS/OtG USB Device controller causes build failure in x86. Sorry dropping from my queue. Maybe depends on ARM would be a good enough stepping stone? Yes, we could then move from readsl/writesl to ioread_read/io_write_rep next time around as that fixes the portability issue. Felipe, since depending on ARM is a trivial fix for this, can you take an updated version at this point? -Matt -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH v9 1/9] phy: add phy_get_bus_width()/phy_set_bus_width() calls
This adds a pair of APIs that allows the generic PHY subsystem to provide information on the PHY bus width. The PHY provider driver may use phy_set_bus_width() to set the bus width that the PHY supports. The controller driver may then use phy_get_bus_width() to fetch the PHY bus width in order to properly configure the controller. Signed-off-by: Matt Porter mpor...@linaro.org Acked-by: Kishon Vijay Abraham I kis...@ti.com --- include/linux/phy/phy.h | 28 1 file changed, 28 insertions(+) diff --git a/include/linux/phy/phy.h b/include/linux/phy/phy.h index 6d72269..e273e5a 100644 --- a/include/linux/phy/phy.h +++ b/include/linux/phy/phy.h @@ -38,6 +38,14 @@ struct phy_ops { }; /** + * struct phy_attrs - represents phy attributes + * @bus_width: Data path width implemented by PHY + */ +struct phy_attrs { + u32 bus_width; +}; + +/** * struct phy - represents the phy device * @dev: phy device * @id: id of the phy device @@ -46,6 +54,7 @@ struct phy_ops { * @mutex: mutex to protect phy_ops * @init_count: used to protect when the PHY is used by multiple consumers * @power_count: used to protect when the PHY is used by multiple consumers + * @phy_attrs: used to specify PHY specific attributes */ struct phy { struct device dev; @@ -55,6 +64,7 @@ struct phy { struct mutexmutex; int init_count; int power_count; + struct phy_attrsattrs; }; /** @@ -127,6 +137,14 @@ int phy_init(struct phy *phy); int phy_exit(struct phy *phy); int phy_power_on(struct phy *phy); int phy_power_off(struct phy *phy); +static inline int phy_get_bus_width(struct phy *phy) +{ + return phy-attrs.bus_width; +} +static inline void phy_set_bus_width(struct phy *phy, int bus_width) +{ + phy-attrs.bus_width = bus_width; +} struct phy *phy_get(struct device *dev, const char *string); struct phy *devm_phy_get(struct device *dev, const char *string); void phy_put(struct phy *phy); @@ -199,6 +217,16 @@ static inline int phy_power_off(struct phy *phy) return -ENOSYS; } +static inline int phy_get_bus_width(struct phy *phy) +{ + return -ENOSYS; +} + +static inline void phy_set_bus_width(struct phy *phy, int bus_width) +{ + return; +} + static inline struct phy *phy_get(struct device *dev, const char *string) { return ERR_PTR(-ENOSYS); -- 1.8.4 -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH v9 9/9] ARM: dts: add usb udc support to bcm281xx
Adds USB OTG/PHY and clock support to BCM281xx and enables UDC support on the bcm11351-brt and bcm28155-ap boards. Signed-off-by: Matt Porter mpor...@linaro.org Reviewed-by: Markus Mayer markus.ma...@linaro.org Reviewed-by: Tim Kryger tim.kry...@linaro.org --- arch/arm/boot/dts/bcm11351-brt.dts | 6 ++ arch/arm/boot/dts/bcm11351.dtsi| 18 ++ arch/arm/boot/dts/bcm28155-ap.dts | 8 3 files changed, 32 insertions(+) diff --git a/arch/arm/boot/dts/bcm11351-brt.dts b/arch/arm/boot/dts/bcm11351-brt.dts index 23cd16d..396b704 100644 --- a/arch/arm/boot/dts/bcm11351-brt.dts +++ b/arch/arm/boot/dts/bcm11351-brt.dts @@ -44,5 +44,11 @@ status = okay; }; + usbotg: usb@3f12 { + status = okay; + }; + usbphy: usb-phy@3f13 { + status = okay; + }; }; diff --git a/arch/arm/boot/dts/bcm11351.dtsi b/arch/arm/boot/dts/bcm11351.dtsi index 1246885..0fbb455 100644 --- a/arch/arm/boot/dts/bcm11351.dtsi +++ b/arch/arm/boot/dts/bcm11351.dtsi @@ -243,4 +243,22 @@ #clock-cells = 0; }; }; + + usbotg: usb@3f12 { + compatible = snps,dwc2; + reg = 0x3f12 0x1; + interrupts = GIC_SPI 47 IRQ_TYPE_LEVEL_HIGH; + clocks = usb_otg_ahb_clk; + clock-names = otg; + phys = usbphy; + phy-names = usb2-phy; + status = disabled; + }; + + usbphy: usb-phy@3f13 { + compatible = brcm,kona-usb2-phy; + reg = 0x3f13 0x28; + #phy-cells = 0; + status = disabled; + }; }; diff --git a/arch/arm/boot/dts/bcm28155-ap.dts b/arch/arm/boot/dts/bcm28155-ap.dts index 08e47c2..a3bc436 100644 --- a/arch/arm/boot/dts/bcm28155-ap.dts +++ b/arch/arm/boot/dts/bcm28155-ap.dts @@ -43,4 +43,12 @@ cd-gpios = gpio 14 0; status = okay; }; + + usbotg: usb@3f12 { + status = okay; + }; + + usbphy: usb-phy@3f13 { + status = okay; + }; }; -- 1.8.4 -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH v9 8/9] phy: add Broadcom Kona USB2 PHY driver
Add a driver for the internal Broadcom Kona USB 2.0 PHY found on the BCM281xx family of SoCs. Signed-off-by: Matt Porter mpor...@linaro.org --- drivers/phy/Kconfig | 6 ++ drivers/phy/Makefile| 1 + drivers/phy/phy-bcm-kona-usb2.c | 158 3 files changed, 165 insertions(+) create mode 100644 drivers/phy/phy-bcm-kona-usb2.c diff --git a/drivers/phy/Kconfig b/drivers/phy/Kconfig index a344f3d..2e87fa8 100644 --- a/drivers/phy/Kconfig +++ b/drivers/phy/Kconfig @@ -51,4 +51,10 @@ config PHY_EXYNOS_DP_VIDEO help Support for Display Port PHY found on Samsung EXYNOS SoCs. +config BCM_KONA_USB2_PHY + tristate Broadcom Kona USB2 PHY Driver + depends on GENERIC_PHY + help + Enable this to support the Broadcom Kona USB 2.0 PHY. + endmenu diff --git a/drivers/phy/Makefile b/drivers/phy/Makefile index d0caae9..c447f1a 100644 --- a/drivers/phy/Makefile +++ b/drivers/phy/Makefile @@ -3,6 +3,7 @@ # obj-$(CONFIG_GENERIC_PHY) += phy-core.o +obj-$(CONFIG_BCM_KONA_USB2_PHY)+= phy-bcm-kona-usb2.o obj-$(CONFIG_PHY_EXYNOS_DP_VIDEO) += phy-exynos-dp-video.o obj-$(CONFIG_PHY_EXYNOS_MIPI_VIDEO)+= phy-exynos-mipi-video.o obj-$(CONFIG_OMAP_USB2)+= phy-omap-usb2.o diff --git a/drivers/phy/phy-bcm-kona-usb2.c b/drivers/phy/phy-bcm-kona-usb2.c new file mode 100644 index 000..efc5c1a --- /dev/null +++ b/drivers/phy/phy-bcm-kona-usb2.c @@ -0,0 +1,158 @@ +/* + * phy-bcm-kona-usb2.c - Broadcom Kona USB2 Phy Driver + * + * Copyright (C) 2013 Linaro Limited + * Matt Porter mpor...@linaro.org + * + * This software is licensed under the terms of the GNU General Public + * License version 2, as published by the Free Software Foundation, and + * may be copied, distributed, and modified under those terms. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + */ + +#include linux/clk.h +#include linux/delay.h +#include linux/err.h +#include linux/io.h +#include linux/module.h +#include linux/of.h +#include linux/phy/phy.h +#include linux/platform_device.h + +#define OTGCTL (0) +#define OTGCTL_OTGSTAT2BIT(31) +#define OTGCTL_OTGSTAT1BIT(30) +#define OTGCTL_PRST_N_SW BIT(11) +#define OTGCTL_HRESET_NBIT(10) +#define OTGCTL_UTMI_LINE_STATE1BIT(9) +#define OTGCTL_UTMI_LINE_STATE0BIT(8) + +#define P1CTL (8) +#define P1CTL_SOFT_RESET BIT(1) +#define P1CTL_NON_DRIVING BIT(0) + +struct bcm_kona_usb { + void __iomem *regs; +}; + +static void bcm_kona_usb_phy_power(struct bcm_kona_usb *phy, int on) +{ + u32 val; + + val = readl(phy-regs + OTGCTL); + if (on) { + /* Configure and power PHY */ + val = ~(OTGCTL_OTGSTAT2 | OTGCTL_OTGSTAT1 | +OTGCTL_UTMI_LINE_STATE1 | OTGCTL_UTMI_LINE_STATE0); + val |= OTGCTL_PRST_N_SW | OTGCTL_HRESET_N; + } else { + val = ~(OTGCTL_PRST_N_SW | OTGCTL_HRESET_N); + } + writel(val, phy-regs + OTGCTL); +} + +static int bcm_kona_usb_phy_init(struct phy *gphy) +{ + struct bcm_kona_usb *phy = phy_get_drvdata(gphy); + u32 val; + + /* Soft reset PHY */ + val = readl(phy-regs + P1CTL); + val = ~P1CTL_NON_DRIVING; + val |= P1CTL_SOFT_RESET; + writel(val, phy-regs + P1CTL); + writel(val ~P1CTL_SOFT_RESET, phy-regs + P1CTL); + /* Reset needs to be asserted for 2ms */ + mdelay(2); + writel(val | P1CTL_SOFT_RESET, phy-regs + P1CTL); + + return 0; +} + +static int bcm_kona_usb_phy_power_on(struct phy *gphy) +{ + struct bcm_kona_usb *phy = phy_get_drvdata(gphy); + + bcm_kona_usb_phy_power(phy, 1); + + return 0; +} + +static int bcm_kona_usb_phy_power_off(struct phy *gphy) +{ + struct bcm_kona_usb *phy = phy_get_drvdata(gphy); + + bcm_kona_usb_phy_power(phy, 0); + + return 0; +} + +static struct phy_ops ops = { + .init = bcm_kona_usb_phy_init, + .power_on = bcm_kona_usb_phy_power_on, + .power_off = bcm_kona_usb_phy_power_off, + .owner = THIS_MODULE, +}; + +static int bcm_kona_usb2_probe(struct platform_device *pdev) +{ + struct device *dev = pdev-dev; + struct bcm_kona_usb *phy; + struct resource *res; + struct phy *gphy; + struct phy_provider *phy_provider; + + phy = devm_kzalloc(dev, sizeof(*phy), GFP_KERNEL); + if (!phy) + return -ENOMEM; + + res = platform_get_resource(pdev, IORESOURCE_MEM, 0); + phy-regs = devm_ioremap_resource(pdev-dev, res); + if (IS_ERR(phy-regs)) + return
[PATCH v9 6/9] usb: gadget: s3c-hsotg: get phy bus width from phy subsystem
Adds support for querying the phy bus width from the generic phy subsystem. Configure UTMI bus width in GUSBCFG based on this value. Signed-off-by: Matt Porter mpor...@linaro.org Acked-by: Kishon Vijay Abraham I kis...@ti.com --- drivers/usb/gadget/s3c-hsotg.c | 14 +- drivers/usb/gadget/s3c-hsotg.h | 1 + 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/drivers/usb/gadget/s3c-hsotg.c b/drivers/usb/gadget/s3c-hsotg.c index 8f9bcdb..93ba8b6 100644 --- a/drivers/usb/gadget/s3c-hsotg.c +++ b/drivers/usb/gadget/s3c-hsotg.c @@ -146,6 +146,7 @@ struct s3c_hsotg_ep { * @regs: The memory area mapped for accessing registers. * @irq: The IRQ number we are using * @supplies: Definition of USB power supplies + * @phyif: PHY interface width * @dedicated_fifos: Set if the hardware has dedicated IN-EP fifos. * @num_of_eps: Number of available EPs (excluding EP0) * @debug_root: root directrory for debugfs. @@ -174,6 +175,7 @@ struct s3c_hsotg { struct regulator_bulk_data supplies[ARRAY_SIZE(s3c_hsotg_supply_names)]; + u32 phyif; unsigned intdedicated_fifos:1; unsigned char num_of_eps; @@ -2279,7 +2281,7 @@ static void s3c_hsotg_core_init(struct s3c_hsotg *hsotg) */ /* set the PLL on, remove the HNP/SRP and set the PHY */ - writel(GUSBCFG_PHYIf16 | GUSBCFG_TOutCal(7) | + writel(hsotg-phyif | GUSBCFG_TOutCal(7) | (0x5 10), hsotg-regs + GUSBCFG); s3c_hsotg_init_fifo(hsotg); @@ -3638,6 +3640,16 @@ static int s3c_hsotg_probe(struct platform_device *pdev) goto err_supplies; } + /* Set default UTMI width */ + hsotg-phyif = GUSBCFG_PHYIf16; + + /* +* If using the generic PHY framework, check if the PHY bus +* width is 8-bit and set the phyif appropriately. +*/ + if (hsotg-phy (phy_get_bus_width(phy) == 8)) + hsotg-phyif = GUSBCFG_PHYIf8; + if (hsotg-phy) phy_init(hsotg-phy); diff --git a/drivers/usb/gadget/s3c-hsotg.h b/drivers/usb/gadget/s3c-hsotg.h index d650b12..85f549f 100644 --- a/drivers/usb/gadget/s3c-hsotg.h +++ b/drivers/usb/gadget/s3c-hsotg.h @@ -55,6 +55,7 @@ #define GUSBCFG_HNPCap (1 9) #define GUSBCFG_SRPCap (1 8) #define GUSBCFG_PHYIf16(1 3) +#define GUSBCFG_PHYIf8 (0 3) #define GUSBCFG_TOutCal_MASK (0x7 0) #define GUSBCFG_TOutCal_SHIFT (0) #define GUSBCFG_TOutCal_LIMIT (0x7) -- 1.8.4 -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH v9 7/9] phy: add Broadcom Kona USB2 PHY DT binding
Add a binding that describes the Broadcom Kona USB2 PHY found on the BCM281xx family of SoCs. Signed-off-by: Matt Porter mpor...@linaro.org Acked-by: Kishon Vijay Abraham I kis...@ti.com --- Documentation/devicetree/bindings/phy/bcm-phy.txt | 15 +++ 1 file changed, 15 insertions(+) create mode 100644 Documentation/devicetree/bindings/phy/bcm-phy.txt diff --git a/Documentation/devicetree/bindings/phy/bcm-phy.txt b/Documentation/devicetree/bindings/phy/bcm-phy.txt new file mode 100644 index 000..3dc8b3d --- /dev/null +++ b/Documentation/devicetree/bindings/phy/bcm-phy.txt @@ -0,0 +1,15 @@ +BROADCOM KONA USB2 PHY + +Required properties: + - compatible: brcm,kona-usb2-phy + - reg: offset and length of the PHY registers + - #phy-cells: must be 0 +Refer to phy/phy-bindings.txt for the generic PHY binding properties + +Example: + + usbphy: usb-phy@3f13 { + compatible = brcm,kona-usb2-phy; + reg = 0x3f13 0x28; + #phy-cells = 0; + }; -- 1.8.4 -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH v9 5/9] usb: gadget: s3c-hsotg: enable generic phy support
Adds support for the generic PHY subsystem. Generic PHY support is probed and then the driver falls back to checking for an old style USB PHY and pdata if not found. Signed-off-by: Matt Porter mpor...@linaro.org --- drivers/usb/gadget/s3c-hsotg.c | 55 ++ 1 file changed, 39 insertions(+), 16 deletions(-) diff --git a/drivers/usb/gadget/s3c-hsotg.c b/drivers/usb/gadget/s3c-hsotg.c index cbfbf41..8f9bcdb 100644 --- a/drivers/usb/gadget/s3c-hsotg.c +++ b/drivers/usb/gadget/s3c-hsotg.c @@ -30,6 +30,8 @@ #include linux/clk.h #include linux/regulator/consumer.h #include linux/of_platform.h +#include linux/phy/phy.h +#include linux/usb/phy.h #include linux/usb/ch9.h #include linux/usb/gadget.h @@ -138,6 +140,7 @@ struct s3c_hsotg_ep { * @dev: The parent device supplied to the probe function * @driver: USB gadget driver * @phy: The otg phy transceiver structure for phy control. + * @uphy: The otg phy transceiver structure for old USB phy control. * @plat: The platform specific configuration data. This can be removed once * all SoCs support usb transceiver. * @regs: The memory area mapped for accessing registers. @@ -159,7 +162,8 @@ struct s3c_hsotg_ep { struct s3c_hsotg { struct device*dev; struct usb_gadget_driver *driver; - struct usb_phy *phy; + struct phy *phy; + struct usb_phy *uphy; struct s3c_hsotg_plat*plat; spinlock_t lock; @@ -2901,8 +2905,11 @@ static void s3c_hsotg_phy_enable(struct s3c_hsotg *hsotg) dev_dbg(hsotg-dev, pdev 0x%p\n, pdev); - if (hsotg-phy) - usb_phy_init(hsotg-phy); + if (hsotg-phy) { + phy_init(hsotg-phy); + phy_power_on(hsotg-phy); + } else if (hsotg-uphy) + usb_phy_init(hsotg-uphy); else if (hsotg-plat-phy_init) hsotg-plat-phy_init(pdev, hsotg-plat-phy_type); } @@ -2918,8 +2925,11 @@ static void s3c_hsotg_phy_disable(struct s3c_hsotg *hsotg) { struct platform_device *pdev = to_platform_device(hsotg-dev); - if (hsotg-phy) - usb_phy_shutdown(hsotg-phy); + if (hsotg-phy) { + phy_power_off(hsotg-phy); + phy_exit(hsotg-phy); + } else if (hsotg-uphy) + usb_phy_shutdown(hsotg-uphy); else if (hsotg-plat-phy_exit) hsotg-plat-phy_exit(pdev, hsotg-plat-phy_type); } @@ -3526,7 +3536,8 @@ static void s3c_hsotg_delete_debug(struct s3c_hsotg *hsotg) static int s3c_hsotg_probe(struct platform_device *pdev) { struct s3c_hsotg_plat *plat = dev_get_platdata(pdev-dev); - struct usb_phy *phy; + struct phy *phy; + struct usb_phy *uphy; struct device *dev = pdev-dev; struct s3c_hsotg_ep *eps; struct s3c_hsotg *hsotg; @@ -3541,19 +3552,26 @@ static int s3c_hsotg_probe(struct platform_device *pdev) return -ENOMEM; } - phy = devm_usb_get_phy(dev, USB_PHY_TYPE_USB2); + /* +* Attempt to find a generic PHY, then look for an old style +* USB PHY, finally fall back to pdata +*/ + phy = devm_phy_get(pdev-dev, usb2-phy); if (IS_ERR(phy)) { - /* Fallback for pdata */ - plat = dev_get_platdata(pdev-dev); - if (!plat) { - dev_err(pdev-dev, no platform data or transceiver defined\n); - return -EPROBE_DEFER; - } else { + uphy = devm_usb_get_phy(dev, USB_PHY_TYPE_USB2); + if (IS_ERR(uphy)) { + /* Fallback for pdata */ + plat = dev_get_platdata(pdev-dev); + if (!plat) { + dev_err(pdev-dev, + no platform data or transceiver defined\n); + return -EPROBE_DEFER; + } hsotg-plat = plat; - } - } else { + } else + hsotg-uphy = uphy; + } else hsotg-phy = phy; - } hsotg-dev = dev; @@ -3620,6 +3638,9 @@ static int s3c_hsotg_probe(struct platform_device *pdev) goto err_supplies; } + if (hsotg-phy) + phy_init(hsotg-phy); + /* usb phy enable */ s3c_hsotg_phy_enable(hsotg); @@ -3713,6 +3734,8 @@ static int s3c_hsotg_remove(struct platform_device *pdev) } s3c_hsotg_phy_disable(hsotg); + if (hsotg-phy) + phy_exit(hsotg-phy); clk_disable_unprepare(hsotg-clk); return 0; -- 1.8.4 -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read
[PATCH v9 3/9] usb: gadget: s3c-hsotg: enable build for other platforms
Remove unused Samsung-specific machine include and Kconfig dependency on S3C. Signed-off-by: Matt Porter mpor...@linaro.org Reviewed-by: Markus Mayer markus.ma...@linaro.org Reviewed-by: Tim Kryger tim.kry...@linaro.org --- drivers/usb/gadget/Kconfig | 8 drivers/usb/gadget/s3c-hsotg.c | 2 -- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/drivers/usb/gadget/Kconfig b/drivers/usb/gadget/Kconfig index a91e642..cf955f5 100644 --- a/drivers/usb/gadget/Kconfig +++ b/drivers/usb/gadget/Kconfig @@ -294,11 +294,11 @@ config USB_PXA27X gadget drivers to also be dynamically linked. config USB_S3C_HSOTG - tristate S3C HS/OtG USB Device controller - depends on S3C_DEV_USB_HSOTG + tristate Designware/S3C HS/OtG USB Device controller + depends on ARM help - The Samsung S3C64XX USB2.0 high-speed gadget controller - integrated into the S3C64XX series SoC. + The Designware USB2.0 high-speed gadget controller + integrated into many SoCs. config USB_S3C2410 tristate S3C2410 USB Device Controller diff --git a/drivers/usb/gadget/s3c-hsotg.c b/drivers/usb/gadget/s3c-hsotg.c index 9875d9c..db797f2 100644 --- a/drivers/usb/gadget/s3c-hsotg.c +++ b/drivers/usb/gadget/s3c-hsotg.c @@ -36,8 +36,6 @@ #include linux/usb/phy.h #include linux/platform_data/s3c-hsotg.h -#include mach/map.h - #include s3c-hsotg.h static const char * const s3c_hsotg_supply_names[] = { -- 1.8.4 -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH v9 2/9] staging: dwc2: update DT binding to add generic clock/phy properties
dwc2/s3c-hsotg require a single clock to be specified and optionally a generic phy. On the s3c-hsotg driver old style USB phy support is present as a fallback so the generic phy properties are optional. Signed-off-by: Matt Porter mpor...@linaro.org Acked-by: Kishon Vijay Abraham I kis...@ti.com --- Documentation/devicetree/bindings/staging/dwc2.txt | 12 1 file changed, 12 insertions(+) diff --git a/Documentation/devicetree/bindings/staging/dwc2.txt b/Documentation/devicetree/bindings/staging/dwc2.txt index 1a1b7cf..a1753ed 100644 --- a/Documentation/devicetree/bindings/staging/dwc2.txt +++ b/Documentation/devicetree/bindings/staging/dwc2.txt @@ -5,6 +5,14 @@ Required properties: - compatible : snps,dwc2 - reg : Should contain 1 register range (address and length) - interrupts : Should contain 1 interrupt +- clocks: clock provider specifier +- clock-names: shall be otg +Refer to clk/clock-bindings.txt for generic clock consumer properties + +Optional properties: +- phys: phy provider specifier +- phy-names: shall be device +Refer to phy/phy-bindings.txt for generic phy consumer properties Example: @@ -12,4 +20,8 @@ Example: compatible = ralink,rt3050-usb, snps,dwc2; reg = 0x101c 4; interrupts = 18; + clocks = usb_otg_ahb_clk; + clock-names = otg; + phys = usbphy; + phy-names = usb2-phy; }; -- 1.8.4 -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH v9 4/9] usb: gadget: s3c-hsotg: add snps,dwc2 compatible string
Enable support for the dwc2 binding. Signed-off-by: Matt Porter mpor...@linaro.org --- drivers/usb/gadget/s3c-hsotg.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/usb/gadget/s3c-hsotg.c b/drivers/usb/gadget/s3c-hsotg.c index db797f2..cbfbf41 100644 --- a/drivers/usb/gadget/s3c-hsotg.c +++ b/drivers/usb/gadget/s3c-hsotg.c @@ -3726,6 +3726,7 @@ static int s3c_hsotg_remove(struct platform_device *pdev) #ifdef CONFIG_OF static const struct of_device_id s3c_hsotg_of_ids[] = { { .compatible = samsung,s3c6400-hsotg, }, + { .compatible = snps,dwc2, }, { /* sentinel */ } }; MODULE_DEVICE_TABLE(of, s3c_hsotg_of_ids); -- 1.8.4 -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH v9 0/9] USB Device Controller support for BCM281xx
Changes since v8: - Fix build issue in s3c-hsotg on !ARM by guarding with a depends on ARM. Will fix by replacing use of readsl/writesl for 3.15 and dropping the Kconfig workaround.. Changes since v7: - Register phy provider with generic phy subsystem only after the generic phy has been allocated and configured. Changes since v6: - Drop dependency on the Exynos generic phy conversion series - Bring back original patch that converts s3c-hsotg to use the generic phy layer with a fall back to the old usb style phy support. Changes since v5: - tweak s3c-hsotg Kconfig help message to be more generic Changes since v4: - phy_set/get_bus_width now use an int for bus_width Changes since v3: - Rebased on 3.13-rc3 - Move struct phy bus_width attribute back into struct phy_attrs - Fix build issue on !GENERIC_PHY - Update dwc2 binding to reflect optional phy properties - Rename bcm-kona-phy.txt binding to bcm-phy.txt - Reorder bcm kona phy includes and use bitops - phy-names changed to usb2-phy to match updated s3c-hsotg generic phy-ification series Changes since v2: - Rebased on 3.13-rc1 - Fix braces in phy_get_bus_width()/phy_set_bus_width() - Drop generic phy conversion to use the same support from the Exynos generic phy conversion series - Modify dts support to match the device phy name required in the v3 Exynos generic phy conversion - Add s3c-hsotg phy_init/phy_exit support - Fix typo on reg property in kona phy binding - Replace phy driver reg struct with offset defines - Move phy soft reset to phy driver init - Fix dts node names to match ePAPR conventions Changes since v1: - Convert USB phy driver to generic phy subsystem - Add phy bus width apis - Drop dwc2 phy bus width DT property in favor of querying the phy provider for bus width - Add generic phy/clock properties to dwc2 DT binding - Add generic phy subsystem support to s3c-hsotg with the existing usb phy and pdata phy methods as a fallback - Split bindings out to separate patches to match the latest DT binding review guidelines This series adds USB Device Controller support for the Broadcom BCM281xx family of parts. BCM281xx contains a DWC2 OTG block and s3c-hsotg is used to support UDC operation. Part 1 adds phy bus width support to the generic phy subsystem Parts 2-6 allows s3c-hsotg to build on non-Samsung platforms, supports the dwc2 binding, adds generic phy layer support, and supports fetching phy bus width using the generic phy layer. Parts 7-8 add a generic phy binding and driver for the BCM Kona USB PHY. Part 9 adds the DT nodes to enable UDC support on both BCM281xx boards in the kernel. This series depends on: - Update Kona drivers to use clocks v4 series https://lkml.org/lkml/2013/12/5/508 (relevant portion now queued for 3.14) Matt Porter (9): phy: add phy_get_bus_width()/phy_set_bus_width() calls staging: dwc2: update DT binding to add generic clock/phy properties usb: gadget: s3c-hsotg: enable build for other platforms usb: gadget: s3c-hsotg: add snps,dwc2 compatible string usb: gadget: s3c-hsotg: enable generic phy support usb: gadget: s3c-hsotg: get phy bus width from phy subsystem phy: add Broadcom Kona USB2 PHY DT binding phy: add Broadcom Kona USB2 PHY driver ARM: dts: add usb udc support to bcm281xx Documentation/devicetree/bindings/phy/bcm-phy.txt | 15 ++ Documentation/devicetree/bindings/staging/dwc2.txt | 12 ++ arch/arm/boot/dts/bcm11351-brt.dts | 6 + arch/arm/boot/dts/bcm11351.dtsi| 18 +++ arch/arm/boot/dts/bcm28155-ap.dts | 8 ++ drivers/phy/Kconfig| 6 + drivers/phy/Makefile | 1 + drivers/phy/phy-bcm-kona-usb2.c| 158 + drivers/usb/gadget/Kconfig | 8 +- drivers/usb/gadget/s3c-hsotg.c | 72 +++--- drivers/usb/gadget/s3c-hsotg.h | 1 + include/linux/phy/phy.h| 28 12 files changed, 310 insertions(+), 23 deletions(-) create mode 100644 Documentation/devicetree/bindings/phy/bcm-phy.txt create mode 100644 drivers/phy/phy-bcm-kona-usb2.c -- 1.8.4 -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH v8 1/9] phy: add phy_get_bus_width()/phy_set_bus_width() calls
This adds a pair of APIs that allows the generic PHY subsystem to provide information on the PHY bus width. The PHY provider driver may use phy_set_bus_width() to set the bus width that the PHY supports. The controller driver may then use phy_get_bus_width() to fetch the PHY bus width in order to properly configure the controller. Signed-off-by: Matt Porter Acked-by: Kishon Vijay Abraham I --- include/linux/phy/phy.h | 28 1 file changed, 28 insertions(+) diff --git a/include/linux/phy/phy.h b/include/linux/phy/phy.h index 6d72269..e273e5a 100644 --- a/include/linux/phy/phy.h +++ b/include/linux/phy/phy.h @@ -38,6 +38,14 @@ struct phy_ops { }; /** + * struct phy_attrs - represents phy attributes + * @bus_width: Data path width implemented by PHY + */ +struct phy_attrs { + u32 bus_width; +}; + +/** * struct phy - represents the phy device * @dev: phy device * @id: id of the phy device @@ -46,6 +54,7 @@ struct phy_ops { * @mutex: mutex to protect phy_ops * @init_count: used to protect when the PHY is used by multiple consumers * @power_count: used to protect when the PHY is used by multiple consumers + * @phy_attrs: used to specify PHY specific attributes */ struct phy { struct device dev; @@ -55,6 +64,7 @@ struct phy { struct mutexmutex; int init_count; int power_count; + struct phy_attrsattrs; }; /** @@ -127,6 +137,14 @@ int phy_init(struct phy *phy); int phy_exit(struct phy *phy); int phy_power_on(struct phy *phy); int phy_power_off(struct phy *phy); +static inline int phy_get_bus_width(struct phy *phy) +{ + return phy->attrs.bus_width; +} +static inline void phy_set_bus_width(struct phy *phy, int bus_width) +{ + phy->attrs.bus_width = bus_width; +} struct phy *phy_get(struct device *dev, const char *string); struct phy *devm_phy_get(struct device *dev, const char *string); void phy_put(struct phy *phy); @@ -199,6 +217,16 @@ static inline int phy_power_off(struct phy *phy) return -ENOSYS; } +static inline int phy_get_bus_width(struct phy *phy) +{ + return -ENOSYS; +} + +static inline void phy_set_bus_width(struct phy *phy, int bus_width) +{ + return; +} + static inline struct phy *phy_get(struct device *dev, const char *string) { return ERR_PTR(-ENOSYS); -- 1.8.4 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH v8 0/9] USB Device Controller support for BCM281xx
Changes since v7: - Register phy provider with generic phy subsystem only after the generic phy has been allocated and configured. Changes since v6: - Drop dependency on the Exynos generic phy conversion series - Bring back original patch that converts s3c-hsotg to use the generic phy layer with a fall back to the old usb style phy support. Changes since v5: - tweak s3c-hsotg Kconfig help message to be more generic Changes since v4: - phy_set/get_bus_width now use an int for bus_width Changes since v3: - Rebased on 3.13-rc3 - Move struct phy bus_width attribute back into struct phy_attrs - Fix build issue on !GENERIC_PHY - Update dwc2 binding to reflect optional phy properties - Rename bcm-kona-phy.txt binding to bcm-phy.txt - Reorder bcm kona phy includes and use bitops - phy-names changed to "usb2-phy" to match updated s3c-hsotg generic phy-ification series Changes since v2: - Rebased on 3.13-rc1 - Fix braces in phy_get_bus_width()/phy_set_bus_width() - Drop generic phy conversion to use the same support from the Exynos generic phy conversion series - Modify dts support to match the "device" phy name required in the v3 Exynos generic phy conversion - Add s3c-hsotg phy_init/phy_exit support - Fix typo on reg property in kona phy binding - Replace phy driver reg struct with offset defines - Move phy soft reset to phy driver init - Fix dts node names to match ePAPR conventions Changes since v1: - Convert USB phy driver to generic phy subsystem - Add phy bus width apis - Drop dwc2 phy bus width DT property in favor of querying the phy provider for bus width - Add generic phy/clock properties to dwc2 DT binding - Add generic phy subsystem support to s3c-hsotg with the existing usb phy and pdata phy methods as a fallback - Split bindings out to separate patches to match the latest DT binding review guidelines This series adds USB Device Controller support for the Broadcom BCM281xx family of parts. BCM281xx contains a DWC2 OTG block and s3c-hsotg is used to support UDC operation. Part 1 adds phy bus width support to the generic phy subsystem Parts 2-6 allows s3c-hsotg to build on non-Samsung platforms, supports the dwc2 binding, adds generic phy layer support, and supports fetching phy bus width using the generic phy layer. Parts 7-8 add a generic phy binding and driver for the BCM Kona USB PHY. Part 9 adds the DT nodes to enable UDC support on both BCM281xx boards in the kernel. This series depends on: - "Update Kona drivers to use clocks" v4 series https://lkml.org/lkml/2013/12/5/508 (relevant portion now queued for 3.14) Matt Porter (9): phy: add phy_get_bus_width()/phy_set_bus_width() calls staging: dwc2: update DT binding to add generic clock/phy properties usb: gadget: s3c-hsotg: enable build for other platforms usb: gadget: s3c-hsotg: add snps,dwc2 compatible string usb: gadget: s3c-hsotg: enable generic phy support usb: gadget: s3c-hsotg: get phy bus width from phy subsystem phy: add Broadcom Kona USB2 PHY DT binding phy: add Broadcom Kona USB2 PHY driver ARM: dts: add usb udc support to bcm281xx Documentation/devicetree/bindings/phy/bcm-phy.txt | 15 ++ Documentation/devicetree/bindings/staging/dwc2.txt | 12 ++ arch/arm/boot/dts/bcm11351-brt.dts | 6 + arch/arm/boot/dts/bcm11351.dtsi| 18 +++ arch/arm/boot/dts/bcm28155-ap.dts | 8 ++ drivers/phy/Kconfig| 6 + drivers/phy/Makefile | 1 + drivers/phy/phy-bcm-kona-usb2.c| 158 + drivers/usb/gadget/Kconfig | 7 +- drivers/usb/gadget/s3c-hsotg.c | 72 +++--- drivers/usb/gadget/s3c-hsotg.h | 1 + include/linux/phy/phy.h| 28 12 files changed, 309 insertions(+), 23 deletions(-) create mode 100644 Documentation/devicetree/bindings/phy/bcm-phy.txt create mode 100644 drivers/phy/phy-bcm-kona-usb2.c -- 1.8.4 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH v8 3/9] usb: gadget: s3c-hsotg: enable build for other platforms
Remove unused Samsung-specific machine include and Kconfig dependency on S3C. Signed-off-by: Matt Porter Reviewed-by: Markus Mayer Reviewed-by: Tim Kryger --- drivers/usb/gadget/Kconfig | 7 +++ drivers/usb/gadget/s3c-hsotg.c | 2 -- 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/drivers/usb/gadget/Kconfig b/drivers/usb/gadget/Kconfig index a91e642..181e760 100644 --- a/drivers/usb/gadget/Kconfig +++ b/drivers/usb/gadget/Kconfig @@ -294,11 +294,10 @@ config USB_PXA27X gadget drivers to also be dynamically linked. config USB_S3C_HSOTG - tristate "S3C HS/OtG USB Device controller" - depends on S3C_DEV_USB_HSOTG + tristate "Designware/S3C HS/OtG USB Device controller" help - The Samsung S3C64XX USB2.0 high-speed gadget controller - integrated into the S3C64XX series SoC. + The Designware USB2.0 high-speed gadget controller + integrated into many SoCs. config USB_S3C2410 tristate "S3C2410 USB Device Controller" diff --git a/drivers/usb/gadget/s3c-hsotg.c b/drivers/usb/gadget/s3c-hsotg.c index 9875d9c..db797f2 100644 --- a/drivers/usb/gadget/s3c-hsotg.c +++ b/drivers/usb/gadget/s3c-hsotg.c @@ -36,8 +36,6 @@ #include #include -#include - #include "s3c-hsotg.h" static const char * const s3c_hsotg_supply_names[] = { -- 1.8.4 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH v8 8/9] phy: add Broadcom Kona USB2 PHY driver
Add a driver for the internal Broadcom Kona USB 2.0 PHY found on the BCM281xx family of SoCs. Signed-off-by: Matt Porter --- drivers/phy/Kconfig | 6 ++ drivers/phy/Makefile| 1 + drivers/phy/phy-bcm-kona-usb2.c | 158 3 files changed, 165 insertions(+) create mode 100644 drivers/phy/phy-bcm-kona-usb2.c diff --git a/drivers/phy/Kconfig b/drivers/phy/Kconfig index a344f3d..2e87fa8 100644 --- a/drivers/phy/Kconfig +++ b/drivers/phy/Kconfig @@ -51,4 +51,10 @@ config PHY_EXYNOS_DP_VIDEO help Support for Display Port PHY found on Samsung EXYNOS SoCs. +config BCM_KONA_USB2_PHY + tristate "Broadcom Kona USB2 PHY Driver" + depends on GENERIC_PHY + help + Enable this to support the Broadcom Kona USB 2.0 PHY. + endmenu diff --git a/drivers/phy/Makefile b/drivers/phy/Makefile index d0caae9..c447f1a 100644 --- a/drivers/phy/Makefile +++ b/drivers/phy/Makefile @@ -3,6 +3,7 @@ # obj-$(CONFIG_GENERIC_PHY) += phy-core.o +obj-$(CONFIG_BCM_KONA_USB2_PHY)+= phy-bcm-kona-usb2.o obj-$(CONFIG_PHY_EXYNOS_DP_VIDEO) += phy-exynos-dp-video.o obj-$(CONFIG_PHY_EXYNOS_MIPI_VIDEO)+= phy-exynos-mipi-video.o obj-$(CONFIG_OMAP_USB2)+= phy-omap-usb2.o diff --git a/drivers/phy/phy-bcm-kona-usb2.c b/drivers/phy/phy-bcm-kona-usb2.c new file mode 100644 index 000..efc5c1a --- /dev/null +++ b/drivers/phy/phy-bcm-kona-usb2.c @@ -0,0 +1,158 @@ +/* + * phy-bcm-kona-usb2.c - Broadcom Kona USB2 Phy Driver + * + * Copyright (C) 2013 Linaro Limited + * Matt Porter + * + * This software is licensed under the terms of the GNU General Public + * License version 2, as published by the Free Software Foundation, and + * may be copied, distributed, and modified under those terms. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + */ + +#include +#include +#include +#include +#include +#include +#include +#include + +#define OTGCTL (0) +#define OTGCTL_OTGSTAT2BIT(31) +#define OTGCTL_OTGSTAT1BIT(30) +#define OTGCTL_PRST_N_SW BIT(11) +#define OTGCTL_HRESET_NBIT(10) +#define OTGCTL_UTMI_LINE_STATE1BIT(9) +#define OTGCTL_UTMI_LINE_STATE0BIT(8) + +#define P1CTL (8) +#define P1CTL_SOFT_RESET BIT(1) +#define P1CTL_NON_DRIVING BIT(0) + +struct bcm_kona_usb { + void __iomem *regs; +}; + +static void bcm_kona_usb_phy_power(struct bcm_kona_usb *phy, int on) +{ + u32 val; + + val = readl(phy->regs + OTGCTL); + if (on) { + /* Configure and power PHY */ + val &= ~(OTGCTL_OTGSTAT2 | OTGCTL_OTGSTAT1 | +OTGCTL_UTMI_LINE_STATE1 | OTGCTL_UTMI_LINE_STATE0); + val |= OTGCTL_PRST_N_SW | OTGCTL_HRESET_N; + } else { + val &= ~(OTGCTL_PRST_N_SW | OTGCTL_HRESET_N); + } + writel(val, phy->regs + OTGCTL); +} + +static int bcm_kona_usb_phy_init(struct phy *gphy) +{ + struct bcm_kona_usb *phy = phy_get_drvdata(gphy); + u32 val; + + /* Soft reset PHY */ + val = readl(phy->regs + P1CTL); + val &= ~P1CTL_NON_DRIVING; + val |= P1CTL_SOFT_RESET; + writel(val, phy->regs + P1CTL); + writel(val & ~P1CTL_SOFT_RESET, phy->regs + P1CTL); + /* Reset needs to be asserted for 2ms */ + mdelay(2); + writel(val | P1CTL_SOFT_RESET, phy->regs + P1CTL); + + return 0; +} + +static int bcm_kona_usb_phy_power_on(struct phy *gphy) +{ + struct bcm_kona_usb *phy = phy_get_drvdata(gphy); + + bcm_kona_usb_phy_power(phy, 1); + + return 0; +} + +static int bcm_kona_usb_phy_power_off(struct phy *gphy) +{ + struct bcm_kona_usb *phy = phy_get_drvdata(gphy); + + bcm_kona_usb_phy_power(phy, 0); + + return 0; +} + +static struct phy_ops ops = { + .init = bcm_kona_usb_phy_init, + .power_on = bcm_kona_usb_phy_power_on, + .power_off = bcm_kona_usb_phy_power_off, + .owner = THIS_MODULE, +}; + +static int bcm_kona_usb2_probe(struct platform_device *pdev) +{ + struct device *dev = >dev; + struct bcm_kona_usb *phy; + struct resource *res; + struct phy *gphy; + struct phy_provider *phy_provider; + + phy = devm_kzalloc(dev, sizeof(*phy), GFP_KERNEL); + if (!phy) + return -ENOMEM; + + res = platform_get_resource(pdev, IORESOURCE_MEM, 0); + phy->regs = devm_ioremap_resource(>dev, res); + if (IS_ERR(phy->regs)) + return PTR_ERR(phy->regs); + + platform_set_drvdata(pdev, phy); + + g
[PATCH v8 5/9] usb: gadget: s3c-hsotg: enable generic phy support
Adds support for the generic PHY subsystem. Generic PHY support is probed and then the driver falls back to checking for an old style USB PHY and pdata if not found. Signed-off-by: Matt Porter --- drivers/usb/gadget/s3c-hsotg.c | 55 ++ 1 file changed, 39 insertions(+), 16 deletions(-) diff --git a/drivers/usb/gadget/s3c-hsotg.c b/drivers/usb/gadget/s3c-hsotg.c index cbfbf41..8f9bcdb 100644 --- a/drivers/usb/gadget/s3c-hsotg.c +++ b/drivers/usb/gadget/s3c-hsotg.c @@ -30,6 +30,8 @@ #include #include #include +#include +#include #include #include @@ -138,6 +140,7 @@ struct s3c_hsotg_ep { * @dev: The parent device supplied to the probe function * @driver: USB gadget driver * @phy: The otg phy transceiver structure for phy control. + * @uphy: The otg phy transceiver structure for old USB phy control. * @plat: The platform specific configuration data. This can be removed once * all SoCs support usb transceiver. * @regs: The memory area mapped for accessing registers. @@ -159,7 +162,8 @@ struct s3c_hsotg_ep { struct s3c_hsotg { struct device*dev; struct usb_gadget_driver *driver; - struct usb_phy *phy; + struct phy *phy; + struct usb_phy *uphy; struct s3c_hsotg_plat*plat; spinlock_t lock; @@ -2901,8 +2905,11 @@ static void s3c_hsotg_phy_enable(struct s3c_hsotg *hsotg) dev_dbg(hsotg->dev, "pdev 0x%p\n", pdev); - if (hsotg->phy) - usb_phy_init(hsotg->phy); + if (hsotg->phy) { + phy_init(hsotg->phy); + phy_power_on(hsotg->phy); + } else if (hsotg->uphy) + usb_phy_init(hsotg->uphy); else if (hsotg->plat->phy_init) hsotg->plat->phy_init(pdev, hsotg->plat->phy_type); } @@ -2918,8 +2925,11 @@ static void s3c_hsotg_phy_disable(struct s3c_hsotg *hsotg) { struct platform_device *pdev = to_platform_device(hsotg->dev); - if (hsotg->phy) - usb_phy_shutdown(hsotg->phy); + if (hsotg->phy) { + phy_power_off(hsotg->phy); + phy_exit(hsotg->phy); + } else if (hsotg->uphy) + usb_phy_shutdown(hsotg->uphy); else if (hsotg->plat->phy_exit) hsotg->plat->phy_exit(pdev, hsotg->plat->phy_type); } @@ -3526,7 +3536,8 @@ static void s3c_hsotg_delete_debug(struct s3c_hsotg *hsotg) static int s3c_hsotg_probe(struct platform_device *pdev) { struct s3c_hsotg_plat *plat = dev_get_platdata(>dev); - struct usb_phy *phy; + struct phy *phy; + struct usb_phy *uphy; struct device *dev = >dev; struct s3c_hsotg_ep *eps; struct s3c_hsotg *hsotg; @@ -3541,19 +3552,26 @@ static int s3c_hsotg_probe(struct platform_device *pdev) return -ENOMEM; } - phy = devm_usb_get_phy(dev, USB_PHY_TYPE_USB2); + /* +* Attempt to find a generic PHY, then look for an old style +* USB PHY, finally fall back to pdata +*/ + phy = devm_phy_get(>dev, "usb2-phy"); if (IS_ERR(phy)) { - /* Fallback for pdata */ - plat = dev_get_platdata(>dev); - if (!plat) { - dev_err(>dev, "no platform data or transceiver defined\n"); - return -EPROBE_DEFER; - } else { + uphy = devm_usb_get_phy(dev, USB_PHY_TYPE_USB2); + if (IS_ERR(uphy)) { + /* Fallback for pdata */ + plat = dev_get_platdata(>dev); + if (!plat) { + dev_err(>dev, + "no platform data or transceiver defined\n"); + return -EPROBE_DEFER; + } hsotg->plat = plat; - } - } else { + } else + hsotg->uphy = uphy; + } else hsotg->phy = phy; - } hsotg->dev = dev; @@ -3620,6 +3638,9 @@ static int s3c_hsotg_probe(struct platform_device *pdev) goto err_supplies; } + if (hsotg->phy) + phy_init(hsotg->phy); + /* usb phy enable */ s3c_hsotg_phy_enable(hsotg); @@ -3713,6 +3734,8 @@ static int s3c_hsotg_remove(struct platform_device *pdev) } s3c_hsotg_phy_disable(hsotg); + if (hsotg->phy) + phy_exit(hsotg->phy); clk_disable_unprepare(hsotg->clk); return 0; -- 1.8.4 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH v7 8/9] phy: add Broadcom Kona USB2 PHY driver
On Thu, Dec 19, 2013 at 11:19:35AM +0530, Kishon Vijay Abraham I wrote: > Hi Felipe, > > On Wednesday 18 December 2013 09:55 PM, Felipe Balbi wrote: > > On Tue, Dec 17, 2013 at 02:42:35PM -0500, Matt Porter wrote: > >> Add a driver for the internal Broadcom Kona USB 2.0 PHY found > >> on the BCM281xx family of SoCs. > >> > >> Signed-off-by: Matt Porter > > > > Kishon, are you ok with this driver ? > > yeah. Since this patch touches phy/Kconfig (and Makefile) and there is one > more > PHY driver to be merged that also modifies Kconfig there might be conflicts. > So > thought I should be taking this patch? > > > >> +static int bcm_kona_usb2_probe(struct platform_device *pdev) > >> +{ > >> + struct device *dev = >dev; > >> + struct bcm_kona_usb *phy; > >> + struct resource *res; > >> + struct phy *gphy; > >> + struct phy_provider *phy_provider; > >> + > >> + phy = devm_kzalloc(dev, sizeof(*phy), GFP_KERNEL); > >> + if (!phy) > >> + return -ENOMEM; > >> + > >> + res = platform_get_resource(pdev, IORESOURCE_MEM, 0); > >> + phy->regs = devm_ioremap_resource(>dev, res); > >> + if (IS_ERR(phy->regs)) > >> + return PTR_ERR(phy->regs); > >> + > >> + platform_set_drvdata(pdev, phy); > >> + > >> + phy_provider = devm_of_phy_provider_register(dev, > >> + of_phy_simple_xlate); > >> + if (IS_ERR(phy_provider)) > >> + return PTR_ERR(phy_provider); > >> + > >> + gphy = devm_phy_create(dev, , NULL); > >> + if (IS_ERR(gphy)) > >> + return PTR_ERR(gphy); > >> + > >> + /* The Kona PHY supports an 8-bit wide UTMI interface */ > >> + phy_set_bus_width(gphy, 8); > >> + > >> + phy_set_drvdata(gphy, phy); > > > > I think this set_drvdata() should be done before registering the > > provider, no ? > > hmm, right. I sent a v8 series update that addresses this issue. -Matt -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH v8 6/9] usb: gadget: s3c-hsotg: get phy bus width from phy subsystem
Adds support for querying the phy bus width from the generic phy subsystem. Configure UTMI bus width in GUSBCFG based on this value. Signed-off-by: Matt Porter Acked-by: Kishon Vijay Abraham I --- drivers/usb/gadget/s3c-hsotg.c | 14 +- drivers/usb/gadget/s3c-hsotg.h | 1 + 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/drivers/usb/gadget/s3c-hsotg.c b/drivers/usb/gadget/s3c-hsotg.c index 8f9bcdb..93ba8b6 100644 --- a/drivers/usb/gadget/s3c-hsotg.c +++ b/drivers/usb/gadget/s3c-hsotg.c @@ -146,6 +146,7 @@ struct s3c_hsotg_ep { * @regs: The memory area mapped for accessing registers. * @irq: The IRQ number we are using * @supplies: Definition of USB power supplies + * @phyif: PHY interface width * @dedicated_fifos: Set if the hardware has dedicated IN-EP fifos. * @num_of_eps: Number of available EPs (excluding EP0) * @debug_root: root directrory for debugfs. @@ -174,6 +175,7 @@ struct s3c_hsotg { struct regulator_bulk_data supplies[ARRAY_SIZE(s3c_hsotg_supply_names)]; + u32 phyif; unsigned intdedicated_fifos:1; unsigned char num_of_eps; @@ -2279,7 +2281,7 @@ static void s3c_hsotg_core_init(struct s3c_hsotg *hsotg) */ /* set the PLL on, remove the HNP/SRP and set the PHY */ - writel(GUSBCFG_PHYIf16 | GUSBCFG_TOutCal(7) | + writel(hsotg->phyif | GUSBCFG_TOutCal(7) | (0x5 << 10), hsotg->regs + GUSBCFG); s3c_hsotg_init_fifo(hsotg); @@ -3638,6 +3640,16 @@ static int s3c_hsotg_probe(struct platform_device *pdev) goto err_supplies; } + /* Set default UTMI width */ + hsotg->phyif = GUSBCFG_PHYIf16; + + /* +* If using the generic PHY framework, check if the PHY bus +* width is 8-bit and set the phyif appropriately. +*/ + if (hsotg->phy && (phy_get_bus_width(phy) == 8)) + hsotg->phyif = GUSBCFG_PHYIf8; + if (hsotg->phy) phy_init(hsotg->phy); diff --git a/drivers/usb/gadget/s3c-hsotg.h b/drivers/usb/gadget/s3c-hsotg.h index d650b12..85f549f 100644 --- a/drivers/usb/gadget/s3c-hsotg.h +++ b/drivers/usb/gadget/s3c-hsotg.h @@ -55,6 +55,7 @@ #define GUSBCFG_HNPCap (1 << 9) #define GUSBCFG_SRPCap (1 << 8) #define GUSBCFG_PHYIf16(1 << 3) +#define GUSBCFG_PHYIf8 (0 << 3) #define GUSBCFG_TOutCal_MASK (0x7 << 0) #define GUSBCFG_TOutCal_SHIFT (0) #define GUSBCFG_TOutCal_LIMIT (0x7) -- 1.8.4 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH v8 7/9] phy: add Broadcom Kona USB2 PHY DT binding
Add a binding that describes the Broadcom Kona USB2 PHY found on the BCM281xx family of SoCs. Signed-off-by: Matt Porter Acked-by: Kishon Vijay Abraham I --- Documentation/devicetree/bindings/phy/bcm-phy.txt | 15 +++ 1 file changed, 15 insertions(+) create mode 100644 Documentation/devicetree/bindings/phy/bcm-phy.txt diff --git a/Documentation/devicetree/bindings/phy/bcm-phy.txt b/Documentation/devicetree/bindings/phy/bcm-phy.txt new file mode 100644 index 000..3dc8b3d --- /dev/null +++ b/Documentation/devicetree/bindings/phy/bcm-phy.txt @@ -0,0 +1,15 @@ +BROADCOM KONA USB2 PHY + +Required properties: + - compatible: brcm,kona-usb2-phy + - reg: offset and length of the PHY registers + - #phy-cells: must be 0 +Refer to phy/phy-bindings.txt for the generic PHY binding properties + +Example: + + usbphy: usb-phy@3f13 { + compatible = "brcm,kona-usb2-phy"; + reg = <0x3f13 0x28>; + #phy-cells = <0>; + }; -- 1.8.4 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH v8 9/9] ARM: dts: add usb udc support to bcm281xx
Adds USB OTG/PHY and clock support to BCM281xx and enables UDC support on the bcm11351-brt and bcm28155-ap boards. Signed-off-by: Matt Porter Reviewed-by: Markus Mayer Reviewed-by: Tim Kryger --- arch/arm/boot/dts/bcm11351-brt.dts | 6 ++ arch/arm/boot/dts/bcm11351.dtsi| 18 ++ arch/arm/boot/dts/bcm28155-ap.dts | 8 3 files changed, 32 insertions(+) diff --git a/arch/arm/boot/dts/bcm11351-brt.dts b/arch/arm/boot/dts/bcm11351-brt.dts index 23cd16d..396b704 100644 --- a/arch/arm/boot/dts/bcm11351-brt.dts +++ b/arch/arm/boot/dts/bcm11351-brt.dts @@ -44,5 +44,11 @@ status = "okay"; }; + usbotg: usb@3f12 { + status = "okay"; + }; + usbphy: usb-phy@3f13 { + status = "okay"; + }; }; diff --git a/arch/arm/boot/dts/bcm11351.dtsi b/arch/arm/boot/dts/bcm11351.dtsi index 1246885..0fbb455 100644 --- a/arch/arm/boot/dts/bcm11351.dtsi +++ b/arch/arm/boot/dts/bcm11351.dtsi @@ -243,4 +243,22 @@ #clock-cells = <0>; }; }; + + usbotg: usb@3f12 { + compatible = "snps,dwc2"; + reg = <0x3f12 0x1>; + interrupts = ; + clocks = <_otg_ahb_clk>; + clock-names = "otg"; + phys = <>; + phy-names = "usb2-phy"; + status = "disabled"; + }; + + usbphy: usb-phy@3f13 { + compatible = "brcm,kona-usb2-phy"; + reg = <0x3f13 0x28>; + #phy-cells = <0>; + status = "disabled"; + }; }; diff --git a/arch/arm/boot/dts/bcm28155-ap.dts b/arch/arm/boot/dts/bcm28155-ap.dts index 08e47c2..a3bc436 100644 --- a/arch/arm/boot/dts/bcm28155-ap.dts +++ b/arch/arm/boot/dts/bcm28155-ap.dts @@ -43,4 +43,12 @@ cd-gpios = < 14 0>; status = "okay"; }; + + usbotg: usb@3f12 { + status = "okay"; + }; + + usbphy: usb-phy@3f13 { + status = "okay"; + }; }; -- 1.8.4 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH v8 4/9] usb: gadget: s3c-hsotg: add snps,dwc2 compatible string
Enable support for the dwc2 binding. Signed-off-by: Matt Porter --- drivers/usb/gadget/s3c-hsotg.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/usb/gadget/s3c-hsotg.c b/drivers/usb/gadget/s3c-hsotg.c index db797f2..cbfbf41 100644 --- a/drivers/usb/gadget/s3c-hsotg.c +++ b/drivers/usb/gadget/s3c-hsotg.c @@ -3726,6 +3726,7 @@ static int s3c_hsotg_remove(struct platform_device *pdev) #ifdef CONFIG_OF static const struct of_device_id s3c_hsotg_of_ids[] = { { .compatible = "samsung,s3c6400-hsotg", }, + { .compatible = "snps,dwc2", }, { /* sentinel */ } }; MODULE_DEVICE_TABLE(of, s3c_hsotg_of_ids); -- 1.8.4 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH v8 2/9] staging: dwc2: update DT binding to add generic clock/phy properties
dwc2/s3c-hsotg require a single clock to be specified and optionally a generic phy. On the s3c-hsotg driver old style USB phy support is present as a fallback so the generic phy properties are optional. Signed-off-by: Matt Porter Acked-by: Kishon Vijay Abraham I --- Documentation/devicetree/bindings/staging/dwc2.txt | 12 1 file changed, 12 insertions(+) diff --git a/Documentation/devicetree/bindings/staging/dwc2.txt b/Documentation/devicetree/bindings/staging/dwc2.txt index 1a1b7cf..a1753ed 100644 --- a/Documentation/devicetree/bindings/staging/dwc2.txt +++ b/Documentation/devicetree/bindings/staging/dwc2.txt @@ -5,6 +5,14 @@ Required properties: - compatible : "snps,dwc2" - reg : Should contain 1 register range (address and length) - interrupts : Should contain 1 interrupt +- clocks: clock provider specifier +- clock-names: shall be "otg" +Refer to clk/clock-bindings.txt for generic clock consumer properties + +Optional properties: +- phys: phy provider specifier +- phy-names: shall be "device" +Refer to phy/phy-bindings.txt for generic phy consumer properties Example: @@ -12,4 +20,8 @@ Example: compatible = "ralink,rt3050-usb, snps,dwc2"; reg = <0x101c 4>; interrupts = <18>; + clocks = <_otg_ahb_clk>; + clock-names = "otg"; + phys = <>; + phy-names = "usb2-phy"; }; -- 1.8.4 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH v8 2/9] staging: dwc2: update DT binding to add generic clock/phy properties
dwc2/s3c-hsotg require a single clock to be specified and optionally a generic phy. On the s3c-hsotg driver old style USB phy support is present as a fallback so the generic phy properties are optional. Signed-off-by: Matt Porter mpor...@linaro.org Acked-by: Kishon Vijay Abraham I kis...@ti.com --- Documentation/devicetree/bindings/staging/dwc2.txt | 12 1 file changed, 12 insertions(+) diff --git a/Documentation/devicetree/bindings/staging/dwc2.txt b/Documentation/devicetree/bindings/staging/dwc2.txt index 1a1b7cf..a1753ed 100644 --- a/Documentation/devicetree/bindings/staging/dwc2.txt +++ b/Documentation/devicetree/bindings/staging/dwc2.txt @@ -5,6 +5,14 @@ Required properties: - compatible : snps,dwc2 - reg : Should contain 1 register range (address and length) - interrupts : Should contain 1 interrupt +- clocks: clock provider specifier +- clock-names: shall be otg +Refer to clk/clock-bindings.txt for generic clock consumer properties + +Optional properties: +- phys: phy provider specifier +- phy-names: shall be device +Refer to phy/phy-bindings.txt for generic phy consumer properties Example: @@ -12,4 +20,8 @@ Example: compatible = ralink,rt3050-usb, snps,dwc2; reg = 0x101c 4; interrupts = 18; + clocks = usb_otg_ahb_clk; + clock-names = otg; + phys = usbphy; + phy-names = usb2-phy; }; -- 1.8.4 -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH v8 4/9] usb: gadget: s3c-hsotg: add snps,dwc2 compatible string
Enable support for the dwc2 binding. Signed-off-by: Matt Porter mpor...@linaro.org --- drivers/usb/gadget/s3c-hsotg.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/usb/gadget/s3c-hsotg.c b/drivers/usb/gadget/s3c-hsotg.c index db797f2..cbfbf41 100644 --- a/drivers/usb/gadget/s3c-hsotg.c +++ b/drivers/usb/gadget/s3c-hsotg.c @@ -3726,6 +3726,7 @@ static int s3c_hsotg_remove(struct platform_device *pdev) #ifdef CONFIG_OF static const struct of_device_id s3c_hsotg_of_ids[] = { { .compatible = samsung,s3c6400-hsotg, }, + { .compatible = snps,dwc2, }, { /* sentinel */ } }; MODULE_DEVICE_TABLE(of, s3c_hsotg_of_ids); -- 1.8.4 -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH v8 7/9] phy: add Broadcom Kona USB2 PHY DT binding
Add a binding that describes the Broadcom Kona USB2 PHY found on the BCM281xx family of SoCs. Signed-off-by: Matt Porter mpor...@linaro.org Acked-by: Kishon Vijay Abraham I kis...@ti.com --- Documentation/devicetree/bindings/phy/bcm-phy.txt | 15 +++ 1 file changed, 15 insertions(+) create mode 100644 Documentation/devicetree/bindings/phy/bcm-phy.txt diff --git a/Documentation/devicetree/bindings/phy/bcm-phy.txt b/Documentation/devicetree/bindings/phy/bcm-phy.txt new file mode 100644 index 000..3dc8b3d --- /dev/null +++ b/Documentation/devicetree/bindings/phy/bcm-phy.txt @@ -0,0 +1,15 @@ +BROADCOM KONA USB2 PHY + +Required properties: + - compatible: brcm,kona-usb2-phy + - reg: offset and length of the PHY registers + - #phy-cells: must be 0 +Refer to phy/phy-bindings.txt for the generic PHY binding properties + +Example: + + usbphy: usb-phy@3f13 { + compatible = brcm,kona-usb2-phy; + reg = 0x3f13 0x28; + #phy-cells = 0; + }; -- 1.8.4 -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH v8 9/9] ARM: dts: add usb udc support to bcm281xx
Adds USB OTG/PHY and clock support to BCM281xx and enables UDC support on the bcm11351-brt and bcm28155-ap boards. Signed-off-by: Matt Porter mpor...@linaro.org Reviewed-by: Markus Mayer markus.ma...@linaro.org Reviewed-by: Tim Kryger tim.kry...@linaro.org --- arch/arm/boot/dts/bcm11351-brt.dts | 6 ++ arch/arm/boot/dts/bcm11351.dtsi| 18 ++ arch/arm/boot/dts/bcm28155-ap.dts | 8 3 files changed, 32 insertions(+) diff --git a/arch/arm/boot/dts/bcm11351-brt.dts b/arch/arm/boot/dts/bcm11351-brt.dts index 23cd16d..396b704 100644 --- a/arch/arm/boot/dts/bcm11351-brt.dts +++ b/arch/arm/boot/dts/bcm11351-brt.dts @@ -44,5 +44,11 @@ status = okay; }; + usbotg: usb@3f12 { + status = okay; + }; + usbphy: usb-phy@3f13 { + status = okay; + }; }; diff --git a/arch/arm/boot/dts/bcm11351.dtsi b/arch/arm/boot/dts/bcm11351.dtsi index 1246885..0fbb455 100644 --- a/arch/arm/boot/dts/bcm11351.dtsi +++ b/arch/arm/boot/dts/bcm11351.dtsi @@ -243,4 +243,22 @@ #clock-cells = 0; }; }; + + usbotg: usb@3f12 { + compatible = snps,dwc2; + reg = 0x3f12 0x1; + interrupts = GIC_SPI 47 IRQ_TYPE_LEVEL_HIGH; + clocks = usb_otg_ahb_clk; + clock-names = otg; + phys = usbphy; + phy-names = usb2-phy; + status = disabled; + }; + + usbphy: usb-phy@3f13 { + compatible = brcm,kona-usb2-phy; + reg = 0x3f13 0x28; + #phy-cells = 0; + status = disabled; + }; }; diff --git a/arch/arm/boot/dts/bcm28155-ap.dts b/arch/arm/boot/dts/bcm28155-ap.dts index 08e47c2..a3bc436 100644 --- a/arch/arm/boot/dts/bcm28155-ap.dts +++ b/arch/arm/boot/dts/bcm28155-ap.dts @@ -43,4 +43,12 @@ cd-gpios = gpio 14 0; status = okay; }; + + usbotg: usb@3f12 { + status = okay; + }; + + usbphy: usb-phy@3f13 { + status = okay; + }; }; -- 1.8.4 -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH v8 6/9] usb: gadget: s3c-hsotg: get phy bus width from phy subsystem
Adds support for querying the phy bus width from the generic phy subsystem. Configure UTMI bus width in GUSBCFG based on this value. Signed-off-by: Matt Porter mpor...@linaro.org Acked-by: Kishon Vijay Abraham I kis...@ti.com --- drivers/usb/gadget/s3c-hsotg.c | 14 +- drivers/usb/gadget/s3c-hsotg.h | 1 + 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/drivers/usb/gadget/s3c-hsotg.c b/drivers/usb/gadget/s3c-hsotg.c index 8f9bcdb..93ba8b6 100644 --- a/drivers/usb/gadget/s3c-hsotg.c +++ b/drivers/usb/gadget/s3c-hsotg.c @@ -146,6 +146,7 @@ struct s3c_hsotg_ep { * @regs: The memory area mapped for accessing registers. * @irq: The IRQ number we are using * @supplies: Definition of USB power supplies + * @phyif: PHY interface width * @dedicated_fifos: Set if the hardware has dedicated IN-EP fifos. * @num_of_eps: Number of available EPs (excluding EP0) * @debug_root: root directrory for debugfs. @@ -174,6 +175,7 @@ struct s3c_hsotg { struct regulator_bulk_data supplies[ARRAY_SIZE(s3c_hsotg_supply_names)]; + u32 phyif; unsigned intdedicated_fifos:1; unsigned char num_of_eps; @@ -2279,7 +2281,7 @@ static void s3c_hsotg_core_init(struct s3c_hsotg *hsotg) */ /* set the PLL on, remove the HNP/SRP and set the PHY */ - writel(GUSBCFG_PHYIf16 | GUSBCFG_TOutCal(7) | + writel(hsotg-phyif | GUSBCFG_TOutCal(7) | (0x5 10), hsotg-regs + GUSBCFG); s3c_hsotg_init_fifo(hsotg); @@ -3638,6 +3640,16 @@ static int s3c_hsotg_probe(struct platform_device *pdev) goto err_supplies; } + /* Set default UTMI width */ + hsotg-phyif = GUSBCFG_PHYIf16; + + /* +* If using the generic PHY framework, check if the PHY bus +* width is 8-bit and set the phyif appropriately. +*/ + if (hsotg-phy (phy_get_bus_width(phy) == 8)) + hsotg-phyif = GUSBCFG_PHYIf8; + if (hsotg-phy) phy_init(hsotg-phy); diff --git a/drivers/usb/gadget/s3c-hsotg.h b/drivers/usb/gadget/s3c-hsotg.h index d650b12..85f549f 100644 --- a/drivers/usb/gadget/s3c-hsotg.h +++ b/drivers/usb/gadget/s3c-hsotg.h @@ -55,6 +55,7 @@ #define GUSBCFG_HNPCap (1 9) #define GUSBCFG_SRPCap (1 8) #define GUSBCFG_PHYIf16(1 3) +#define GUSBCFG_PHYIf8 (0 3) #define GUSBCFG_TOutCal_MASK (0x7 0) #define GUSBCFG_TOutCal_SHIFT (0) #define GUSBCFG_TOutCal_LIMIT (0x7) -- 1.8.4 -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH v8 5/9] usb: gadget: s3c-hsotg: enable generic phy support
Adds support for the generic PHY subsystem. Generic PHY support is probed and then the driver falls back to checking for an old style USB PHY and pdata if not found. Signed-off-by: Matt Porter mpor...@linaro.org --- drivers/usb/gadget/s3c-hsotg.c | 55 ++ 1 file changed, 39 insertions(+), 16 deletions(-) diff --git a/drivers/usb/gadget/s3c-hsotg.c b/drivers/usb/gadget/s3c-hsotg.c index cbfbf41..8f9bcdb 100644 --- a/drivers/usb/gadget/s3c-hsotg.c +++ b/drivers/usb/gadget/s3c-hsotg.c @@ -30,6 +30,8 @@ #include linux/clk.h #include linux/regulator/consumer.h #include linux/of_platform.h +#include linux/phy/phy.h +#include linux/usb/phy.h #include linux/usb/ch9.h #include linux/usb/gadget.h @@ -138,6 +140,7 @@ struct s3c_hsotg_ep { * @dev: The parent device supplied to the probe function * @driver: USB gadget driver * @phy: The otg phy transceiver structure for phy control. + * @uphy: The otg phy transceiver structure for old USB phy control. * @plat: The platform specific configuration data. This can be removed once * all SoCs support usb transceiver. * @regs: The memory area mapped for accessing registers. @@ -159,7 +162,8 @@ struct s3c_hsotg_ep { struct s3c_hsotg { struct device*dev; struct usb_gadget_driver *driver; - struct usb_phy *phy; + struct phy *phy; + struct usb_phy *uphy; struct s3c_hsotg_plat*plat; spinlock_t lock; @@ -2901,8 +2905,11 @@ static void s3c_hsotg_phy_enable(struct s3c_hsotg *hsotg) dev_dbg(hsotg-dev, pdev 0x%p\n, pdev); - if (hsotg-phy) - usb_phy_init(hsotg-phy); + if (hsotg-phy) { + phy_init(hsotg-phy); + phy_power_on(hsotg-phy); + } else if (hsotg-uphy) + usb_phy_init(hsotg-uphy); else if (hsotg-plat-phy_init) hsotg-plat-phy_init(pdev, hsotg-plat-phy_type); } @@ -2918,8 +2925,11 @@ static void s3c_hsotg_phy_disable(struct s3c_hsotg *hsotg) { struct platform_device *pdev = to_platform_device(hsotg-dev); - if (hsotg-phy) - usb_phy_shutdown(hsotg-phy); + if (hsotg-phy) { + phy_power_off(hsotg-phy); + phy_exit(hsotg-phy); + } else if (hsotg-uphy) + usb_phy_shutdown(hsotg-uphy); else if (hsotg-plat-phy_exit) hsotg-plat-phy_exit(pdev, hsotg-plat-phy_type); } @@ -3526,7 +3536,8 @@ static void s3c_hsotg_delete_debug(struct s3c_hsotg *hsotg) static int s3c_hsotg_probe(struct platform_device *pdev) { struct s3c_hsotg_plat *plat = dev_get_platdata(pdev-dev); - struct usb_phy *phy; + struct phy *phy; + struct usb_phy *uphy; struct device *dev = pdev-dev; struct s3c_hsotg_ep *eps; struct s3c_hsotg *hsotg; @@ -3541,19 +3552,26 @@ static int s3c_hsotg_probe(struct platform_device *pdev) return -ENOMEM; } - phy = devm_usb_get_phy(dev, USB_PHY_TYPE_USB2); + /* +* Attempt to find a generic PHY, then look for an old style +* USB PHY, finally fall back to pdata +*/ + phy = devm_phy_get(pdev-dev, usb2-phy); if (IS_ERR(phy)) { - /* Fallback for pdata */ - plat = dev_get_platdata(pdev-dev); - if (!plat) { - dev_err(pdev-dev, no platform data or transceiver defined\n); - return -EPROBE_DEFER; - } else { + uphy = devm_usb_get_phy(dev, USB_PHY_TYPE_USB2); + if (IS_ERR(uphy)) { + /* Fallback for pdata */ + plat = dev_get_platdata(pdev-dev); + if (!plat) { + dev_err(pdev-dev, + no platform data or transceiver defined\n); + return -EPROBE_DEFER; + } hsotg-plat = plat; - } - } else { + } else + hsotg-uphy = uphy; + } else hsotg-phy = phy; - } hsotg-dev = dev; @@ -3620,6 +3638,9 @@ static int s3c_hsotg_probe(struct platform_device *pdev) goto err_supplies; } + if (hsotg-phy) + phy_init(hsotg-phy); + /* usb phy enable */ s3c_hsotg_phy_enable(hsotg); @@ -3713,6 +3734,8 @@ static int s3c_hsotg_remove(struct platform_device *pdev) } s3c_hsotg_phy_disable(hsotg); + if (hsotg-phy) + phy_exit(hsotg-phy); clk_disable_unprepare(hsotg-clk); return 0; -- 1.8.4 -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read
Re: [PATCH v7 8/9] phy: add Broadcom Kona USB2 PHY driver
On Thu, Dec 19, 2013 at 11:19:35AM +0530, Kishon Vijay Abraham I wrote: Hi Felipe, On Wednesday 18 December 2013 09:55 PM, Felipe Balbi wrote: On Tue, Dec 17, 2013 at 02:42:35PM -0500, Matt Porter wrote: Add a driver for the internal Broadcom Kona USB 2.0 PHY found on the BCM281xx family of SoCs. Signed-off-by: Matt Porter mpor...@linaro.org Kishon, are you ok with this driver ? yeah. Since this patch touches phy/Kconfig (and Makefile) and there is one more PHY driver to be merged that also modifies Kconfig there might be conflicts. So thought I should be taking this patch? +static int bcm_kona_usb2_probe(struct platform_device *pdev) +{ + struct device *dev = pdev-dev; + struct bcm_kona_usb *phy; + struct resource *res; + struct phy *gphy; + struct phy_provider *phy_provider; + + phy = devm_kzalloc(dev, sizeof(*phy), GFP_KERNEL); + if (!phy) + return -ENOMEM; + + res = platform_get_resource(pdev, IORESOURCE_MEM, 0); + phy-regs = devm_ioremap_resource(pdev-dev, res); + if (IS_ERR(phy-regs)) + return PTR_ERR(phy-regs); + + platform_set_drvdata(pdev, phy); + + phy_provider = devm_of_phy_provider_register(dev, + of_phy_simple_xlate); + if (IS_ERR(phy_provider)) + return PTR_ERR(phy_provider); + + gphy = devm_phy_create(dev, ops, NULL); + if (IS_ERR(gphy)) + return PTR_ERR(gphy); + + /* The Kona PHY supports an 8-bit wide UTMI interface */ + phy_set_bus_width(gphy, 8); + + phy_set_drvdata(gphy, phy); I think this set_drvdata() should be done before registering the provider, no ? hmm, right. I sent a v8 series update that addresses this issue. -Matt -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH v8 8/9] phy: add Broadcom Kona USB2 PHY driver
Add a driver for the internal Broadcom Kona USB 2.0 PHY found on the BCM281xx family of SoCs. Signed-off-by: Matt Porter mpor...@linaro.org --- drivers/phy/Kconfig | 6 ++ drivers/phy/Makefile| 1 + drivers/phy/phy-bcm-kona-usb2.c | 158 3 files changed, 165 insertions(+) create mode 100644 drivers/phy/phy-bcm-kona-usb2.c diff --git a/drivers/phy/Kconfig b/drivers/phy/Kconfig index a344f3d..2e87fa8 100644 --- a/drivers/phy/Kconfig +++ b/drivers/phy/Kconfig @@ -51,4 +51,10 @@ config PHY_EXYNOS_DP_VIDEO help Support for Display Port PHY found on Samsung EXYNOS SoCs. +config BCM_KONA_USB2_PHY + tristate Broadcom Kona USB2 PHY Driver + depends on GENERIC_PHY + help + Enable this to support the Broadcom Kona USB 2.0 PHY. + endmenu diff --git a/drivers/phy/Makefile b/drivers/phy/Makefile index d0caae9..c447f1a 100644 --- a/drivers/phy/Makefile +++ b/drivers/phy/Makefile @@ -3,6 +3,7 @@ # obj-$(CONFIG_GENERIC_PHY) += phy-core.o +obj-$(CONFIG_BCM_KONA_USB2_PHY)+= phy-bcm-kona-usb2.o obj-$(CONFIG_PHY_EXYNOS_DP_VIDEO) += phy-exynos-dp-video.o obj-$(CONFIG_PHY_EXYNOS_MIPI_VIDEO)+= phy-exynos-mipi-video.o obj-$(CONFIG_OMAP_USB2)+= phy-omap-usb2.o diff --git a/drivers/phy/phy-bcm-kona-usb2.c b/drivers/phy/phy-bcm-kona-usb2.c new file mode 100644 index 000..efc5c1a --- /dev/null +++ b/drivers/phy/phy-bcm-kona-usb2.c @@ -0,0 +1,158 @@ +/* + * phy-bcm-kona-usb2.c - Broadcom Kona USB2 Phy Driver + * + * Copyright (C) 2013 Linaro Limited + * Matt Porter mpor...@linaro.org + * + * This software is licensed under the terms of the GNU General Public + * License version 2, as published by the Free Software Foundation, and + * may be copied, distributed, and modified under those terms. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + */ + +#include linux/clk.h +#include linux/delay.h +#include linux/err.h +#include linux/io.h +#include linux/module.h +#include linux/of.h +#include linux/phy/phy.h +#include linux/platform_device.h + +#define OTGCTL (0) +#define OTGCTL_OTGSTAT2BIT(31) +#define OTGCTL_OTGSTAT1BIT(30) +#define OTGCTL_PRST_N_SW BIT(11) +#define OTGCTL_HRESET_NBIT(10) +#define OTGCTL_UTMI_LINE_STATE1BIT(9) +#define OTGCTL_UTMI_LINE_STATE0BIT(8) + +#define P1CTL (8) +#define P1CTL_SOFT_RESET BIT(1) +#define P1CTL_NON_DRIVING BIT(0) + +struct bcm_kona_usb { + void __iomem *regs; +}; + +static void bcm_kona_usb_phy_power(struct bcm_kona_usb *phy, int on) +{ + u32 val; + + val = readl(phy-regs + OTGCTL); + if (on) { + /* Configure and power PHY */ + val = ~(OTGCTL_OTGSTAT2 | OTGCTL_OTGSTAT1 | +OTGCTL_UTMI_LINE_STATE1 | OTGCTL_UTMI_LINE_STATE0); + val |= OTGCTL_PRST_N_SW | OTGCTL_HRESET_N; + } else { + val = ~(OTGCTL_PRST_N_SW | OTGCTL_HRESET_N); + } + writel(val, phy-regs + OTGCTL); +} + +static int bcm_kona_usb_phy_init(struct phy *gphy) +{ + struct bcm_kona_usb *phy = phy_get_drvdata(gphy); + u32 val; + + /* Soft reset PHY */ + val = readl(phy-regs + P1CTL); + val = ~P1CTL_NON_DRIVING; + val |= P1CTL_SOFT_RESET; + writel(val, phy-regs + P1CTL); + writel(val ~P1CTL_SOFT_RESET, phy-regs + P1CTL); + /* Reset needs to be asserted for 2ms */ + mdelay(2); + writel(val | P1CTL_SOFT_RESET, phy-regs + P1CTL); + + return 0; +} + +static int bcm_kona_usb_phy_power_on(struct phy *gphy) +{ + struct bcm_kona_usb *phy = phy_get_drvdata(gphy); + + bcm_kona_usb_phy_power(phy, 1); + + return 0; +} + +static int bcm_kona_usb_phy_power_off(struct phy *gphy) +{ + struct bcm_kona_usb *phy = phy_get_drvdata(gphy); + + bcm_kona_usb_phy_power(phy, 0); + + return 0; +} + +static struct phy_ops ops = { + .init = bcm_kona_usb_phy_init, + .power_on = bcm_kona_usb_phy_power_on, + .power_off = bcm_kona_usb_phy_power_off, + .owner = THIS_MODULE, +}; + +static int bcm_kona_usb2_probe(struct platform_device *pdev) +{ + struct device *dev = pdev-dev; + struct bcm_kona_usb *phy; + struct resource *res; + struct phy *gphy; + struct phy_provider *phy_provider; + + phy = devm_kzalloc(dev, sizeof(*phy), GFP_KERNEL); + if (!phy) + return -ENOMEM; + + res = platform_get_resource(pdev, IORESOURCE_MEM, 0); + phy-regs = devm_ioremap_resource(pdev-dev, res); + if (IS_ERR(phy-regs)) + return
[PATCH v8 3/9] usb: gadget: s3c-hsotg: enable build for other platforms
Remove unused Samsung-specific machine include and Kconfig dependency on S3C. Signed-off-by: Matt Porter mpor...@linaro.org Reviewed-by: Markus Mayer markus.ma...@linaro.org Reviewed-by: Tim Kryger tim.kry...@linaro.org --- drivers/usb/gadget/Kconfig | 7 +++ drivers/usb/gadget/s3c-hsotg.c | 2 -- 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/drivers/usb/gadget/Kconfig b/drivers/usb/gadget/Kconfig index a91e642..181e760 100644 --- a/drivers/usb/gadget/Kconfig +++ b/drivers/usb/gadget/Kconfig @@ -294,11 +294,10 @@ config USB_PXA27X gadget drivers to also be dynamically linked. config USB_S3C_HSOTG - tristate S3C HS/OtG USB Device controller - depends on S3C_DEV_USB_HSOTG + tristate Designware/S3C HS/OtG USB Device controller help - The Samsung S3C64XX USB2.0 high-speed gadget controller - integrated into the S3C64XX series SoC. + The Designware USB2.0 high-speed gadget controller + integrated into many SoCs. config USB_S3C2410 tristate S3C2410 USB Device Controller diff --git a/drivers/usb/gadget/s3c-hsotg.c b/drivers/usb/gadget/s3c-hsotg.c index 9875d9c..db797f2 100644 --- a/drivers/usb/gadget/s3c-hsotg.c +++ b/drivers/usb/gadget/s3c-hsotg.c @@ -36,8 +36,6 @@ #include linux/usb/phy.h #include linux/platform_data/s3c-hsotg.h -#include mach/map.h - #include s3c-hsotg.h static const char * const s3c_hsotg_supply_names[] = { -- 1.8.4 -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH v8 1/9] phy: add phy_get_bus_width()/phy_set_bus_width() calls
This adds a pair of APIs that allows the generic PHY subsystem to provide information on the PHY bus width. The PHY provider driver may use phy_set_bus_width() to set the bus width that the PHY supports. The controller driver may then use phy_get_bus_width() to fetch the PHY bus width in order to properly configure the controller. Signed-off-by: Matt Porter mpor...@linaro.org Acked-by: Kishon Vijay Abraham I kis...@ti.com --- include/linux/phy/phy.h | 28 1 file changed, 28 insertions(+) diff --git a/include/linux/phy/phy.h b/include/linux/phy/phy.h index 6d72269..e273e5a 100644 --- a/include/linux/phy/phy.h +++ b/include/linux/phy/phy.h @@ -38,6 +38,14 @@ struct phy_ops { }; /** + * struct phy_attrs - represents phy attributes + * @bus_width: Data path width implemented by PHY + */ +struct phy_attrs { + u32 bus_width; +}; + +/** * struct phy - represents the phy device * @dev: phy device * @id: id of the phy device @@ -46,6 +54,7 @@ struct phy_ops { * @mutex: mutex to protect phy_ops * @init_count: used to protect when the PHY is used by multiple consumers * @power_count: used to protect when the PHY is used by multiple consumers + * @phy_attrs: used to specify PHY specific attributes */ struct phy { struct device dev; @@ -55,6 +64,7 @@ struct phy { struct mutexmutex; int init_count; int power_count; + struct phy_attrsattrs; }; /** @@ -127,6 +137,14 @@ int phy_init(struct phy *phy); int phy_exit(struct phy *phy); int phy_power_on(struct phy *phy); int phy_power_off(struct phy *phy); +static inline int phy_get_bus_width(struct phy *phy) +{ + return phy-attrs.bus_width; +} +static inline void phy_set_bus_width(struct phy *phy, int bus_width) +{ + phy-attrs.bus_width = bus_width; +} struct phy *phy_get(struct device *dev, const char *string); struct phy *devm_phy_get(struct device *dev, const char *string); void phy_put(struct phy *phy); @@ -199,6 +217,16 @@ static inline int phy_power_off(struct phy *phy) return -ENOSYS; } +static inline int phy_get_bus_width(struct phy *phy) +{ + return -ENOSYS; +} + +static inline void phy_set_bus_width(struct phy *phy, int bus_width) +{ + return; +} + static inline struct phy *phy_get(struct device *dev, const char *string) { return ERR_PTR(-ENOSYS); -- 1.8.4 -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH v8 0/9] USB Device Controller support for BCM281xx
Changes since v7: - Register phy provider with generic phy subsystem only after the generic phy has been allocated and configured. Changes since v6: - Drop dependency on the Exynos generic phy conversion series - Bring back original patch that converts s3c-hsotg to use the generic phy layer with a fall back to the old usb style phy support. Changes since v5: - tweak s3c-hsotg Kconfig help message to be more generic Changes since v4: - phy_set/get_bus_width now use an int for bus_width Changes since v3: - Rebased on 3.13-rc3 - Move struct phy bus_width attribute back into struct phy_attrs - Fix build issue on !GENERIC_PHY - Update dwc2 binding to reflect optional phy properties - Rename bcm-kona-phy.txt binding to bcm-phy.txt - Reorder bcm kona phy includes and use bitops - phy-names changed to usb2-phy to match updated s3c-hsotg generic phy-ification series Changes since v2: - Rebased on 3.13-rc1 - Fix braces in phy_get_bus_width()/phy_set_bus_width() - Drop generic phy conversion to use the same support from the Exynos generic phy conversion series - Modify dts support to match the device phy name required in the v3 Exynos generic phy conversion - Add s3c-hsotg phy_init/phy_exit support - Fix typo on reg property in kona phy binding - Replace phy driver reg struct with offset defines - Move phy soft reset to phy driver init - Fix dts node names to match ePAPR conventions Changes since v1: - Convert USB phy driver to generic phy subsystem - Add phy bus width apis - Drop dwc2 phy bus width DT property in favor of querying the phy provider for bus width - Add generic phy/clock properties to dwc2 DT binding - Add generic phy subsystem support to s3c-hsotg with the existing usb phy and pdata phy methods as a fallback - Split bindings out to separate patches to match the latest DT binding review guidelines This series adds USB Device Controller support for the Broadcom BCM281xx family of parts. BCM281xx contains a DWC2 OTG block and s3c-hsotg is used to support UDC operation. Part 1 adds phy bus width support to the generic phy subsystem Parts 2-6 allows s3c-hsotg to build on non-Samsung platforms, supports the dwc2 binding, adds generic phy layer support, and supports fetching phy bus width using the generic phy layer. Parts 7-8 add a generic phy binding and driver for the BCM Kona USB PHY. Part 9 adds the DT nodes to enable UDC support on both BCM281xx boards in the kernel. This series depends on: - Update Kona drivers to use clocks v4 series https://lkml.org/lkml/2013/12/5/508 (relevant portion now queued for 3.14) Matt Porter (9): phy: add phy_get_bus_width()/phy_set_bus_width() calls staging: dwc2: update DT binding to add generic clock/phy properties usb: gadget: s3c-hsotg: enable build for other platforms usb: gadget: s3c-hsotg: add snps,dwc2 compatible string usb: gadget: s3c-hsotg: enable generic phy support usb: gadget: s3c-hsotg: get phy bus width from phy subsystem phy: add Broadcom Kona USB2 PHY DT binding phy: add Broadcom Kona USB2 PHY driver ARM: dts: add usb udc support to bcm281xx Documentation/devicetree/bindings/phy/bcm-phy.txt | 15 ++ Documentation/devicetree/bindings/staging/dwc2.txt | 12 ++ arch/arm/boot/dts/bcm11351-brt.dts | 6 + arch/arm/boot/dts/bcm11351.dtsi| 18 +++ arch/arm/boot/dts/bcm28155-ap.dts | 8 ++ drivers/phy/Kconfig| 6 + drivers/phy/Makefile | 1 + drivers/phy/phy-bcm-kona-usb2.c| 158 + drivers/usb/gadget/Kconfig | 7 +- drivers/usb/gadget/s3c-hsotg.c | 72 +++--- drivers/usb/gadget/s3c-hsotg.h | 1 + include/linux/phy/phy.h| 28 12 files changed, 309 insertions(+), 23 deletions(-) create mode 100644 Documentation/devicetree/bindings/phy/bcm-phy.txt create mode 100644 drivers/phy/phy-bcm-kona-usb2.c -- 1.8.4 -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH v7 8/9] phy: add Broadcom Kona USB2 PHY driver
On Wed, Dec 18, 2013 at 10:25:54AM -0600, Felipe Balbi wrote: > On Tue, Dec 17, 2013 at 02:42:35PM -0500, Matt Porter wrote: > > Add a driver for the internal Broadcom Kona USB 2.0 PHY found > > on the BCM281xx family of SoCs. > > > > Signed-off-by: Matt Porter > > Kishon, are you ok with this driver ? Kishon did mention he was fine with this if I addressed a couple comments a couple versions ago, I neglected solicit his ack though. > > +static int bcm_kona_usb2_probe(struct platform_device *pdev) > > +{ > > + struct device *dev = >dev; > > + struct bcm_kona_usb *phy; > > + struct resource *res; > > + struct phy *gphy; > > + struct phy_provider *phy_provider; > > + > > + phy = devm_kzalloc(dev, sizeof(*phy), GFP_KERNEL); > > + if (!phy) > > + return -ENOMEM; > > + > > + res = platform_get_resource(pdev, IORESOURCE_MEM, 0); > > + phy->regs = devm_ioremap_resource(>dev, res); > > + if (IS_ERR(phy->regs)) > > + return PTR_ERR(phy->regs); > > + > > + platform_set_drvdata(pdev, phy); > > + > > + phy_provider = devm_of_phy_provider_register(dev, > > + of_phy_simple_xlate); > > + if (IS_ERR(phy_provider)) > > + return PTR_ERR(phy_provider); > > + > > + gphy = devm_phy_create(dev, , NULL); > > + if (IS_ERR(gphy)) > > + return PTR_ERR(gphy); > > + > > + /* The Kona PHY supports an 8-bit wide UTMI interface */ > > + phy_set_bus_width(gphy, 8); > > + > > + phy_set_drvdata(gphy, phy); > > I think this set_drvdata() should be done before registering the > provider, no ? It seems so, given that we wouldn't want the provider on on the provider list until the phy has been allocated and configured. Interestingly, this also needs to be addressed in the four phy drivers already upstream...they all do the same thing before the generic phy is created. -Matt -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH v7 8/9] phy: add Broadcom Kona USB2 PHY driver
On Wed, Dec 18, 2013 at 10:25:54AM -0600, Felipe Balbi wrote: On Tue, Dec 17, 2013 at 02:42:35PM -0500, Matt Porter wrote: Add a driver for the internal Broadcom Kona USB 2.0 PHY found on the BCM281xx family of SoCs. Signed-off-by: Matt Porter mpor...@linaro.org Kishon, are you ok with this driver ? Kishon did mention he was fine with this if I addressed a couple comments a couple versions ago, I neglected solicit his ack though. +static int bcm_kona_usb2_probe(struct platform_device *pdev) +{ + struct device *dev = pdev-dev; + struct bcm_kona_usb *phy; + struct resource *res; + struct phy *gphy; + struct phy_provider *phy_provider; + + phy = devm_kzalloc(dev, sizeof(*phy), GFP_KERNEL); + if (!phy) + return -ENOMEM; + + res = platform_get_resource(pdev, IORESOURCE_MEM, 0); + phy-regs = devm_ioremap_resource(pdev-dev, res); + if (IS_ERR(phy-regs)) + return PTR_ERR(phy-regs); + + platform_set_drvdata(pdev, phy); + + phy_provider = devm_of_phy_provider_register(dev, + of_phy_simple_xlate); + if (IS_ERR(phy_provider)) + return PTR_ERR(phy_provider); + + gphy = devm_phy_create(dev, ops, NULL); + if (IS_ERR(gphy)) + return PTR_ERR(gphy); + + /* The Kona PHY supports an 8-bit wide UTMI interface */ + phy_set_bus_width(gphy, 8); + + phy_set_drvdata(gphy, phy); I think this set_drvdata() should be done before registering the provider, no ? It seems so, given that we wouldn't want the provider on on the provider list until the phy has been allocated and configured. Interestingly, this also needs to be addressed in the four phy drivers already upstream...they all do the same thing before the generic phy is created. -Matt -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH v7 7/9] phy: add Broadcom Kona USB2 PHY DT binding
Add a binding that describes the Broadcom Kona USB2 PHY found on the BCM281xx family of SoCs. Signed-off-by: Matt Porter Acked-by: Kishon Vijay Abraham I --- Documentation/devicetree/bindings/phy/bcm-phy.txt | 15 +++ 1 file changed, 15 insertions(+) create mode 100644 Documentation/devicetree/bindings/phy/bcm-phy.txt diff --git a/Documentation/devicetree/bindings/phy/bcm-phy.txt b/Documentation/devicetree/bindings/phy/bcm-phy.txt new file mode 100644 index 000..3dc8b3d --- /dev/null +++ b/Documentation/devicetree/bindings/phy/bcm-phy.txt @@ -0,0 +1,15 @@ +BROADCOM KONA USB2 PHY + +Required properties: + - compatible: brcm,kona-usb2-phy + - reg: offset and length of the PHY registers + - #phy-cells: must be 0 +Refer to phy/phy-bindings.txt for the generic PHY binding properties + +Example: + + usbphy: usb-phy@3f13 { + compatible = "brcm,kona-usb2-phy"; + reg = <0x3f13 0x28>; + #phy-cells = <0>; + }; -- 1.8.4 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH v7 9/9] ARM: dts: add usb udc support to bcm281xx
Adds USB OTG/PHY and clock support to BCM281xx and enables UDC support on the bcm11351-brt and bcm28155-ap boards. Signed-off-by: Matt Porter Reviewed-by: Markus Mayer Reviewed-by: Tim Kryger --- arch/arm/boot/dts/bcm11351-brt.dts | 6 ++ arch/arm/boot/dts/bcm11351.dtsi| 18 ++ arch/arm/boot/dts/bcm28155-ap.dts | 8 3 files changed, 32 insertions(+) diff --git a/arch/arm/boot/dts/bcm11351-brt.dts b/arch/arm/boot/dts/bcm11351-brt.dts index 23cd16d..396b704 100644 --- a/arch/arm/boot/dts/bcm11351-brt.dts +++ b/arch/arm/boot/dts/bcm11351-brt.dts @@ -44,5 +44,11 @@ status = "okay"; }; + usbotg: usb@3f12 { + status = "okay"; + }; + usbphy: usb-phy@3f13 { + status = "okay"; + }; }; diff --git a/arch/arm/boot/dts/bcm11351.dtsi b/arch/arm/boot/dts/bcm11351.dtsi index 1246885..0fbb455 100644 --- a/arch/arm/boot/dts/bcm11351.dtsi +++ b/arch/arm/boot/dts/bcm11351.dtsi @@ -243,4 +243,22 @@ #clock-cells = <0>; }; }; + + usbotg: usb@3f12 { + compatible = "snps,dwc2"; + reg = <0x3f12 0x1>; + interrupts = ; + clocks = <_otg_ahb_clk>; + clock-names = "otg"; + phys = <>; + phy-names = "usb2-phy"; + status = "disabled"; + }; + + usbphy: usb-phy@3f13 { + compatible = "brcm,kona-usb2-phy"; + reg = <0x3f13 0x28>; + #phy-cells = <0>; + status = "disabled"; + }; }; diff --git a/arch/arm/boot/dts/bcm28155-ap.dts b/arch/arm/boot/dts/bcm28155-ap.dts index 08e47c2..a3bc436 100644 --- a/arch/arm/boot/dts/bcm28155-ap.dts +++ b/arch/arm/boot/dts/bcm28155-ap.dts @@ -43,4 +43,12 @@ cd-gpios = < 14 0>; status = "okay"; }; + + usbotg: usb@3f12 { + status = "okay"; + }; + + usbphy: usb-phy@3f13 { + status = "okay"; + }; }; -- 1.8.4 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH v7 3/9] usb: gadget: s3c-hsotg: enable build for other platforms
Remove unused Samsung-specific machine include and Kconfig dependency on S3C. Signed-off-by: Matt Porter Reviewed-by: Markus Mayer Reviewed-by: Tim Kryger --- drivers/usb/gadget/Kconfig | 7 +++ drivers/usb/gadget/s3c-hsotg.c | 2 -- 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/drivers/usb/gadget/Kconfig b/drivers/usb/gadget/Kconfig index a91e642..181e760 100644 --- a/drivers/usb/gadget/Kconfig +++ b/drivers/usb/gadget/Kconfig @@ -294,11 +294,10 @@ config USB_PXA27X gadget drivers to also be dynamically linked. config USB_S3C_HSOTG - tristate "S3C HS/OtG USB Device controller" - depends on S3C_DEV_USB_HSOTG + tristate "Designware/S3C HS/OtG USB Device controller" help - The Samsung S3C64XX USB2.0 high-speed gadget controller - integrated into the S3C64XX series SoC. + The Designware USB2.0 high-speed gadget controller + integrated into many SoCs. config USB_S3C2410 tristate "S3C2410 USB Device Controller" diff --git a/drivers/usb/gadget/s3c-hsotg.c b/drivers/usb/gadget/s3c-hsotg.c index 9875d9c..db797f2 100644 --- a/drivers/usb/gadget/s3c-hsotg.c +++ b/drivers/usb/gadget/s3c-hsotg.c @@ -36,8 +36,6 @@ #include #include -#include - #include "s3c-hsotg.h" static const char * const s3c_hsotg_supply_names[] = { -- 1.8.4 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH v7 4/9] usb: gadget: s3c-hsotg: add snps,dwc2 compatible string
Enable support for the dwc2 binding. Signed-off-by: Matt Porter --- drivers/usb/gadget/s3c-hsotg.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/usb/gadget/s3c-hsotg.c b/drivers/usb/gadget/s3c-hsotg.c index db797f2..cbfbf41 100644 --- a/drivers/usb/gadget/s3c-hsotg.c +++ b/drivers/usb/gadget/s3c-hsotg.c @@ -3726,6 +3726,7 @@ static int s3c_hsotg_remove(struct platform_device *pdev) #ifdef CONFIG_OF static const struct of_device_id s3c_hsotg_of_ids[] = { { .compatible = "samsung,s3c6400-hsotg", }, + { .compatible = "snps,dwc2", }, { /* sentinel */ } }; MODULE_DEVICE_TABLE(of, s3c_hsotg_of_ids); -- 1.8.4 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH v7 1/9] phy: add phy_get_bus_width()/phy_set_bus_width() calls
This adds a pair of APIs that allows the generic PHY subsystem to provide information on the PHY bus width. The PHY provider driver may use phy_set_bus_width() to set the bus width that the PHY supports. The controller driver may then use phy_get_bus_width() to fetch the PHY bus width in order to properly configure the controller. Signed-off-by: Matt Porter Acked-by: Kishon Vijay Abraham I --- include/linux/phy/phy.h | 28 1 file changed, 28 insertions(+) diff --git a/include/linux/phy/phy.h b/include/linux/phy/phy.h index 6d72269..e273e5a 100644 --- a/include/linux/phy/phy.h +++ b/include/linux/phy/phy.h @@ -38,6 +38,14 @@ struct phy_ops { }; /** + * struct phy_attrs - represents phy attributes + * @bus_width: Data path width implemented by PHY + */ +struct phy_attrs { + u32 bus_width; +}; + +/** * struct phy - represents the phy device * @dev: phy device * @id: id of the phy device @@ -46,6 +54,7 @@ struct phy_ops { * @mutex: mutex to protect phy_ops * @init_count: used to protect when the PHY is used by multiple consumers * @power_count: used to protect when the PHY is used by multiple consumers + * @phy_attrs: used to specify PHY specific attributes */ struct phy { struct device dev; @@ -55,6 +64,7 @@ struct phy { struct mutexmutex; int init_count; int power_count; + struct phy_attrsattrs; }; /** @@ -127,6 +137,14 @@ int phy_init(struct phy *phy); int phy_exit(struct phy *phy); int phy_power_on(struct phy *phy); int phy_power_off(struct phy *phy); +static inline int phy_get_bus_width(struct phy *phy) +{ + return phy->attrs.bus_width; +} +static inline void phy_set_bus_width(struct phy *phy, int bus_width) +{ + phy->attrs.bus_width = bus_width; +} struct phy *phy_get(struct device *dev, const char *string); struct phy *devm_phy_get(struct device *dev, const char *string); void phy_put(struct phy *phy); @@ -199,6 +217,16 @@ static inline int phy_power_off(struct phy *phy) return -ENOSYS; } +static inline int phy_get_bus_width(struct phy *phy) +{ + return -ENOSYS; +} + +static inline void phy_set_bus_width(struct phy *phy, int bus_width) +{ + return; +} + static inline struct phy *phy_get(struct device *dev, const char *string) { return ERR_PTR(-ENOSYS); -- 1.8.4 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH v7 2/9] staging: dwc2: update DT binding to add generic clock/phy properties
dwc2/s3c-hsotg require a single clock to be specified and optionally a generic phy. On the s3c-hsotg driver old style USB phy support is present as a fallback so the generic phy properties are optional. Signed-off-by: Matt Porter Acked-by: Kishon Vijay Abraham I --- Documentation/devicetree/bindings/staging/dwc2.txt | 12 1 file changed, 12 insertions(+) diff --git a/Documentation/devicetree/bindings/staging/dwc2.txt b/Documentation/devicetree/bindings/staging/dwc2.txt index 1a1b7cf..a1753ed 100644 --- a/Documentation/devicetree/bindings/staging/dwc2.txt +++ b/Documentation/devicetree/bindings/staging/dwc2.txt @@ -5,6 +5,14 @@ Required properties: - compatible : "snps,dwc2" - reg : Should contain 1 register range (address and length) - interrupts : Should contain 1 interrupt +- clocks: clock provider specifier +- clock-names: shall be "otg" +Refer to clk/clock-bindings.txt for generic clock consumer properties + +Optional properties: +- phys: phy provider specifier +- phy-names: shall be "device" +Refer to phy/phy-bindings.txt for generic phy consumer properties Example: @@ -12,4 +20,8 @@ Example: compatible = "ralink,rt3050-usb, snps,dwc2"; reg = <0x101c 4>; interrupts = <18>; + clocks = <_otg_ahb_clk>; + clock-names = "otg"; + phys = <>; + phy-names = "usb2-phy"; }; -- 1.8.4 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH v7 5/9] usb: gadget: s3c-hsotg: enable generic phy support
Adds support for the generic PHY subsystem. Generic PHY support is probed and then the driver falls back to checking for an old style USB PHY and pdata if not found. Signed-off-by: Matt Porter --- drivers/usb/gadget/s3c-hsotg.c | 55 ++ 1 file changed, 39 insertions(+), 16 deletions(-) diff --git a/drivers/usb/gadget/s3c-hsotg.c b/drivers/usb/gadget/s3c-hsotg.c index cbfbf41..8f9bcdb 100644 --- a/drivers/usb/gadget/s3c-hsotg.c +++ b/drivers/usb/gadget/s3c-hsotg.c @@ -30,6 +30,8 @@ #include #include #include +#include +#include #include #include @@ -138,6 +140,7 @@ struct s3c_hsotg_ep { * @dev: The parent device supplied to the probe function * @driver: USB gadget driver * @phy: The otg phy transceiver structure for phy control. + * @uphy: The otg phy transceiver structure for old USB phy control. * @plat: The platform specific configuration data. This can be removed once * all SoCs support usb transceiver. * @regs: The memory area mapped for accessing registers. @@ -159,7 +162,8 @@ struct s3c_hsotg_ep { struct s3c_hsotg { struct device*dev; struct usb_gadget_driver *driver; - struct usb_phy *phy; + struct phy *phy; + struct usb_phy *uphy; struct s3c_hsotg_plat*plat; spinlock_t lock; @@ -2901,8 +2905,11 @@ static void s3c_hsotg_phy_enable(struct s3c_hsotg *hsotg) dev_dbg(hsotg->dev, "pdev 0x%p\n", pdev); - if (hsotg->phy) - usb_phy_init(hsotg->phy); + if (hsotg->phy) { + phy_init(hsotg->phy); + phy_power_on(hsotg->phy); + } else if (hsotg->uphy) + usb_phy_init(hsotg->uphy); else if (hsotg->plat->phy_init) hsotg->plat->phy_init(pdev, hsotg->plat->phy_type); } @@ -2918,8 +2925,11 @@ static void s3c_hsotg_phy_disable(struct s3c_hsotg *hsotg) { struct platform_device *pdev = to_platform_device(hsotg->dev); - if (hsotg->phy) - usb_phy_shutdown(hsotg->phy); + if (hsotg->phy) { + phy_power_off(hsotg->phy); + phy_exit(hsotg->phy); + } else if (hsotg->uphy) + usb_phy_shutdown(hsotg->uphy); else if (hsotg->plat->phy_exit) hsotg->plat->phy_exit(pdev, hsotg->plat->phy_type); } @@ -3526,7 +3536,8 @@ static void s3c_hsotg_delete_debug(struct s3c_hsotg *hsotg) static int s3c_hsotg_probe(struct platform_device *pdev) { struct s3c_hsotg_plat *plat = dev_get_platdata(>dev); - struct usb_phy *phy; + struct phy *phy; + struct usb_phy *uphy; struct device *dev = >dev; struct s3c_hsotg_ep *eps; struct s3c_hsotg *hsotg; @@ -3541,19 +3552,26 @@ static int s3c_hsotg_probe(struct platform_device *pdev) return -ENOMEM; } - phy = devm_usb_get_phy(dev, USB_PHY_TYPE_USB2); + /* +* Attempt to find a generic PHY, then look for an old style +* USB PHY, finally fall back to pdata +*/ + phy = devm_phy_get(>dev, "usb2-phy"); if (IS_ERR(phy)) { - /* Fallback for pdata */ - plat = dev_get_platdata(>dev); - if (!plat) { - dev_err(>dev, "no platform data or transceiver defined\n"); - return -EPROBE_DEFER; - } else { + uphy = devm_usb_get_phy(dev, USB_PHY_TYPE_USB2); + if (IS_ERR(uphy)) { + /* Fallback for pdata */ + plat = dev_get_platdata(>dev); + if (!plat) { + dev_err(>dev, + "no platform data or transceiver defined\n"); + return -EPROBE_DEFER; + } hsotg->plat = plat; - } - } else { + } else + hsotg->uphy = uphy; + } else hsotg->phy = phy; - } hsotg->dev = dev; @@ -3620,6 +3638,9 @@ static int s3c_hsotg_probe(struct platform_device *pdev) goto err_supplies; } + if (hsotg->phy) + phy_init(hsotg->phy); + /* usb phy enable */ s3c_hsotg_phy_enable(hsotg); @@ -3713,6 +3734,8 @@ static int s3c_hsotg_remove(struct platform_device *pdev) } s3c_hsotg_phy_disable(hsotg); + if (hsotg->phy) + phy_exit(hsotg->phy); clk_disable_unprepare(hsotg->clk); return 0; -- 1.8.4 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH v7 8/9] phy: add Broadcom Kona USB2 PHY driver
Add a driver for the internal Broadcom Kona USB 2.0 PHY found on the BCM281xx family of SoCs. Signed-off-by: Matt Porter --- drivers/phy/Kconfig | 6 ++ drivers/phy/Makefile| 1 + drivers/phy/phy-bcm-kona-usb2.c | 158 3 files changed, 165 insertions(+) create mode 100644 drivers/phy/phy-bcm-kona-usb2.c diff --git a/drivers/phy/Kconfig b/drivers/phy/Kconfig index a344f3d..2e87fa8 100644 --- a/drivers/phy/Kconfig +++ b/drivers/phy/Kconfig @@ -51,4 +51,10 @@ config PHY_EXYNOS_DP_VIDEO help Support for Display Port PHY found on Samsung EXYNOS SoCs. +config BCM_KONA_USB2_PHY + tristate "Broadcom Kona USB2 PHY Driver" + depends on GENERIC_PHY + help + Enable this to support the Broadcom Kona USB 2.0 PHY. + endmenu diff --git a/drivers/phy/Makefile b/drivers/phy/Makefile index d0caae9..c447f1a 100644 --- a/drivers/phy/Makefile +++ b/drivers/phy/Makefile @@ -3,6 +3,7 @@ # obj-$(CONFIG_GENERIC_PHY) += phy-core.o +obj-$(CONFIG_BCM_KONA_USB2_PHY)+= phy-bcm-kona-usb2.o obj-$(CONFIG_PHY_EXYNOS_DP_VIDEO) += phy-exynos-dp-video.o obj-$(CONFIG_PHY_EXYNOS_MIPI_VIDEO)+= phy-exynos-mipi-video.o obj-$(CONFIG_OMAP_USB2)+= phy-omap-usb2.o diff --git a/drivers/phy/phy-bcm-kona-usb2.c b/drivers/phy/phy-bcm-kona-usb2.c new file mode 100644 index 000..0046781 --- /dev/null +++ b/drivers/phy/phy-bcm-kona-usb2.c @@ -0,0 +1,158 @@ +/* + * phy-bcm-kona-usb2.c - Broadcom Kona USB2 Phy Driver + * + * Copyright (C) 2013 Linaro Limited + * Matt Porter + * + * This software is licensed under the terms of the GNU General Public + * License version 2, as published by the Free Software Foundation, and + * may be copied, distributed, and modified under those terms. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + */ + +#include +#include +#include +#include +#include +#include +#include +#include + +#define OTGCTL (0) +#define OTGCTL_OTGSTAT2BIT(31) +#define OTGCTL_OTGSTAT1BIT(30) +#define OTGCTL_PRST_N_SW BIT(11) +#define OTGCTL_HRESET_NBIT(10) +#define OTGCTL_UTMI_LINE_STATE1BIT(9) +#define OTGCTL_UTMI_LINE_STATE0BIT(8) + +#define P1CTL (8) +#define P1CTL_SOFT_RESET BIT(1) +#define P1CTL_NON_DRIVING BIT(0) + +struct bcm_kona_usb { + void __iomem *regs; +}; + +static void bcm_kona_usb_phy_power(struct bcm_kona_usb *phy, int on) +{ + u32 val; + + val = readl(phy->regs + OTGCTL); + if (on) { + /* Configure and power PHY */ + val &= ~(OTGCTL_OTGSTAT2 | OTGCTL_OTGSTAT1 | +OTGCTL_UTMI_LINE_STATE1 | OTGCTL_UTMI_LINE_STATE0); + val |= OTGCTL_PRST_N_SW | OTGCTL_HRESET_N; + } else { + val &= ~(OTGCTL_PRST_N_SW | OTGCTL_HRESET_N); + } + writel(val, phy->regs + OTGCTL); +} + +static int bcm_kona_usb_phy_init(struct phy *gphy) +{ + struct bcm_kona_usb *phy = phy_get_drvdata(gphy); + u32 val; + + /* Soft reset PHY */ + val = readl(phy->regs + P1CTL); + val &= ~P1CTL_NON_DRIVING; + val |= P1CTL_SOFT_RESET; + writel(val, phy->regs + P1CTL); + writel(val & ~P1CTL_SOFT_RESET, phy->regs + P1CTL); + /* Reset needs to be asserted for 2ms */ + mdelay(2); + writel(val | P1CTL_SOFT_RESET, phy->regs + P1CTL); + + return 0; +} + +static int bcm_kona_usb_phy_power_on(struct phy *gphy) +{ + struct bcm_kona_usb *phy = phy_get_drvdata(gphy); + + bcm_kona_usb_phy_power(phy, 1); + + return 0; +} + +static int bcm_kona_usb_phy_power_off(struct phy *gphy) +{ + struct bcm_kona_usb *phy = phy_get_drvdata(gphy); + + bcm_kona_usb_phy_power(phy, 0); + + return 0; +} + +static struct phy_ops ops = { + .init = bcm_kona_usb_phy_init, + .power_on = bcm_kona_usb_phy_power_on, + .power_off = bcm_kona_usb_phy_power_off, + .owner = THIS_MODULE, +}; + +static int bcm_kona_usb2_probe(struct platform_device *pdev) +{ + struct device *dev = >dev; + struct bcm_kona_usb *phy; + struct resource *res; + struct phy *gphy; + struct phy_provider *phy_provider; + + phy = devm_kzalloc(dev, sizeof(*phy), GFP_KERNEL); + if (!phy) + return -ENOMEM; + + res = platform_get_resource(pdev, IORESOURCE_MEM, 0); + phy->regs = devm_ioremap_resource(>dev, res); + if (IS_ERR(phy->regs)) + return PTR_ERR(phy->regs); + + platform_set_drvdata(pdev, phy);
[PATCH v7 0/9] USB Device Controller support for BCM281xx
Changes since v6: - Drop dependency on the Exynos generic phy conversion series - Bring back original patch that converts s3c-hsotg to use the generic phy layer with a fall back to the old usb style phy support. Changes since v5: - tweak s3c-hsotg Kconfig help message to be more generic Changes since v4: - phy_set/get_bus_width now use an int for bus_width Changes since v3: - Rebased on 3.13-rc3 - Move struct phy bus_width attribute back into struct phy_attrs - Fix build issue on !GENERIC_PHY - Update dwc2 binding to reflect optional phy properties - Rename bcm-kona-phy.txt binding to bcm-phy.txt - Reorder bcm kona phy includes and use bitops - phy-names changed to "usb2-phy" to match updated s3c-hsotg generic phy-ification series Changes since v2: - Rebased on 3.13-rc1 - Fix braces in phy_get_bus_width()/phy_set_bus_width() - Drop generic phy conversion to use the same support from the Exynos generic phy conversion series - Modify dts support to match the "device" phy name required in the v3 Exynos generic phy conversion - Add s3c-hsotg phy_init/phy_exit support - Fix typo on reg property in kona phy binding - Replace phy driver reg struct with offset defines - Move phy soft reset to phy driver init - Fix dts node names to match ePAPR conventions Changes since v1: - Convert USB phy driver to generic phy subsystem - Add phy bus width apis - Drop dwc2 phy bus width DT property in favor of querying the phy provider for bus width - Add generic phy/clock properties to dwc2 DT binding - Add generic phy subsystem support to s3c-hsotg with the existing usb phy and pdata phy methods as a fallback - Split bindings out to separate patches to match the latest DT binding review guidelines This series adds USB Device Controller support for the Broadcom BCM281xx family of parts. BCM281xx contains a DWC2 OTG block and s3c-hsotg is used to support UDC operation. Part 1 adds phy bus width support to the generic phy subsystem Parts 2-6 allows s3c-hsotg to build on non-Samsung platforms, supports the dwc2 binding, adds generic phy layer support, and supports fetching phy bus width using the generic phy layer. Parts 7-8 add a generic phy binding and driver for the BCM Kona USB PHY. Part 9 adds the DT nodes to enable UDC support on both BCM281xx boards in the kernel. This series depends on: - "Update Kona drivers to use clocks" v4 series https://lkml.org/lkml/2013/12/5/508 (relevant portion now queued for 3.14) Matt Porter (9): phy: add phy_get_bus_width()/phy_set_bus_width() calls staging: dwc2: update DT binding to add generic clock/phy properties usb: gadget: s3c-hsotg: enable build for other platforms usb: gadget: s3c-hsotg: add snps,dwc2 compatible string usb: gadget: s3c-hsotg: enable generic phy support usb: gadget: s3c-hsotg: get phy bus width from phy subsystem phy: add Broadcom Kona USB2 PHY DT binding phy: add Broadcom Kona USB2 PHY driver ARM: dts: add usb udc support to bcm281xx Documentation/devicetree/bindings/phy/bcm-phy.txt | 15 ++ Documentation/devicetree/bindings/staging/dwc2.txt | 12 ++ arch/arm/boot/dts/bcm11351-brt.dts | 6 + arch/arm/boot/dts/bcm11351.dtsi| 18 +++ arch/arm/boot/dts/bcm28155-ap.dts | 8 ++ drivers/phy/Kconfig| 6 + drivers/phy/Makefile | 1 + drivers/phy/phy-bcm-kona-usb2.c| 158 + drivers/usb/gadget/Kconfig | 7 +- drivers/usb/gadget/s3c-hsotg.c | 72 +++--- drivers/usb/gadget/s3c-hsotg.h | 1 + include/linux/phy/phy.h| 28 12 files changed, 309 insertions(+), 23 deletions(-) create mode 100644 Documentation/devicetree/bindings/phy/bcm-phy.txt create mode 100644 drivers/phy/phy-bcm-kona-usb2.c -- 1.8.4 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH v7 6/9] usb: gadget: s3c-hsotg: get phy bus width from phy subsystem
Adds support for querying the phy bus width from the generic phy subsystem. Configure UTMI bus width in GUSBCFG based on this value. Signed-off-by: Matt Porter Acked-by: Kishon Vijay Abraham I --- drivers/usb/gadget/s3c-hsotg.c | 14 +- drivers/usb/gadget/s3c-hsotg.h | 1 + 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/drivers/usb/gadget/s3c-hsotg.c b/drivers/usb/gadget/s3c-hsotg.c index 8f9bcdb..93ba8b6 100644 --- a/drivers/usb/gadget/s3c-hsotg.c +++ b/drivers/usb/gadget/s3c-hsotg.c @@ -146,6 +146,7 @@ struct s3c_hsotg_ep { * @regs: The memory area mapped for accessing registers. * @irq: The IRQ number we are using * @supplies: Definition of USB power supplies + * @phyif: PHY interface width * @dedicated_fifos: Set if the hardware has dedicated IN-EP fifos. * @num_of_eps: Number of available EPs (excluding EP0) * @debug_root: root directrory for debugfs. @@ -174,6 +175,7 @@ struct s3c_hsotg { struct regulator_bulk_data supplies[ARRAY_SIZE(s3c_hsotg_supply_names)]; + u32 phyif; unsigned intdedicated_fifos:1; unsigned char num_of_eps; @@ -2279,7 +2281,7 @@ static void s3c_hsotg_core_init(struct s3c_hsotg *hsotg) */ /* set the PLL on, remove the HNP/SRP and set the PHY */ - writel(GUSBCFG_PHYIf16 | GUSBCFG_TOutCal(7) | + writel(hsotg->phyif | GUSBCFG_TOutCal(7) | (0x5 << 10), hsotg->regs + GUSBCFG); s3c_hsotg_init_fifo(hsotg); @@ -3638,6 +3640,16 @@ static int s3c_hsotg_probe(struct platform_device *pdev) goto err_supplies; } + /* Set default UTMI width */ + hsotg->phyif = GUSBCFG_PHYIf16; + + /* +* If using the generic PHY framework, check if the PHY bus +* width is 8-bit and set the phyif appropriately. +*/ + if (hsotg->phy && (phy_get_bus_width(phy) == 8)) + hsotg->phyif = GUSBCFG_PHYIf8; + if (hsotg->phy) phy_init(hsotg->phy); diff --git a/drivers/usb/gadget/s3c-hsotg.h b/drivers/usb/gadget/s3c-hsotg.h index d650b12..85f549f 100644 --- a/drivers/usb/gadget/s3c-hsotg.h +++ b/drivers/usb/gadget/s3c-hsotg.h @@ -55,6 +55,7 @@ #define GUSBCFG_HNPCap (1 << 9) #define GUSBCFG_SRPCap (1 << 8) #define GUSBCFG_PHYIf16(1 << 3) +#define GUSBCFG_PHYIf8 (0 << 3) #define GUSBCFG_TOutCal_MASK (0x7 << 0) #define GUSBCFG_TOutCal_SHIFT (0) #define GUSBCFG_TOutCal_LIMIT (0x7) -- 1.8.4 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH v4 5/9] usb: s3c-hsotg: Use the new Exynos USB phy driver with the generic phy framework
On Tue, Dec 17, 2013 at 10:41:56AM +0100, Kamil Debski wrote: > Hi Matt, > > I am afraid it is not possible. This patch cannot go in without the > new phy driver. It would break Exynos USB functionality. This > is because it changes s3c-hsotg to use the new phy driver. To clarify, I'm proposing that I would bring back the original patch from my earlier postings on the bcm281xx series that preserves the old style usb phy support as a fallback along with the pdata path. > I am working on an updated patch series addressing all the comments. > time permitting I want to post an alternative version - integrating > as much as possible in a single file. This way it would be possible > to have a hands-on comparison of the two approaches we were > discussing with Kishon. > > I estimate that I post it this week. Ok, thanks. In the meantime I'll update my original version of this patch in case your work can't be taken in this window. -Matt > > -Original Message- > > From: Matt Porter [mailto:mpor...@linaro.org] > > Sent: Monday, December 16, 2013 10:40 PM > > To: Kamil Debski > > Cc: linux-kernel@vger.kernel.org; linux-samsung-...@vger.kernel.org; > > linux-...@vger.kernel.org; devicet...@vger.kernel.org; > > kyungmin.p...@samsung.com; kis...@ti.com; t.f...@samsung.com; > > s.nawro...@samsung.com; m.szyprow...@samsung.com; > > gautam.vi...@samsung.com; mat.krawc...@gmail.com; > > yulgon@samsung.com; p.pan...@samsung.com; av.tikhomi...@samsung.com; > > jg1@samsung.com; ga...@codeaurora.org; Felipe Balbi > > Subject: Re: [PATCH v4 5/9] usb: s3c-hsotg: Use the new Exynos USB phy > > driver with the generic phy framework > > > > On Thu, Dec 05, 2013 at 01:29:35PM +0100, Kamil Debski wrote: > > > Change the used phy driver to the new Exynos USB phy driver that uses > > > the generic phy framework. > > > > > > Signed-off-by: Kamil Debski > > > Signed-off-by: Kyungmin Park > > > --- > > > .../devicetree/bindings/usb/samsung-hsotg.txt |4 > > > drivers/usb/gadget/s3c-hsotg.c | 11 ++ > > - > > > 2 files changed, 10 insertions(+), 5 deletions(-) > > > > Kamil, > > > > Can we separate this patch out of this series? My bcm281xx series is > > ready to go except for this dependency. Felipe has noted that there's > > only a week until he locks his tree down for 3.14 [1]. I'm willing to > > update this versus the comment Kishon made on fixing the example if you > > don't have time before then. Let me know. > > > > [1] https://lkml.org/lkml/2013/12/16/555 > > > > Thanks, > > Matt > > > > > diff --git a/Documentation/devicetree/bindings/usb/samsung-hsotg.txt > > > b/Documentation/devicetree/bindings/usb/samsung-hsotg.txt > > > index b83d428..9340d06 100644 > > > --- a/Documentation/devicetree/bindings/usb/samsung-hsotg.txt > > > +++ b/Documentation/devicetree/bindings/usb/samsung-hsotg.txt > > > @@ -24,6 +24,8 @@ Required properties: > > > - first entry: must be "otg" > > > - vusb_d-supply: phandle to voltage regulator of digital section, > > > - vusb_a-supply: phandle to voltage regulator of analog section. > > > +- phys: from general PHY binding: phandle to the PHY device > > > +- phy-names: from general PHY binding: should be "usb2-phy" > > > > > > Example > > > - > > > @@ -36,5 +38,7 @@ Example > > > clock-names = "otg"; > > > vusb_d-supply = <_reg>; > > > vusb_a-supply = <_reg>; > > > + phys = < 0>; > > > + phy-names = "device"; > > > }; > > > > > > diff --git a/drivers/usb/gadget/s3c-hsotg.c > > > b/drivers/usb/gadget/s3c-hsotg.c index eccb147..db096fd 100644 > > > --- a/drivers/usb/gadget/s3c-hsotg.c > > > +++ b/drivers/usb/gadget/s3c-hsotg.c > > > @@ -31,6 +31,7 @@ > > > #include #include > > > #include > > > +#include > > > > > > #include > > > #include > > > @@ -162,7 +163,7 @@ struct s3c_hsotg_ep { struct s3c_hsotg { > > > struct device*dev; > > > struct usb_gadget_driver *driver; > > > - struct usb_phy *phy; > > > + struct phy *phy; > > > struct s3c_hsotg_plat*plat; > > > > > > spinlock_t lock; > > > @@ -2905,7 +2906,7 @@ static void s3c_hsotg_phy_enable(struct > > s3c_hsotg *hsotg) >
Re: [PATCH v4 5/9] usb: s3c-hsotg: Use the new Exynos USB phy driver with the generic phy framework
On Tue, Dec 17, 2013 at 10:41:56AM +0100, Kamil Debski wrote: Hi Matt, I am afraid it is not possible. This patch cannot go in without the new phy driver. It would break Exynos USB functionality. This is because it changes s3c-hsotg to use the new phy driver. To clarify, I'm proposing that I would bring back the original patch from my earlier postings on the bcm281xx series that preserves the old style usb phy support as a fallback along with the pdata path. I am working on an updated patch series addressing all the comments. time permitting I want to post an alternative version - integrating as much as possible in a single file. This way it would be possible to have a hands-on comparison of the two approaches we were discussing with Kishon. I estimate that I post it this week. Ok, thanks. In the meantime I'll update my original version of this patch in case your work can't be taken in this window. -Matt -Original Message- From: Matt Porter [mailto:mpor...@linaro.org] Sent: Monday, December 16, 2013 10:40 PM To: Kamil Debski Cc: linux-kernel@vger.kernel.org; linux-samsung-...@vger.kernel.org; linux-...@vger.kernel.org; devicet...@vger.kernel.org; kyungmin.p...@samsung.com; kis...@ti.com; t.f...@samsung.com; s.nawro...@samsung.com; m.szyprow...@samsung.com; gautam.vi...@samsung.com; mat.krawc...@gmail.com; yulgon@samsung.com; p.pan...@samsung.com; av.tikhomi...@samsung.com; jg1@samsung.com; ga...@codeaurora.org; Felipe Balbi Subject: Re: [PATCH v4 5/9] usb: s3c-hsotg: Use the new Exynos USB phy driver with the generic phy framework On Thu, Dec 05, 2013 at 01:29:35PM +0100, Kamil Debski wrote: Change the used phy driver to the new Exynos USB phy driver that uses the generic phy framework. Signed-off-by: Kamil Debski k.deb...@samsung.com Signed-off-by: Kyungmin Park kyungmin.p...@samsung.com --- .../devicetree/bindings/usb/samsung-hsotg.txt |4 drivers/usb/gadget/s3c-hsotg.c | 11 ++ - 2 files changed, 10 insertions(+), 5 deletions(-) Kamil, Can we separate this patch out of this series? My bcm281xx series is ready to go except for this dependency. Felipe has noted that there's only a week until he locks his tree down for 3.14 [1]. I'm willing to update this versus the comment Kishon made on fixing the example if you don't have time before then. Let me know. [1] https://lkml.org/lkml/2013/12/16/555 Thanks, Matt diff --git a/Documentation/devicetree/bindings/usb/samsung-hsotg.txt b/Documentation/devicetree/bindings/usb/samsung-hsotg.txt index b83d428..9340d06 100644 --- a/Documentation/devicetree/bindings/usb/samsung-hsotg.txt +++ b/Documentation/devicetree/bindings/usb/samsung-hsotg.txt @@ -24,6 +24,8 @@ Required properties: - first entry: must be otg - vusb_d-supply: phandle to voltage regulator of digital section, - vusb_a-supply: phandle to voltage regulator of analog section. +- phys: from general PHY binding: phandle to the PHY device +- phy-names: from general PHY binding: should be usb2-phy Example - @@ -36,5 +38,7 @@ Example clock-names = otg; vusb_d-supply = vusb_reg; vusb_a-supply = vusbdac_reg; + phys = usb2phy 0; + phy-names = device; }; diff --git a/drivers/usb/gadget/s3c-hsotg.c b/drivers/usb/gadget/s3c-hsotg.c index eccb147..db096fd 100644 --- a/drivers/usb/gadget/s3c-hsotg.c +++ b/drivers/usb/gadget/s3c-hsotg.c @@ -31,6 +31,7 @@ #include linux/regulator/consumer.h #include linux/of.h #include linux/of_platform.h +#include linux/phy/phy.h #include linux/usb/ch9.h #include linux/usb/gadget.h @@ -162,7 +163,7 @@ struct s3c_hsotg_ep { struct s3c_hsotg { struct device*dev; struct usb_gadget_driver *driver; - struct usb_phy *phy; + struct phy *phy; struct s3c_hsotg_plat*plat; spinlock_t lock; @@ -2905,7 +2906,7 @@ static void s3c_hsotg_phy_enable(struct s3c_hsotg *hsotg) dev_dbg(hsotg-dev, pdev 0x%p\n, pdev); if (hsotg-phy) - usb_phy_init(hsotg-phy); + phy_power_on(hsotg-phy); else if (hsotg-plat-phy_init) hsotg-plat-phy_init(pdev, hsotg-plat-phy_type); } @@ - 2922,7 +2923,7 @@ static void s3c_hsotg_phy_disable(struct s3c_hsotg *hsotg) struct platform_device *pdev = to_platform_device(hsotg-dev); if (hsotg-phy) - usb_phy_shutdown(hsotg-phy); + phy_power_off(hsotg-phy); else if (hsotg-plat-phy_exit) hsotg-plat-phy_exit(pdev, hsotg-plat-phy_type); } @@ - 3529,7 +3530,7 @@ static void s3c_hsotg_delete_debug(struct s3c_hsotg *hsotg) static int s3c_hsotg_probe(struct platform_device *pdev) { struct s3c_hsotg_plat *plat = dev_get_platdata(pdev-dev
[PATCH v7 0/9] USB Device Controller support for BCM281xx
Changes since v6: - Drop dependency on the Exynos generic phy conversion series - Bring back original patch that converts s3c-hsotg to use the generic phy layer with a fall back to the old usb style phy support. Changes since v5: - tweak s3c-hsotg Kconfig help message to be more generic Changes since v4: - phy_set/get_bus_width now use an int for bus_width Changes since v3: - Rebased on 3.13-rc3 - Move struct phy bus_width attribute back into struct phy_attrs - Fix build issue on !GENERIC_PHY - Update dwc2 binding to reflect optional phy properties - Rename bcm-kona-phy.txt binding to bcm-phy.txt - Reorder bcm kona phy includes and use bitops - phy-names changed to usb2-phy to match updated s3c-hsotg generic phy-ification series Changes since v2: - Rebased on 3.13-rc1 - Fix braces in phy_get_bus_width()/phy_set_bus_width() - Drop generic phy conversion to use the same support from the Exynos generic phy conversion series - Modify dts support to match the device phy name required in the v3 Exynos generic phy conversion - Add s3c-hsotg phy_init/phy_exit support - Fix typo on reg property in kona phy binding - Replace phy driver reg struct with offset defines - Move phy soft reset to phy driver init - Fix dts node names to match ePAPR conventions Changes since v1: - Convert USB phy driver to generic phy subsystem - Add phy bus width apis - Drop dwc2 phy bus width DT property in favor of querying the phy provider for bus width - Add generic phy/clock properties to dwc2 DT binding - Add generic phy subsystem support to s3c-hsotg with the existing usb phy and pdata phy methods as a fallback - Split bindings out to separate patches to match the latest DT binding review guidelines This series adds USB Device Controller support for the Broadcom BCM281xx family of parts. BCM281xx contains a DWC2 OTG block and s3c-hsotg is used to support UDC operation. Part 1 adds phy bus width support to the generic phy subsystem Parts 2-6 allows s3c-hsotg to build on non-Samsung platforms, supports the dwc2 binding, adds generic phy layer support, and supports fetching phy bus width using the generic phy layer. Parts 7-8 add a generic phy binding and driver for the BCM Kona USB PHY. Part 9 adds the DT nodes to enable UDC support on both BCM281xx boards in the kernel. This series depends on: - Update Kona drivers to use clocks v4 series https://lkml.org/lkml/2013/12/5/508 (relevant portion now queued for 3.14) Matt Porter (9): phy: add phy_get_bus_width()/phy_set_bus_width() calls staging: dwc2: update DT binding to add generic clock/phy properties usb: gadget: s3c-hsotg: enable build for other platforms usb: gadget: s3c-hsotg: add snps,dwc2 compatible string usb: gadget: s3c-hsotg: enable generic phy support usb: gadget: s3c-hsotg: get phy bus width from phy subsystem phy: add Broadcom Kona USB2 PHY DT binding phy: add Broadcom Kona USB2 PHY driver ARM: dts: add usb udc support to bcm281xx Documentation/devicetree/bindings/phy/bcm-phy.txt | 15 ++ Documentation/devicetree/bindings/staging/dwc2.txt | 12 ++ arch/arm/boot/dts/bcm11351-brt.dts | 6 + arch/arm/boot/dts/bcm11351.dtsi| 18 +++ arch/arm/boot/dts/bcm28155-ap.dts | 8 ++ drivers/phy/Kconfig| 6 + drivers/phy/Makefile | 1 + drivers/phy/phy-bcm-kona-usb2.c| 158 + drivers/usb/gadget/Kconfig | 7 +- drivers/usb/gadget/s3c-hsotg.c | 72 +++--- drivers/usb/gadget/s3c-hsotg.h | 1 + include/linux/phy/phy.h| 28 12 files changed, 309 insertions(+), 23 deletions(-) create mode 100644 Documentation/devicetree/bindings/phy/bcm-phy.txt create mode 100644 drivers/phy/phy-bcm-kona-usb2.c -- 1.8.4 -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH v7 8/9] phy: add Broadcom Kona USB2 PHY driver
Add a driver for the internal Broadcom Kona USB 2.0 PHY found on the BCM281xx family of SoCs. Signed-off-by: Matt Porter mpor...@linaro.org --- drivers/phy/Kconfig | 6 ++ drivers/phy/Makefile| 1 + drivers/phy/phy-bcm-kona-usb2.c | 158 3 files changed, 165 insertions(+) create mode 100644 drivers/phy/phy-bcm-kona-usb2.c diff --git a/drivers/phy/Kconfig b/drivers/phy/Kconfig index a344f3d..2e87fa8 100644 --- a/drivers/phy/Kconfig +++ b/drivers/phy/Kconfig @@ -51,4 +51,10 @@ config PHY_EXYNOS_DP_VIDEO help Support for Display Port PHY found on Samsung EXYNOS SoCs. +config BCM_KONA_USB2_PHY + tristate Broadcom Kona USB2 PHY Driver + depends on GENERIC_PHY + help + Enable this to support the Broadcom Kona USB 2.0 PHY. + endmenu diff --git a/drivers/phy/Makefile b/drivers/phy/Makefile index d0caae9..c447f1a 100644 --- a/drivers/phy/Makefile +++ b/drivers/phy/Makefile @@ -3,6 +3,7 @@ # obj-$(CONFIG_GENERIC_PHY) += phy-core.o +obj-$(CONFIG_BCM_KONA_USB2_PHY)+= phy-bcm-kona-usb2.o obj-$(CONFIG_PHY_EXYNOS_DP_VIDEO) += phy-exynos-dp-video.o obj-$(CONFIG_PHY_EXYNOS_MIPI_VIDEO)+= phy-exynos-mipi-video.o obj-$(CONFIG_OMAP_USB2)+= phy-omap-usb2.o diff --git a/drivers/phy/phy-bcm-kona-usb2.c b/drivers/phy/phy-bcm-kona-usb2.c new file mode 100644 index 000..0046781 --- /dev/null +++ b/drivers/phy/phy-bcm-kona-usb2.c @@ -0,0 +1,158 @@ +/* + * phy-bcm-kona-usb2.c - Broadcom Kona USB2 Phy Driver + * + * Copyright (C) 2013 Linaro Limited + * Matt Porter mpor...@linaro.org + * + * This software is licensed under the terms of the GNU General Public + * License version 2, as published by the Free Software Foundation, and + * may be copied, distributed, and modified under those terms. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + */ + +#include linux/clk.h +#include linux/delay.h +#include linux/err.h +#include linux/io.h +#include linux/module.h +#include linux/of.h +#include linux/phy/phy.h +#include linux/platform_device.h + +#define OTGCTL (0) +#define OTGCTL_OTGSTAT2BIT(31) +#define OTGCTL_OTGSTAT1BIT(30) +#define OTGCTL_PRST_N_SW BIT(11) +#define OTGCTL_HRESET_NBIT(10) +#define OTGCTL_UTMI_LINE_STATE1BIT(9) +#define OTGCTL_UTMI_LINE_STATE0BIT(8) + +#define P1CTL (8) +#define P1CTL_SOFT_RESET BIT(1) +#define P1CTL_NON_DRIVING BIT(0) + +struct bcm_kona_usb { + void __iomem *regs; +}; + +static void bcm_kona_usb_phy_power(struct bcm_kona_usb *phy, int on) +{ + u32 val; + + val = readl(phy-regs + OTGCTL); + if (on) { + /* Configure and power PHY */ + val = ~(OTGCTL_OTGSTAT2 | OTGCTL_OTGSTAT1 | +OTGCTL_UTMI_LINE_STATE1 | OTGCTL_UTMI_LINE_STATE0); + val |= OTGCTL_PRST_N_SW | OTGCTL_HRESET_N; + } else { + val = ~(OTGCTL_PRST_N_SW | OTGCTL_HRESET_N); + } + writel(val, phy-regs + OTGCTL); +} + +static int bcm_kona_usb_phy_init(struct phy *gphy) +{ + struct bcm_kona_usb *phy = phy_get_drvdata(gphy); + u32 val; + + /* Soft reset PHY */ + val = readl(phy-regs + P1CTL); + val = ~P1CTL_NON_DRIVING; + val |= P1CTL_SOFT_RESET; + writel(val, phy-regs + P1CTL); + writel(val ~P1CTL_SOFT_RESET, phy-regs + P1CTL); + /* Reset needs to be asserted for 2ms */ + mdelay(2); + writel(val | P1CTL_SOFT_RESET, phy-regs + P1CTL); + + return 0; +} + +static int bcm_kona_usb_phy_power_on(struct phy *gphy) +{ + struct bcm_kona_usb *phy = phy_get_drvdata(gphy); + + bcm_kona_usb_phy_power(phy, 1); + + return 0; +} + +static int bcm_kona_usb_phy_power_off(struct phy *gphy) +{ + struct bcm_kona_usb *phy = phy_get_drvdata(gphy); + + bcm_kona_usb_phy_power(phy, 0); + + return 0; +} + +static struct phy_ops ops = { + .init = bcm_kona_usb_phy_init, + .power_on = bcm_kona_usb_phy_power_on, + .power_off = bcm_kona_usb_phy_power_off, + .owner = THIS_MODULE, +}; + +static int bcm_kona_usb2_probe(struct platform_device *pdev) +{ + struct device *dev = pdev-dev; + struct bcm_kona_usb *phy; + struct resource *res; + struct phy *gphy; + struct phy_provider *phy_provider; + + phy = devm_kzalloc(dev, sizeof(*phy), GFP_KERNEL); + if (!phy) + return -ENOMEM; + + res = platform_get_resource(pdev, IORESOURCE_MEM, 0); + phy-regs = devm_ioremap_resource(pdev-dev, res); + if (IS_ERR(phy-regs)) + return
[PATCH v7 6/9] usb: gadget: s3c-hsotg: get phy bus width from phy subsystem
Adds support for querying the phy bus width from the generic phy subsystem. Configure UTMI bus width in GUSBCFG based on this value. Signed-off-by: Matt Porter mpor...@linaro.org Acked-by: Kishon Vijay Abraham I kis...@ti.com --- drivers/usb/gadget/s3c-hsotg.c | 14 +- drivers/usb/gadget/s3c-hsotg.h | 1 + 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/drivers/usb/gadget/s3c-hsotg.c b/drivers/usb/gadget/s3c-hsotg.c index 8f9bcdb..93ba8b6 100644 --- a/drivers/usb/gadget/s3c-hsotg.c +++ b/drivers/usb/gadget/s3c-hsotg.c @@ -146,6 +146,7 @@ struct s3c_hsotg_ep { * @regs: The memory area mapped for accessing registers. * @irq: The IRQ number we are using * @supplies: Definition of USB power supplies + * @phyif: PHY interface width * @dedicated_fifos: Set if the hardware has dedicated IN-EP fifos. * @num_of_eps: Number of available EPs (excluding EP0) * @debug_root: root directrory for debugfs. @@ -174,6 +175,7 @@ struct s3c_hsotg { struct regulator_bulk_data supplies[ARRAY_SIZE(s3c_hsotg_supply_names)]; + u32 phyif; unsigned intdedicated_fifos:1; unsigned char num_of_eps; @@ -2279,7 +2281,7 @@ static void s3c_hsotg_core_init(struct s3c_hsotg *hsotg) */ /* set the PLL on, remove the HNP/SRP and set the PHY */ - writel(GUSBCFG_PHYIf16 | GUSBCFG_TOutCal(7) | + writel(hsotg-phyif | GUSBCFG_TOutCal(7) | (0x5 10), hsotg-regs + GUSBCFG); s3c_hsotg_init_fifo(hsotg); @@ -3638,6 +3640,16 @@ static int s3c_hsotg_probe(struct platform_device *pdev) goto err_supplies; } + /* Set default UTMI width */ + hsotg-phyif = GUSBCFG_PHYIf16; + + /* +* If using the generic PHY framework, check if the PHY bus +* width is 8-bit and set the phyif appropriately. +*/ + if (hsotg-phy (phy_get_bus_width(phy) == 8)) + hsotg-phyif = GUSBCFG_PHYIf8; + if (hsotg-phy) phy_init(hsotg-phy); diff --git a/drivers/usb/gadget/s3c-hsotg.h b/drivers/usb/gadget/s3c-hsotg.h index d650b12..85f549f 100644 --- a/drivers/usb/gadget/s3c-hsotg.h +++ b/drivers/usb/gadget/s3c-hsotg.h @@ -55,6 +55,7 @@ #define GUSBCFG_HNPCap (1 9) #define GUSBCFG_SRPCap (1 8) #define GUSBCFG_PHYIf16(1 3) +#define GUSBCFG_PHYIf8 (0 3) #define GUSBCFG_TOutCal_MASK (0x7 0) #define GUSBCFG_TOutCal_SHIFT (0) #define GUSBCFG_TOutCal_LIMIT (0x7) -- 1.8.4 -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH v7 5/9] usb: gadget: s3c-hsotg: enable generic phy support
Adds support for the generic PHY subsystem. Generic PHY support is probed and then the driver falls back to checking for an old style USB PHY and pdata if not found. Signed-off-by: Matt Porter mpor...@linaro.org --- drivers/usb/gadget/s3c-hsotg.c | 55 ++ 1 file changed, 39 insertions(+), 16 deletions(-) diff --git a/drivers/usb/gadget/s3c-hsotg.c b/drivers/usb/gadget/s3c-hsotg.c index cbfbf41..8f9bcdb 100644 --- a/drivers/usb/gadget/s3c-hsotg.c +++ b/drivers/usb/gadget/s3c-hsotg.c @@ -30,6 +30,8 @@ #include linux/clk.h #include linux/regulator/consumer.h #include linux/of_platform.h +#include linux/phy/phy.h +#include linux/usb/phy.h #include linux/usb/ch9.h #include linux/usb/gadget.h @@ -138,6 +140,7 @@ struct s3c_hsotg_ep { * @dev: The parent device supplied to the probe function * @driver: USB gadget driver * @phy: The otg phy transceiver structure for phy control. + * @uphy: The otg phy transceiver structure for old USB phy control. * @plat: The platform specific configuration data. This can be removed once * all SoCs support usb transceiver. * @regs: The memory area mapped for accessing registers. @@ -159,7 +162,8 @@ struct s3c_hsotg_ep { struct s3c_hsotg { struct device*dev; struct usb_gadget_driver *driver; - struct usb_phy *phy; + struct phy *phy; + struct usb_phy *uphy; struct s3c_hsotg_plat*plat; spinlock_t lock; @@ -2901,8 +2905,11 @@ static void s3c_hsotg_phy_enable(struct s3c_hsotg *hsotg) dev_dbg(hsotg-dev, pdev 0x%p\n, pdev); - if (hsotg-phy) - usb_phy_init(hsotg-phy); + if (hsotg-phy) { + phy_init(hsotg-phy); + phy_power_on(hsotg-phy); + } else if (hsotg-uphy) + usb_phy_init(hsotg-uphy); else if (hsotg-plat-phy_init) hsotg-plat-phy_init(pdev, hsotg-plat-phy_type); } @@ -2918,8 +2925,11 @@ static void s3c_hsotg_phy_disable(struct s3c_hsotg *hsotg) { struct platform_device *pdev = to_platform_device(hsotg-dev); - if (hsotg-phy) - usb_phy_shutdown(hsotg-phy); + if (hsotg-phy) { + phy_power_off(hsotg-phy); + phy_exit(hsotg-phy); + } else if (hsotg-uphy) + usb_phy_shutdown(hsotg-uphy); else if (hsotg-plat-phy_exit) hsotg-plat-phy_exit(pdev, hsotg-plat-phy_type); } @@ -3526,7 +3536,8 @@ static void s3c_hsotg_delete_debug(struct s3c_hsotg *hsotg) static int s3c_hsotg_probe(struct platform_device *pdev) { struct s3c_hsotg_plat *plat = dev_get_platdata(pdev-dev); - struct usb_phy *phy; + struct phy *phy; + struct usb_phy *uphy; struct device *dev = pdev-dev; struct s3c_hsotg_ep *eps; struct s3c_hsotg *hsotg; @@ -3541,19 +3552,26 @@ static int s3c_hsotg_probe(struct platform_device *pdev) return -ENOMEM; } - phy = devm_usb_get_phy(dev, USB_PHY_TYPE_USB2); + /* +* Attempt to find a generic PHY, then look for an old style +* USB PHY, finally fall back to pdata +*/ + phy = devm_phy_get(pdev-dev, usb2-phy); if (IS_ERR(phy)) { - /* Fallback for pdata */ - plat = dev_get_platdata(pdev-dev); - if (!plat) { - dev_err(pdev-dev, no platform data or transceiver defined\n); - return -EPROBE_DEFER; - } else { + uphy = devm_usb_get_phy(dev, USB_PHY_TYPE_USB2); + if (IS_ERR(uphy)) { + /* Fallback for pdata */ + plat = dev_get_platdata(pdev-dev); + if (!plat) { + dev_err(pdev-dev, + no platform data or transceiver defined\n); + return -EPROBE_DEFER; + } hsotg-plat = plat; - } - } else { + } else + hsotg-uphy = uphy; + } else hsotg-phy = phy; - } hsotg-dev = dev; @@ -3620,6 +3638,9 @@ static int s3c_hsotg_probe(struct platform_device *pdev) goto err_supplies; } + if (hsotg-phy) + phy_init(hsotg-phy); + /* usb phy enable */ s3c_hsotg_phy_enable(hsotg); @@ -3713,6 +3734,8 @@ static int s3c_hsotg_remove(struct platform_device *pdev) } s3c_hsotg_phy_disable(hsotg); + if (hsotg-phy) + phy_exit(hsotg-phy); clk_disable_unprepare(hsotg-clk); return 0; -- 1.8.4 -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read
[PATCH v7 2/9] staging: dwc2: update DT binding to add generic clock/phy properties
dwc2/s3c-hsotg require a single clock to be specified and optionally a generic phy. On the s3c-hsotg driver old style USB phy support is present as a fallback so the generic phy properties are optional. Signed-off-by: Matt Porter mpor...@linaro.org Acked-by: Kishon Vijay Abraham I kis...@ti.com --- Documentation/devicetree/bindings/staging/dwc2.txt | 12 1 file changed, 12 insertions(+) diff --git a/Documentation/devicetree/bindings/staging/dwc2.txt b/Documentation/devicetree/bindings/staging/dwc2.txt index 1a1b7cf..a1753ed 100644 --- a/Documentation/devicetree/bindings/staging/dwc2.txt +++ b/Documentation/devicetree/bindings/staging/dwc2.txt @@ -5,6 +5,14 @@ Required properties: - compatible : snps,dwc2 - reg : Should contain 1 register range (address and length) - interrupts : Should contain 1 interrupt +- clocks: clock provider specifier +- clock-names: shall be otg +Refer to clk/clock-bindings.txt for generic clock consumer properties + +Optional properties: +- phys: phy provider specifier +- phy-names: shall be device +Refer to phy/phy-bindings.txt for generic phy consumer properties Example: @@ -12,4 +20,8 @@ Example: compatible = ralink,rt3050-usb, snps,dwc2; reg = 0x101c 4; interrupts = 18; + clocks = usb_otg_ahb_clk; + clock-names = otg; + phys = usbphy; + phy-names = usb2-phy; }; -- 1.8.4 -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH v7 1/9] phy: add phy_get_bus_width()/phy_set_bus_width() calls
This adds a pair of APIs that allows the generic PHY subsystem to provide information on the PHY bus width. The PHY provider driver may use phy_set_bus_width() to set the bus width that the PHY supports. The controller driver may then use phy_get_bus_width() to fetch the PHY bus width in order to properly configure the controller. Signed-off-by: Matt Porter mpor...@linaro.org Acked-by: Kishon Vijay Abraham I kis...@ti.com --- include/linux/phy/phy.h | 28 1 file changed, 28 insertions(+) diff --git a/include/linux/phy/phy.h b/include/linux/phy/phy.h index 6d72269..e273e5a 100644 --- a/include/linux/phy/phy.h +++ b/include/linux/phy/phy.h @@ -38,6 +38,14 @@ struct phy_ops { }; /** + * struct phy_attrs - represents phy attributes + * @bus_width: Data path width implemented by PHY + */ +struct phy_attrs { + u32 bus_width; +}; + +/** * struct phy - represents the phy device * @dev: phy device * @id: id of the phy device @@ -46,6 +54,7 @@ struct phy_ops { * @mutex: mutex to protect phy_ops * @init_count: used to protect when the PHY is used by multiple consumers * @power_count: used to protect when the PHY is used by multiple consumers + * @phy_attrs: used to specify PHY specific attributes */ struct phy { struct device dev; @@ -55,6 +64,7 @@ struct phy { struct mutexmutex; int init_count; int power_count; + struct phy_attrsattrs; }; /** @@ -127,6 +137,14 @@ int phy_init(struct phy *phy); int phy_exit(struct phy *phy); int phy_power_on(struct phy *phy); int phy_power_off(struct phy *phy); +static inline int phy_get_bus_width(struct phy *phy) +{ + return phy-attrs.bus_width; +} +static inline void phy_set_bus_width(struct phy *phy, int bus_width) +{ + phy-attrs.bus_width = bus_width; +} struct phy *phy_get(struct device *dev, const char *string); struct phy *devm_phy_get(struct device *dev, const char *string); void phy_put(struct phy *phy); @@ -199,6 +217,16 @@ static inline int phy_power_off(struct phy *phy) return -ENOSYS; } +static inline int phy_get_bus_width(struct phy *phy) +{ + return -ENOSYS; +} + +static inline void phy_set_bus_width(struct phy *phy, int bus_width) +{ + return; +} + static inline struct phy *phy_get(struct device *dev, const char *string) { return ERR_PTR(-ENOSYS); -- 1.8.4 -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH v7 3/9] usb: gadget: s3c-hsotg: enable build for other platforms
Remove unused Samsung-specific machine include and Kconfig dependency on S3C. Signed-off-by: Matt Porter mpor...@linaro.org Reviewed-by: Markus Mayer markus.ma...@linaro.org Reviewed-by: Tim Kryger tim.kry...@linaro.org --- drivers/usb/gadget/Kconfig | 7 +++ drivers/usb/gadget/s3c-hsotg.c | 2 -- 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/drivers/usb/gadget/Kconfig b/drivers/usb/gadget/Kconfig index a91e642..181e760 100644 --- a/drivers/usb/gadget/Kconfig +++ b/drivers/usb/gadget/Kconfig @@ -294,11 +294,10 @@ config USB_PXA27X gadget drivers to also be dynamically linked. config USB_S3C_HSOTG - tristate S3C HS/OtG USB Device controller - depends on S3C_DEV_USB_HSOTG + tristate Designware/S3C HS/OtG USB Device controller help - The Samsung S3C64XX USB2.0 high-speed gadget controller - integrated into the S3C64XX series SoC. + The Designware USB2.0 high-speed gadget controller + integrated into many SoCs. config USB_S3C2410 tristate S3C2410 USB Device Controller diff --git a/drivers/usb/gadget/s3c-hsotg.c b/drivers/usb/gadget/s3c-hsotg.c index 9875d9c..db797f2 100644 --- a/drivers/usb/gadget/s3c-hsotg.c +++ b/drivers/usb/gadget/s3c-hsotg.c @@ -36,8 +36,6 @@ #include linux/usb/phy.h #include linux/platform_data/s3c-hsotg.h -#include mach/map.h - #include s3c-hsotg.h static const char * const s3c_hsotg_supply_names[] = { -- 1.8.4 -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH v7 4/9] usb: gadget: s3c-hsotg: add snps,dwc2 compatible string
Enable support for the dwc2 binding. Signed-off-by: Matt Porter mpor...@linaro.org --- drivers/usb/gadget/s3c-hsotg.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/usb/gadget/s3c-hsotg.c b/drivers/usb/gadget/s3c-hsotg.c index db797f2..cbfbf41 100644 --- a/drivers/usb/gadget/s3c-hsotg.c +++ b/drivers/usb/gadget/s3c-hsotg.c @@ -3726,6 +3726,7 @@ static int s3c_hsotg_remove(struct platform_device *pdev) #ifdef CONFIG_OF static const struct of_device_id s3c_hsotg_of_ids[] = { { .compatible = samsung,s3c6400-hsotg, }, + { .compatible = snps,dwc2, }, { /* sentinel */ } }; MODULE_DEVICE_TABLE(of, s3c_hsotg_of_ids); -- 1.8.4 -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH v7 9/9] ARM: dts: add usb udc support to bcm281xx
Adds USB OTG/PHY and clock support to BCM281xx and enables UDC support on the bcm11351-brt and bcm28155-ap boards. Signed-off-by: Matt Porter mpor...@linaro.org Reviewed-by: Markus Mayer markus.ma...@linaro.org Reviewed-by: Tim Kryger tim.kry...@linaro.org --- arch/arm/boot/dts/bcm11351-brt.dts | 6 ++ arch/arm/boot/dts/bcm11351.dtsi| 18 ++ arch/arm/boot/dts/bcm28155-ap.dts | 8 3 files changed, 32 insertions(+) diff --git a/arch/arm/boot/dts/bcm11351-brt.dts b/arch/arm/boot/dts/bcm11351-brt.dts index 23cd16d..396b704 100644 --- a/arch/arm/boot/dts/bcm11351-brt.dts +++ b/arch/arm/boot/dts/bcm11351-brt.dts @@ -44,5 +44,11 @@ status = okay; }; + usbotg: usb@3f12 { + status = okay; + }; + usbphy: usb-phy@3f13 { + status = okay; + }; }; diff --git a/arch/arm/boot/dts/bcm11351.dtsi b/arch/arm/boot/dts/bcm11351.dtsi index 1246885..0fbb455 100644 --- a/arch/arm/boot/dts/bcm11351.dtsi +++ b/arch/arm/boot/dts/bcm11351.dtsi @@ -243,4 +243,22 @@ #clock-cells = 0; }; }; + + usbotg: usb@3f12 { + compatible = snps,dwc2; + reg = 0x3f12 0x1; + interrupts = GIC_SPI 47 IRQ_TYPE_LEVEL_HIGH; + clocks = usb_otg_ahb_clk; + clock-names = otg; + phys = usbphy; + phy-names = usb2-phy; + status = disabled; + }; + + usbphy: usb-phy@3f13 { + compatible = brcm,kona-usb2-phy; + reg = 0x3f13 0x28; + #phy-cells = 0; + status = disabled; + }; }; diff --git a/arch/arm/boot/dts/bcm28155-ap.dts b/arch/arm/boot/dts/bcm28155-ap.dts index 08e47c2..a3bc436 100644 --- a/arch/arm/boot/dts/bcm28155-ap.dts +++ b/arch/arm/boot/dts/bcm28155-ap.dts @@ -43,4 +43,12 @@ cd-gpios = gpio 14 0; status = okay; }; + + usbotg: usb@3f12 { + status = okay; + }; + + usbphy: usb-phy@3f13 { + status = okay; + }; }; -- 1.8.4 -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH v7 7/9] phy: add Broadcom Kona USB2 PHY DT binding
Add a binding that describes the Broadcom Kona USB2 PHY found on the BCM281xx family of SoCs. Signed-off-by: Matt Porter mpor...@linaro.org Acked-by: Kishon Vijay Abraham I kis...@ti.com --- Documentation/devicetree/bindings/phy/bcm-phy.txt | 15 +++ 1 file changed, 15 insertions(+) create mode 100644 Documentation/devicetree/bindings/phy/bcm-phy.txt diff --git a/Documentation/devicetree/bindings/phy/bcm-phy.txt b/Documentation/devicetree/bindings/phy/bcm-phy.txt new file mode 100644 index 000..3dc8b3d --- /dev/null +++ b/Documentation/devicetree/bindings/phy/bcm-phy.txt @@ -0,0 +1,15 @@ +BROADCOM KONA USB2 PHY + +Required properties: + - compatible: brcm,kona-usb2-phy + - reg: offset and length of the PHY registers + - #phy-cells: must be 0 +Refer to phy/phy-bindings.txt for the generic PHY binding properties + +Example: + + usbphy: usb-phy@3f13 { + compatible = brcm,kona-usb2-phy; + reg = 0x3f13 0x28; + #phy-cells = 0; + }; -- 1.8.4 -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH v4 5/9] usb: s3c-hsotg: Use the new Exynos USB phy driver with the generic phy framework
On Thu, Dec 05, 2013 at 01:29:35PM +0100, Kamil Debski wrote: > Change the used phy driver to the new Exynos USB phy driver that uses the > generic phy framework. > > Signed-off-by: Kamil Debski > Signed-off-by: Kyungmin Park > --- > .../devicetree/bindings/usb/samsung-hsotg.txt |4 > drivers/usb/gadget/s3c-hsotg.c | 11 ++- > 2 files changed, 10 insertions(+), 5 deletions(-) Kamil, Can we separate this patch out of this series? My bcm281xx series is ready to go except for this dependency. Felipe has noted that there's only a week until he locks his tree down for 3.14 [1]. I'm willing to update this versus the comment Kishon made on fixing the example if you don't have time before then. Let me know. [1] https://lkml.org/lkml/2013/12/16/555 Thanks, Matt > diff --git a/Documentation/devicetree/bindings/usb/samsung-hsotg.txt > b/Documentation/devicetree/bindings/usb/samsung-hsotg.txt > index b83d428..9340d06 100644 > --- a/Documentation/devicetree/bindings/usb/samsung-hsotg.txt > +++ b/Documentation/devicetree/bindings/usb/samsung-hsotg.txt > @@ -24,6 +24,8 @@ Required properties: > - first entry: must be "otg" > - vusb_d-supply: phandle to voltage regulator of digital section, > - vusb_a-supply: phandle to voltage regulator of analog section. > +- phys: from general PHY binding: phandle to the PHY device > +- phy-names: from general PHY binding: should be "usb2-phy" > > Example > - > @@ -36,5 +38,7 @@ Example > clock-names = "otg"; > vusb_d-supply = <_reg>; > vusb_a-supply = <_reg>; > + phys = < 0>; > + phy-names = "device"; > }; > > diff --git a/drivers/usb/gadget/s3c-hsotg.c b/drivers/usb/gadget/s3c-hsotg.c > index eccb147..db096fd 100644 > --- a/drivers/usb/gadget/s3c-hsotg.c > +++ b/drivers/usb/gadget/s3c-hsotg.c > @@ -31,6 +31,7 @@ > #include > #include > #include > +#include > > #include > #include > @@ -162,7 +163,7 @@ struct s3c_hsotg_ep { > struct s3c_hsotg { > struct device*dev; > struct usb_gadget_driver *driver; > - struct usb_phy *phy; > + struct phy *phy; > struct s3c_hsotg_plat*plat; > > spinlock_t lock; > @@ -2905,7 +2906,7 @@ static void s3c_hsotg_phy_enable(struct s3c_hsotg > *hsotg) > dev_dbg(hsotg->dev, "pdev 0x%p\n", pdev); > > if (hsotg->phy) > - usb_phy_init(hsotg->phy); > + phy_power_on(hsotg->phy); > else if (hsotg->plat->phy_init) > hsotg->plat->phy_init(pdev, hsotg->plat->phy_type); > } > @@ -2922,7 +2923,7 @@ static void s3c_hsotg_phy_disable(struct s3c_hsotg > *hsotg) > struct platform_device *pdev = to_platform_device(hsotg->dev); > > if (hsotg->phy) > - usb_phy_shutdown(hsotg->phy); > + phy_power_off(hsotg->phy); > else if (hsotg->plat->phy_exit) > hsotg->plat->phy_exit(pdev, hsotg->plat->phy_type); > } > @@ -3529,7 +3530,7 @@ static void s3c_hsotg_delete_debug(struct s3c_hsotg > *hsotg) > static int s3c_hsotg_probe(struct platform_device *pdev) > { > struct s3c_hsotg_plat *plat = dev_get_platdata(>dev); > - struct usb_phy *phy; > + struct phy *phy; > struct device *dev = >dev; > struct s3c_hsotg_ep *eps; > struct s3c_hsotg *hsotg; > @@ -3544,7 +3545,7 @@ static int s3c_hsotg_probe(struct platform_device *pdev) > return -ENOMEM; > } > > - phy = devm_usb_get_phy(dev, USB_PHY_TYPE_USB2); > + phy = devm_phy_get(>dev, "usb2-phy"); > if (IS_ERR(phy)) { > /* Fallback for pdata */ > plat = dev_get_platdata(>dev); > -- > 1.7.9.5 > -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH v6 5/9] usb: gadget: s3c-hsotg: use generic phy_init()/phy_exit() support
On Mon, Dec 16, 2013 at 03:20:01PM -0600, Felipe Balbi wrote: > On Fri, Dec 13, 2013 at 11:51:19AM -0500, Matt Porter wrote: > > If a generic phy is present, call phy_init()/phy_exit(). This supports > > generic phys that must be soft reset before power on. > > > > Signed-off-by: Matt Porter > > Acked-by: Kishon Vijay Abraham I > > --- > > drivers/usb/gadget/s3c-hsotg.c | 5 + > > 1 file changed, 5 insertions(+) > > > > diff --git a/drivers/usb/gadget/s3c-hsotg.c b/drivers/usb/gadget/s3c-hsotg.c > > index 7c5d8bd..e9683c2 100644 > > --- a/drivers/usb/gadget/s3c-hsotg.c > > +++ b/drivers/usb/gadget/s3c-hsotg.c > > @@ -3621,6 +3621,9 @@ static int s3c_hsotg_probe(struct platform_device > > *pdev) > > goto err_supplies; > > } > > > > + if (hsotg->phy) > > + phy_init(hsotg->phy); > > doesn't build. you need to include It depends on https://lkml.org/lkml/2013/12/5/172 which I noted in the cover letter. At this point, I don't know if Kamil's whole series will make it to 3.14 so that patch may have to be taken separately. He has a trivial update to make on the binding example is all for this patch. I was wondering today if we might just want to separate that out now. I originally had a similar patch in my series but his was posted first so I rebased on that. -Matt -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH v6 5/9] usb: gadget: s3c-hsotg: use generic phy_init()/phy_exit() support
On Mon, Dec 16, 2013 at 03:20:01PM -0600, Felipe Balbi wrote: On Fri, Dec 13, 2013 at 11:51:19AM -0500, Matt Porter wrote: If a generic phy is present, call phy_init()/phy_exit(). This supports generic phys that must be soft reset before power on. Signed-off-by: Matt Porter mpor...@linaro.org Acked-by: Kishon Vijay Abraham I kis...@ti.com --- drivers/usb/gadget/s3c-hsotg.c | 5 + 1 file changed, 5 insertions(+) diff --git a/drivers/usb/gadget/s3c-hsotg.c b/drivers/usb/gadget/s3c-hsotg.c index 7c5d8bd..e9683c2 100644 --- a/drivers/usb/gadget/s3c-hsotg.c +++ b/drivers/usb/gadget/s3c-hsotg.c @@ -3621,6 +3621,9 @@ static int s3c_hsotg_probe(struct platform_device *pdev) goto err_supplies; } + if (hsotg-phy) + phy_init(hsotg-phy); doesn't build. you need to include linux/phy/phy.h It depends on https://lkml.org/lkml/2013/12/5/172 which I noted in the cover letter. At this point, I don't know if Kamil's whole series will make it to 3.14 so that patch may have to be taken separately. He has a trivial update to make on the binding example is all for this patch. I was wondering today if we might just want to separate that out now. I originally had a similar patch in my series but his was posted first so I rebased on that. -Matt -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH v4 5/9] usb: s3c-hsotg: Use the new Exynos USB phy driver with the generic phy framework
On Thu, Dec 05, 2013 at 01:29:35PM +0100, Kamil Debski wrote: Change the used phy driver to the new Exynos USB phy driver that uses the generic phy framework. Signed-off-by: Kamil Debski k.deb...@samsung.com Signed-off-by: Kyungmin Park kyungmin.p...@samsung.com --- .../devicetree/bindings/usb/samsung-hsotg.txt |4 drivers/usb/gadget/s3c-hsotg.c | 11 ++- 2 files changed, 10 insertions(+), 5 deletions(-) Kamil, Can we separate this patch out of this series? My bcm281xx series is ready to go except for this dependency. Felipe has noted that there's only a week until he locks his tree down for 3.14 [1]. I'm willing to update this versus the comment Kishon made on fixing the example if you don't have time before then. Let me know. [1] https://lkml.org/lkml/2013/12/16/555 Thanks, Matt diff --git a/Documentation/devicetree/bindings/usb/samsung-hsotg.txt b/Documentation/devicetree/bindings/usb/samsung-hsotg.txt index b83d428..9340d06 100644 --- a/Documentation/devicetree/bindings/usb/samsung-hsotg.txt +++ b/Documentation/devicetree/bindings/usb/samsung-hsotg.txt @@ -24,6 +24,8 @@ Required properties: - first entry: must be otg - vusb_d-supply: phandle to voltage regulator of digital section, - vusb_a-supply: phandle to voltage regulator of analog section. +- phys: from general PHY binding: phandle to the PHY device +- phy-names: from general PHY binding: should be usb2-phy Example - @@ -36,5 +38,7 @@ Example clock-names = otg; vusb_d-supply = vusb_reg; vusb_a-supply = vusbdac_reg; + phys = usb2phy 0; + phy-names = device; }; diff --git a/drivers/usb/gadget/s3c-hsotg.c b/drivers/usb/gadget/s3c-hsotg.c index eccb147..db096fd 100644 --- a/drivers/usb/gadget/s3c-hsotg.c +++ b/drivers/usb/gadget/s3c-hsotg.c @@ -31,6 +31,7 @@ #include linux/regulator/consumer.h #include linux/of.h #include linux/of_platform.h +#include linux/phy/phy.h #include linux/usb/ch9.h #include linux/usb/gadget.h @@ -162,7 +163,7 @@ struct s3c_hsotg_ep { struct s3c_hsotg { struct device*dev; struct usb_gadget_driver *driver; - struct usb_phy *phy; + struct phy *phy; struct s3c_hsotg_plat*plat; spinlock_t lock; @@ -2905,7 +2906,7 @@ static void s3c_hsotg_phy_enable(struct s3c_hsotg *hsotg) dev_dbg(hsotg-dev, pdev 0x%p\n, pdev); if (hsotg-phy) - usb_phy_init(hsotg-phy); + phy_power_on(hsotg-phy); else if (hsotg-plat-phy_init) hsotg-plat-phy_init(pdev, hsotg-plat-phy_type); } @@ -2922,7 +2923,7 @@ static void s3c_hsotg_phy_disable(struct s3c_hsotg *hsotg) struct platform_device *pdev = to_platform_device(hsotg-dev); if (hsotg-phy) - usb_phy_shutdown(hsotg-phy); + phy_power_off(hsotg-phy); else if (hsotg-plat-phy_exit) hsotg-plat-phy_exit(pdev, hsotg-plat-phy_type); } @@ -3529,7 +3530,7 @@ static void s3c_hsotg_delete_debug(struct s3c_hsotg *hsotg) static int s3c_hsotg_probe(struct platform_device *pdev) { struct s3c_hsotg_plat *plat = dev_get_platdata(pdev-dev); - struct usb_phy *phy; + struct phy *phy; struct device *dev = pdev-dev; struct s3c_hsotg_ep *eps; struct s3c_hsotg *hsotg; @@ -3544,7 +3545,7 @@ static int s3c_hsotg_probe(struct platform_device *pdev) return -ENOMEM; } - phy = devm_usb_get_phy(dev, USB_PHY_TYPE_USB2); + phy = devm_phy_get(pdev-dev, usb2-phy); if (IS_ERR(phy)) { /* Fallback for pdata */ plat = dev_get_platdata(pdev-dev); -- 1.7.9.5 -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/