[PATCH v2 0/8] Second patchset for LPC32xx device tree conversion

April 17th, 2012 - 01:10 pm ET by Roland Stigge | Report spam
This is the second patch set for device tree conversion of mach-lpc32xx. It
builds upon and requires the previously posted first set of 8 plus the GPIO
patch.

It touches different subsystems (USB/OHCI, input/touchscreen, iio/adc and
mach-lpc32) to be picked by the respective subsystem maintainer and probably
applied separately. (?)

Signed-off-by: Roland Stigge <stigge@antcom.de>


Applies to v3.4-rc3

Changes since v1:
* Separated out DTS files
* Separated out clock registration update
* Separated out removal of obsolete Kconfig
ohci-nxp.c:
* Separated out cleanup patch from device tree conversion
* Cleanup of resource handling (mem and irq), use devm_request_and_ioremap()
* Fixed controller initialization (bits)
* Use DMA_BIT_MASK()
* Don't remove __devinit
* Removed obsolete gpio.h include
* More consistent bit access symbols
* Removed unused extern declaration ocpi_enable()
* Added error handling on i2c_get_adapter()
* Better USB host and device differentiation, since on LPC32xx, the same
controller can be used as USB device controller
* Whitespace cleanup

Thanks to Thierry Reding for reviewing!

You can also pull from:

git://git.antcom.de/linux-2.6 lpc32xx/dt2

Roland Stigge (8):
ohci-nxp: Driver cleanup
ohci-nxp: Device tree support
ARM: LPC32xx: clock.c update
ARM: LPC32xx: Remove obsolete platform Kconfig
input: Device tree support for LPC32xx touchscreen
iio: lpc32xx-adc: Remove driver conflict due to device tree
ARM: LPC32xx: DTS files for device tree conversion
ARM: LPC32xx: Device tree support

Documentation/devicetree/bindings/arm/lpc32xx-mic.txt | 38 +
Documentation/devicetree/bindings/arm/lpc32xx.txt | 8
Documentation/devicetree/bindings/input/touchscreen/lpc32xx-tsc.txt | 16
Documentation/devicetree/bindings/usb/ohci-nxp.txt | 16
arch/arm/Kconfig | 1
arch/arm/boot/dts/lpc32xx.dtsi | 303 ++++++++++
arch/arm/boot/dts/phy3250.dts | 115 +++
arch/arm/mach-lpc32xx/Kconfig | 26
arch/arm/mach-lpc32xx/clock.c | 77 +-
arch/arm/mach-lpc32xx/common.c | 192
arch/arm/mach-lpc32xx/common.h | 14
arch/arm/mach-lpc32xx/irq.c | 78 +-
arch/arm/mach-lpc32xx/phy3250.c | 146 ++--
drivers/input/touchscreen/lpc32xx_ts.c | 10
drivers/staging/iio/adc/Kconfig | 8
drivers/usb/host/ohci-nxp.c | 55 +
16 files changed, 704 insertions(+), 399 deletions(-)
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
email Follow the discussionReplies 31 repliesReplies Make a reply

Similar topics

Replies

#1 Roland Stigge
April 17th, 2012 - 01:10 pm ET | Report spam
This patch adds device tree support to ohci-nxp.c

Signed-off-by: Roland Stigge



Applies to v3.4-rc3

Changes since v1:
* Separated out cleanup patch

Thanks to Thierry Reding for reviewing!

Documentation/devicetree/bindings/usb/ohci-nxp.txt | 16 ++++++++++++++++
drivers/usb/host/ohci-nxp.c | 10 ++++++++++
2 files changed, 26 insertions(+)

/dev/null
+++ linux-2.6/Documentation/devicetree/bindings/usb/ohci-nxp.txt
@@ -0,0 +1,16 @@
+* OHCI controller, NXP ohci-nxp variant
+
+Required properties:
+- compatible: must be "nxp,ohci-nxp"
+- reg: physical base address of the controller and length of memory mapped
+ region.
+- interrupts: The OHCI interrupt
+
+Example (LPC32xx):
+
+ {
+ compatible = "nxp,ohci-nxp";
+ reg = <0x31020000 0x300>;
+ interrupt-parent = <&mic>;
+ interrupts = <0x3b 0>;
+ };
linux-2.6.orig/drivers/usb/host/ohci-nxp.c
+++ linux-2.6/drivers/usb/host/ohci-nxp.c
@@ -22,6 +22,7 @@
#include <linux/clk.h>
#include <linux/platform_device.h>
#include <linux/i2c.h>
+#include <linux/of.h>

#include <mach/hardware.h>
#include <asm/mach-types.h>
@@ -526,10 +527,19 @@ static int usb_hcd_nxp_remove(struct pla
/* work with hotplug and coldplug */
MODULE_ALIAS("platform:usb-ohci");

+#ifdef CONFIG_OF
+static const struct of_device_id usb_hcd_nxp_match[] = {
+ { .compatible = "nxp,ohci-nxp" },
+ {},
+};
+MODULE_DEVICE_TABLE(of, usb_hcd_nxp_match);
+#endif
+
static struct platform_driver usb_hcd_nxp_driver = {
.driver = {
.name = "usb-ohci",
.owner = THIS_MODULE,
+ .of_match_table = of_match_ptr(usb_hcd_nxp_match),
},
.probe = usb_hcd_nxp_probe,
.remove = usb_hcd_nxp_remove,
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Replies Reply to this message
#2 Roland Stigge
April 17th, 2012 - 01:20 pm ET | Report spam
Cleanup for ohci-nxp.c:

* Cleanup of resource handling (mem and irq), use devm_request_and_ioremap()
* Fixed controller initialization (bits)
* Use DMA_BIT_MASK()
* Don't remove __devinit
* Removed obsolete gpio.h include
* More consistent bit access symbols
* Removed unused extern declaration ocpi_enable()
* Added error handling on i2c_get_adapter()
* Better USB host and device differentiation, since on LPC32xx, the same
controller can be used as USB device controller
* Whitespace cleanup

Signed-off-by: Roland Stigge



Applies to v3.4-rc3

Thanks to Thierry Reding for reviewing!

drivers/usb/host/ohci-nxp.c | 45 ++++++++++++++++++++++++++
1 file changed, 27 insertions(+), 18 deletions(-)

linux-2.6.orig/drivers/usb/host/ohci-nxp.c
+++ linux-2.6/drivers/usb/host/ohci-nxp.c
@@ -29,7 +29,6 @@

#include <mach/platform.h>
#include <mach/irqs.h>
-#include <asm/gpio.h>

#define USB_CONFIG_BASE 0x31020000
#define PWRMAN_BASE 0x40004000
@@ -38,7 +37,9 @@

/* USB_CTRL bit defines */
#define USB_SLAVE_HCLK_EN (1 << 24)
+#define USB_DEV_NEED_CLK_EN (1 << 22)
#define USB_HOST_NEED_CLK_EN (1 << 21)
+#define PAD_CONTROL_LAST_DRIVEN (1 << 19)

#define USB_OTG_CLK_CTRL IO_ADDRESS(USB_CONFIG_BASE + 0xFF4)
#define USB_OTG_CLK_STAT IO_ADDRESS(USB_CONFIG_BASE + 0xFF8)
@@ -117,7 +118,6 @@ static struct i2c_driver isp1301_driver;
static struct i2c_client *isp1301_i2c_client;

extern int usb_disabled(void);
-extern int ocpi_enable(void);

static struct clk *usb_clk;

@@ -220,7 +220,7 @@ static void isp1301_configure_lpc32xx(vo
ISP1301_I2C_INTERRUPT_RISING | ISP1301_I2C_REG_CLEAR_ADDR, ~0);

/* Enable usb_need_clk clock after transceiver is initialized */
- __raw_writel((__raw_readl(USB_CTRL) | (1 << 22)), USB_CTRL);
+ __raw_writel((__raw_readl(USB_CTRL) | USB_HOST_NEED_CLK_EN), USB_CTRL);

printk(KERN_INFO "ISP1301 Vendor ID : 0x%04x",
i2c_smbus_read_word_data(isp1301_i2c_client, 0x00));
@@ -374,9 +374,13 @@ static int __devinit usb_hcd_nxp_probe(s
const struct hc_driver *driver = &ohci_nxp_hc_driver;
struct i2c_adapter *i2c_adap;
struct i2c_board_info i2c_info;
+ struct resource *res;

int ret = 0, irq;

+ pdev->dev.coherent_dma_mask = DMA_BIT_MASK(32);
+ pdev->dev.dma_mask = &pdev->dev.coherent_dma_mask;
+
dev_dbg(&pdev->dev, "%s: " DRIVER_DESC " (nxp)", hcd_name);
if (usb_disabled()) {
err("USB is disabled");
@@ -384,16 +388,8 @@ static int __devinit usb_hcd_nxp_probe(s
goto out;
}

- if (pdev->num_resources != 2
- || pdev->resource[0].flags != IORESOURCE_MEM
- || pdev->resource[1].flags != IORESOURCE_IRQ) {
- err("Invalid resource configuration");
- ret = -ENODEV;
- goto out;
- }
-
/* Enable AHB slave USB clock, needed for further USB clock control */
- __raw_writel(USB_SLAVE_HCLK_EN | (1 << 19), USB_CTRL);
+ __raw_writel(USB_SLAVE_HCLK_EN | PAD_CONTROL_LAST_DRIVEN, USB_CTRL);

ret = i2c_add_driver(&isp1301_driver);
if (ret < 0) {
@@ -401,6 +397,11 @@ static int __devinit usb_hcd_nxp_probe(s
goto out;
}
i2c_adap = i2c_get_adapter(2);
+ if (!i2c_adap) {
+ err("failed on i2c_get_adapter");
+ goto out_i2c_driver;
+ }
+
memset(&i2c_info, 0, sizeof(struct i2c_board_info));
strlcpy(i2c_info.type, "isp1301_nxp", I2C_NAME_SIZE);
isp1301_i2c_client = i2c_new_probed_device(i2c_adap, &i2c_info,
@@ -435,6 +436,7 @@ static int __devinit usb_hcd_nxp_probe(s
}

__raw_writel(__raw_readl(USB_CTRL) | USB_HOST_NEED_CLK_EN, USB_CTRL);
+ __raw_writel(__raw_readl(USB_CTRL) & ~USB_DEV_NEED_CLK_EN, USB_CTRL);

/* Set to enable all needed USB clocks */
__raw_writel(USB_CLOCK_MASK, USB_OTG_CLK_CTRL);
@@ -442,7 +444,7 @@ static int __devinit usb_hcd_nxp_probe(s
while ((__raw_readl(USB_OTG_CLK_STAT) & USB_CLOCK_MASK) ! USB_CLOCK_MASK) ;

- hcd = usb_create_hcd (driver, &pdev->dev, dev_name(&pdev->dev));
+ hcd = usb_create_hcd(driver, &pdev->dev, dev_name(&pdev->dev));
if (!hcd) {
err("Failed to allocate HC buffer");
ret = -ENOMEM;
@@ -452,14 +454,21 @@ static int __devinit usb_hcd_nxp_probe(s
/* Set all USB bits in the Start Enable register */
nxp_set_usb_bits();

- hcd->rsrc_start = pdev->resource[0].start;
- hcd->rsrc_len = pdev->resource[0].end - pdev->resource[0].start + 1;
- if (!request_mem_region(hcd->rsrc_start, hcd->rsrc_len, hcd_name)) {
- dev_dbg(&pdev->dev, "request_mem_region failed");
+ res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
+ if (!res) {
+ dev_err(&pdev->dev, "Failed to get MEM resource");
+ ret = -ENOMEM;
+ goto out4;
+ }
+
+ hcd->regs = devm_request_and_ioremap(&pdev->dev, res);
+ if (!hcd->regs) {
+ err("Failed to devm_request_and_ioremap");
ret = -ENOMEM;
goto out4;
}
- hcd->regs = (void __iomem *)pdev->resource[0].start;
+ hcd->rsrc_start = (u64)(u32)hcd->regs;
+ hcd->rsrc_len = resource_size(res);

irq = platform_get_irq(pdev, 0);
if (irq < 0) {
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Replies Reply to this message
#3 Roland Stigge
April 17th, 2012 - 01:20 pm ET | Report spam
This patch adds device tree support for the LPC32xx SoC's touchscreen
controller.

Signed-off-by: Roland Stigge
Reviewed-by: Thierry Reding



Applies to v3.4-rc3

Documentation/devicetree/bindings/input/touchscreen/lpc32xx-tsc.txt | 16 ++++++++++
drivers/input/touchscreen/lpc32xx_ts.c | 10 ++++++
2 files changed, 26 insertions(+)

/dev/null
+++ linux-2.6/Documentation/devicetree/bindings/input/touchscreen/lpc32xx-tsc.txt
@@ -0,0 +1,16 @@
+* NXP LPC32xx SoC Touchscreen Controller (TSC)
+
+Required properties:
+- compatible: must be "nxp,lpc32xx-tsc"
+- reg: physical base address of the controller and length of memory mapped
+ region.
+- interrupts: The TSC/ADC interrupt
+
+Example:
+
+ {
+ compatible = "nxp,lpc32xx-tsc";
+ reg = <0x40048000 0x1000>;
+ interrupt-parent = <&mic>;
+ interrupts = <39 0>;
+ };
linux-2.6.orig/drivers/input/touchscreen/lpc32xx_ts.c
+++ linux-2.6/drivers/input/touchscreen/lpc32xx_ts.c
@@ -22,6 +22,7 @@
#include <linux/clk.h>
#include <linux/io.h>
#include <linux/slab.h>
+#include <linux/of.h>

/*
* Touchscreen controller register offsets
@@ -383,6 +384,14 @@ static const struct dev_pm_ops lpc32xx_t
#define LPC32XX_TS_PM_OPS NULL
#endif

+#ifdef CONFIG_OF
+static struct of_device_id lpc32xx_tsc_of_match[] = {
+ { .compatible = "nxp,lpc32xx-tsc", },
+ { },
+};
+MODULE_DEVICE_TABLE(of, lpc32xx_tsc_of_match);
+#endif
+
static struct platform_driver lpc32xx_ts_driver = {
.probe = lpc32xx_ts_probe,
.remove = __devexit_p(lpc32xx_ts_remove),
@@ -390,6 +399,7 @@ static struct platform_driver lpc32xx_ts
.name = MOD_NAME,
.owner = THIS_MODULE,
.pm = LPC32XX_TS_PM_OPS,
+ .of_match_table = of_match_ptr(lpc32xx_tsc_of_match),
},
};
module_platform_driver(lpc32xx_ts_driver);
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Replies Reply to this message
#4 Roland Stigge
April 17th, 2012 - 01:20 pm ET | Report spam
Previously, the touchscreen and ADC drivers of the LPC32xx SoC had a Kconfig
conflict declared because they use the same hardware. Upon the introduction of
device tree support in both drivers, the conflict must be removed to enable
the same kernel to support different hardware (configured via the device tree).

Signed-off-by: Roland Stigge



Applies to v3.4-rc3

drivers/staging/iio/adc/Kconfig | 8 +++++
1 file changed, 5 insertions(+), 3 deletions(-)

linux-2.6.orig/drivers/staging/iio/adc/Kconfig
+++ linux-2.6/drivers/staging/iio/adc/Kconfig
@@ -195,11 +195,13 @@ config MAX1363_RING_BUFFER

config LPC32XX_ADC
tristate "NXP LPC32XX ADC"
- depends on ARCH_LPC32XX && !TOUCHSCREEN_LPC32XX
+ depends on ARCH_LPC32XX
help
Say yes here to build support for the integrated ADC inside the
LPC32XX SoC. Note that this feature uses the same hardware as the
- touchscreen driver, so you can only select one of the two drivers
- (lpc32xx_adc or lpc32xx_ts). Provides direct access via sysfs.
+ touchscreen driver, so you should either select only one of the two
+ drivers (lpc32xx_adc or lpc32xx_ts) or, in the OpenFirmware case,
+ activate only one via device tree selection. Provides direct access
+ via sysfs.

endmenu
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Replies Reply to this message
#5 Roland Stigge
April 17th, 2012 - 01:20 pm ET | Report spam
This patch removes two Kconfig options now unused (the network driver is
configured via DT now).

Signed-off-by: Roland Stigge



Applies to v3.4-rc3

linux-2.6.orig/arch/arm/mach-lpc32xx/Kconfig
+++ linux-2.6/arch/arm/mach-lpc32xx/Kconfig
@@ -29,30 +29,4 @@ config ARCH_LPC32XX_UART6_SELECT

endmenu

-menu "LPC32XX chip components"
-
-config ARCH_LPC32XX_IRAM_FOR_NET
- bool "Use IRAM for network buffers"
- default y
- help
- Say Y here to use the LPC internal fast IRAM (i.e. 256KB SRAM) as
- network buffer. If the total combined required buffer sizes is
- larger than the size of IRAM, then SDRAM will be used instead.
-
- This can be enabled safely if the IRAM is not intended for other
- uses.
-
-config ARCH_LPC32XX_MII_SUPPORT
- bool "Check to enable MII support or leave disabled for RMII support"
- help
- Say Y here to enable MII support, or N for RMII support. Regardless of
- which support is selected, the ethernet interface driver needs to be
- selected in the device driver networking section.
-
- The PHY3250 reference board uses RMII, so users of this board should
- say N.
-
-endmenu
-
endif
-

To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Replies Reply to this message
Help Create a new topicNext page Replies Make a reply
Search Make your own search