[PATCH 0/9] Kirkwood DT support For IRQ, SPI, I2C, GPIO
This patch set adds Device Tree support for IRQ, SPI, I2C and GPIO on Orion based drivers, and makes use of these for kirkwood devices. It also adds the ability to boot QNAP TS219 based systems using device tree. The SPI DT patches are from Michael Walle, and have been previously posted. I've addressed the issues raised during the review. The SPI refactor to use the SPI framework was submitted for merge into 3.5, but due to dependency issues, which are now resolved, the patch was not accepted. This patch has been modified to remove two NOP functions, which the SPI framework no longer needs. Andrew Lunn (5): ARM: Kirkwood: Add interrupt controller support for DT boards SPI: Refactor spi-orion to use SPI framework queue. I2C: MV64XXX: Add Device Tree support ARM: Kirkwood: Add DT support for GPIO controllers Kirkwood: Add basic device tree support for QNAP TS219. Michael Walle (4): spi-orion: remove uneeded spi_info spi-orion: add device tree binding ARM: kirkwood: use devicetree for orion-spi ARM: kirkwood: use devicetree for SPI on dreamplug .../devicetree/bindings/arm/mrvl/intc.txt | 20 ++ .../devicetree/bindings/gpio/mrvl-gpio.txt | 25 +++ Documentation/devicetree/bindings/i2c/mrvl-i2c.txt | 35 ++- .../devicetree/bindings/spi/spi-orion.txt |5 + arch/arm/boot/dts/kirkwood-dreamplug.dts | 29 +++ arch/arm/boot/dts/kirkwood-ts219-6281.dts | 21 ++ arch/arm/boot/dts/kirkwood-ts219-6282.dts | 21 ++ arch/arm/boot/dts/kirkwood-ts219.dtsi | 73 +++ arch/arm/boot/dts/kirkwood.dtsi| 51 + arch/arm/mach-kirkwood/Kconfig | 15 ++ arch/arm/mach-kirkwood/Makefile|1 + arch/arm/mach-kirkwood/Makefile.boot |1 + arch/arm/mach-kirkwood/board-dreamplug.c | 41 arch/arm/mach-kirkwood/board-dt.c | 36 +++- arch/arm/mach-kirkwood/board-ts219.c | 86 arch/arm/mach-kirkwood/common.h|5 + arch/arm/mach-kirkwood/irq.c | 20 +- arch/arm/plat-orion/gpio.c | 68 +- arch/arm/plat-orion/include/plat/gpio.h|2 + drivers/i2c/busses/i2c-mv64xxx.c | 38 +++- drivers/spi/spi-orion.c| 223 ++-- 21 files changed, 605 insertions(+), 211 deletions(-) create mode 100644 Documentation/devicetree/bindings/spi/spi-orion.txt create mode 100644 arch/arm/boot/dts/kirkwood-ts219-6281.dts create mode 100644 arch/arm/boot/dts/kirkwood-ts219-6282.dts create mode 100644 arch/arm/boot/dts/kirkwood-ts219.dtsi create mode 100644 arch/arm/mach-kirkwood/board-ts219.c -- 1.7.10 -- To unsubscribe from this list: send the line unsubscribe linux-i2c in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 2/9] SPI: Refactor spi-orion to use SPI framework queue.
Replace the deprecated master-transfer with transfer_one_message() and allow the SPI subsystem handle all the queuing of messages. Signed-off-by: Andrew Lunn and...@lunn.ch Acked-by: Linus Walleij linus.wall...@linaro.org --- drivers/spi/spi-orion.c | 209 ++- 1 file changed, 61 insertions(+), 148 deletions(-) diff --git a/drivers/spi/spi-orion.c b/drivers/spi/spi-orion.c index dfd04e9..547d983 100644 --- a/drivers/spi/spi-orion.c +++ b/drivers/spi/spi-orion.c @@ -35,12 +35,6 @@ #define ORION_SPI_CLK_PRESCALE_MASK0x1F struct orion_spi { - struct work_struct work; - - /* Lock access to transfer list.*/ - spinlock_t lock; - - struct list_headmsg_queue; struct spi_master *master; void __iomem*base; unsigned intmax_speed; @@ -49,8 +43,6 @@ struct orion_spi { struct clk *clk; }; -static struct workqueue_struct *orion_spi_wq; - static inline void __iomem *spi_reg(struct orion_spi *orion_spi, u32 reg) { return orion_spi-base + reg; @@ -277,73 +269,78 @@ out: } -static void orion_spi_work(struct work_struct *work) +static int orion_spi_transfer_one_message(struct spi_master *master, + struct spi_message *m) { - struct orion_spi *orion_spi = - container_of(work, struct orion_spi, work); - - spin_lock_irq(orion_spi-lock); - while (!list_empty(orion_spi-msg_queue)) { - struct spi_message *m; - struct spi_device *spi; - struct spi_transfer *t = NULL; - int par_override = 0; - int status = 0; - int cs_active = 0; - - m = container_of(orion_spi-msg_queue.next, struct spi_message, -queue); + struct orion_spi *orion_spi = spi_master_get_devdata(master); + struct spi_device *spi = m-spi; + struct spi_transfer *t = NULL; + int par_override = 0; + int status = 0; + int cs_active = 0; - list_del_init(m-queue); - spin_unlock_irq(orion_spi-lock); + /* Load defaults */ + status = orion_spi_setup_transfer(spi, NULL); - spi = m-spi; + if (status 0) + goto msg_done; - /* Load defaults */ - status = orion_spi_setup_transfer(spi, NULL); + list_for_each_entry(t, m-transfers, transfer_list) { + /* make sure buffer length is even when working in 16 +* bit mode*/ + if ((t-bits_per_word == 16) (t-len 1)) { + dev_err(spi-dev, + message rejected : + odd data length %d while in 16 bit mode\n, + t-len); + status = -EIO; + goto msg_done; + } - if (status 0) + if (t-speed_hz t-speed_hz orion_spi-min_speed) { + dev_err(spi-dev, + message rejected : + device min speed (%d Hz) exceeds + required transfer speed (%d Hz)\n, + orion_spi-min_speed, t-speed_hz); + status = -EIO; goto msg_done; + } - list_for_each_entry(t, m-transfers, transfer_list) { - if (par_override || t-speed_hz || t-bits_per_word) { - par_override = 1; - status = orion_spi_setup_transfer(spi, t); - if (status 0) - break; - if (!t-speed_hz !t-bits_per_word) - par_override = 0; - } - - if (!cs_active) { - orion_spi_set_cs(orion_spi, 1); - cs_active = 1; - } - - if (t-len) - m-actual_length += - orion_spi_write_read(spi, t); - - if (t-delay_usecs) - udelay(t-delay_usecs); - - if (t-cs_change) { - orion_spi_set_cs(orion_spi, 0); - cs_active = 0; - } + if (par_override || t-speed_hz || t-bits_per_word) { + par_override = 1; + status = orion_spi_setup_transfer(spi, t); + if (status 0) + break; + if (!t-speed_hz !t-bits_per_word) +
[PATCH 1/9] ARM: Kirkwood: Add interrupt controller support for DT boards
Signed-off-by: Andrew Lunn and...@lunn.ch --- .../devicetree/bindings/arm/mrvl/intc.txt | 20 ++ arch/arm/boot/dts/kirkwood.dtsi|9 arch/arm/mach-kirkwood/board-dt.c | 22 +++- 3 files changed, 50 insertions(+), 1 deletion(-) diff --git a/Documentation/devicetree/bindings/arm/mrvl/intc.txt b/Documentation/devicetree/bindings/arm/mrvl/intc.txt index 80b9a94..612536e 100644 --- a/Documentation/devicetree/bindings/arm/mrvl/intc.txt +++ b/Documentation/devicetree/bindings/arm/mrvl/intc.txt @@ -38,3 +38,23 @@ Example: reg-names = mux status, mux mask; mrvl,intc-nr-irqs = 2; }; + +* Marvell Orion Interrupt controller + +Required properties +- compatible : Should be marvell,orion-intc +- #interrupt-cells: Specifies the number of cells needed to encode an + interrupt source. Supported value is 1 +- interrupt-controller : So that its clear its an interrupt controller. +Optional properties +- reg : Not used yet, but will contain the interrupt mask address + +Example: + + intc: interrupt-controller { + compatible = marvell,orion-intc, marvell,intc; + interrupt-controller; + #interrupt-cells = 1; +reg = 0xfed20204 0x04, + 0xfed20214 0x04; +}; diff --git a/arch/arm/boot/dts/kirkwood.dtsi b/arch/arm/boot/dts/kirkwood.dtsi index 926528b..8eab7c4 100644 --- a/arch/arm/boot/dts/kirkwood.dtsi +++ b/arch/arm/boot/dts/kirkwood.dtsi @@ -2,6 +2,15 @@ / { compatible = mrvl,kirkwood; + interrupt-parent = intc; + + intc: interrupt-controller { + compatible = marvell,orion-intc, marvell,intc; + interrupt-controller; + #interrupt-cells = 1; +reg = 0xfed20204 0x04, + 0xfed20214 0x04; +}; ocp@f100 { compatible = simple-bus; diff --git a/arch/arm/mach-kirkwood/board-dt.c b/arch/arm/mach-kirkwood/board-dt.c index edc3f8a..fa51586 100644 --- a/arch/arm/mach-kirkwood/board-dt.c +++ b/arch/arm/mach-kirkwood/board-dt.c @@ -14,6 +14,7 @@ #include linux/init.h #include linux/of.h #include linux/of_platform.h +#include linux/of_irq.h #include linux/kexec.h #include asm/mach/arch.h #include asm/mach/map.h @@ -80,11 +81,30 @@ static const char *kirkwood_dt_board_compat[] = { NULL }; +static int __init kirkwood_add_irq_domain(struct device_node *np, + struct device_node *interrupt_parent) +{ + kirkwood_init_irq(); + irq_domain_add_legacy(np, 64, 0, 0, irq_domain_simple_ops, NULL); + return 0; +} + +static const struct of_device_id kirkwood_irq_match[] = { + { .compatible = marvell,orion-intc, + .data = kirkwood_add_irq_domain, }, + {}, +}; + +static void __init kirkwood_dt_init_irq(void) +{ + of_irq_init(kirkwood_irq_match); +} + DT_MACHINE_START(KIRKWOOD_DT, Marvell Kirkwood (Flattened Device Tree)) /* Maintainer: Jason Cooper ja...@lakedaemon.net */ .map_io = kirkwood_map_io, .init_early = kirkwood_init_early, - .init_irq = kirkwood_init_irq, + .init_irq = kirkwood_dt_init_irq, .timer = kirkwood_timer, .init_machine = kirkwood_dt_init, .restart= kirkwood_restart, -- 1.7.10 -- To unsubscribe from this list: send the line unsubscribe linux-i2c in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 3/9] spi-orion: remove uneeded spi_info
From: Michael Walle mich...@walle.cc This was formerly used to store the tclk value. This is now discovered using the clk API, rather than pass it as platform data. Signed-off-by: Michael Walle mich...@walle.cc Acked-by: Jason Cooper ja...@lakedaemon.net Signed-off-by: Andrew Lunn and...@lunn.ch --- drivers/spi/spi-orion.c |5 - 1 file changed, 5 deletions(-) diff --git a/drivers/spi/spi-orion.c b/drivers/spi/spi-orion.c index 547d983..8c3d625 100644 --- a/drivers/spi/spi-orion.c +++ b/drivers/spi/spi-orion.c @@ -39,7 +39,6 @@ struct orion_spi { void __iomem*base; unsigned intmax_speed; unsigned intmin_speed; - struct orion_spi_info *spi_info; struct clk *clk; }; @@ -378,12 +377,9 @@ static int __init orion_spi_probe(struct platform_device *pdev) struct spi_master *master; struct orion_spi *spi; struct resource *r; - struct orion_spi_info *spi_info; unsigned long tclk_hz; int status = 0; - spi_info = pdev-dev.platform_data; - master = spi_alloc_master(pdev-dev, sizeof *spi); if (master == NULL) { dev_dbg(pdev-dev, master allocation failed\n); @@ -404,7 +400,6 @@ static int __init orion_spi_probe(struct platform_device *pdev) spi = spi_master_get_devdata(master); spi-master = master; - spi-spi_info = spi_info; spi-clk = clk_get(pdev-dev, NULL); if (IS_ERR(spi-clk)) { -- 1.7.10 -- To unsubscribe from this list: send the line unsubscribe linux-i2c in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 6/9] ARM: kirkwood: use devicetree for SPI on dreamplug
From: Michael Walle mich...@walle.cc Use the device tree for the SPI driver and partition layout. Signed-off-by: Michael Walle mich...@walle.cc Signed-off-by: Andrew Lunn and...@lunn.ch --- arch/arm/boot/dts/kirkwood-dreamplug.dts | 29 + arch/arm/mach-kirkwood/board-dreamplug.c | 41 -- 2 files changed, 29 insertions(+), 41 deletions(-) diff --git a/arch/arm/boot/dts/kirkwood-dreamplug.dts b/arch/arm/boot/dts/kirkwood-dreamplug.dts index a5376b8..d74d1ae 100644 --- a/arch/arm/boot/dts/kirkwood-dreamplug.dts +++ b/arch/arm/boot/dts/kirkwood-dreamplug.dts @@ -20,5 +20,34 @@ clock-frequency = 2; status = ok; }; + + spi@10600 { + status = okay; + + m25p40@0 { + #address-cells = 1; + #size-cells = 1; + compatible = mx25l1606e; + reg = 0; + spi-max-frequency = 5000; + mode = 0; + + partition@0 { + reg = 0x0 0x8; + label = u-boot; + }; + + partition@10 { + reg = 0x10 0x1; + label = u-boot env; + }; + + partition@18 { + reg = 0x18 0x1; + label = dtb; + }; + }; + }; }; + }; diff --git a/arch/arm/mach-kirkwood/board-dreamplug.c b/arch/arm/mach-kirkwood/board-dreamplug.c index 55e357a..eb0e4d5 100644 --- a/arch/arm/mach-kirkwood/board-dreamplug.c +++ b/arch/arm/mach-kirkwood/board-dreamplug.c @@ -14,7 +14,6 @@ #include linux/kernel.h #include linux/init.h #include linux/platform_device.h -#include linux/mtd/partitions.h #include linux/ata_platform.h #include linux/mv643xx_eth.h #include linux/of.h @@ -36,42 +35,6 @@ #include common.h #include mpp.h -struct mtd_partition dreamplug_partitions[] = { - { - .name = u-boot, - .size = SZ_512K, - .offset = 0, - }, - { - .name = u-boot env, - .size = SZ_64K, - .offset = SZ_512K + SZ_512K, - }, - { - .name = dtb, - .size = SZ_64K, - .offset = SZ_512K + SZ_512K + SZ_512K, - }, -}; - -static const struct flash_platform_data dreamplug_spi_slave_data = { - .type = mx25l1606e, - .name = spi_flash, - .parts = dreamplug_partitions, - .nr_parts = ARRAY_SIZE(dreamplug_partitions), -}; - -static struct spi_board_info __initdata dreamplug_spi_slave_info[] = { - { - .modalias = m25p80, - .platform_data = dreamplug_spi_slave_data, - .irq= -1, - .max_speed_hz = 5000, - .bus_num= 0, - .chip_select= 0, - }, -}; - static struct mv643xx_eth_platform_data dreamplug_ge00_data = { .phy_addr = MV643XX_ETH_PHY_ADDR(0), }; @@ -137,10 +100,6 @@ void __init dreamplug_init(void) */ kirkwood_mpp_conf(dreamplug_mpp_config); - spi_register_board_info(dreamplug_spi_slave_info, - ARRAY_SIZE(dreamplug_spi_slave_info)); - kirkwood_spi_init(); - kirkwood_ehci_init(); kirkwood_ge00_init(dreamplug_ge00_data); kirkwood_ge01_init(dreamplug_ge01_data); -- 1.7.10 -- To unsubscribe from this list: send the line unsubscribe linux-i2c in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 9/9] Kirkwood: Add basic device tree support for QNAP TS219.
The two different variants of QNAP TS devices, varying by SoC, put the GPIO keys on different GPIO lines. Hence we need two different DT board descriptions, which share the same board-ts219.c file. Signed-off-by: Andrew Lunn and...@lunn.ch --- arch/arm/boot/dts/kirkwood-ts219-6281.dts | 21 +++ arch/arm/boot/dts/kirkwood-ts219-6282.dts | 21 +++ arch/arm/boot/dts/kirkwood-ts219.dtsi | 73 arch/arm/mach-kirkwood/Kconfig| 15 + arch/arm/mach-kirkwood/Makefile |1 + arch/arm/mach-kirkwood/Makefile.boot |1 + arch/arm/mach-kirkwood/board-dt.c |4 ++ arch/arm/mach-kirkwood/board-ts219.c | 86 + arch/arm/mach-kirkwood/common.h |5 ++ 9 files changed, 227 insertions(+) create mode 100644 arch/arm/boot/dts/kirkwood-ts219-6281.dts create mode 100644 arch/arm/boot/dts/kirkwood-ts219-6282.dts create mode 100644 arch/arm/boot/dts/kirkwood-ts219.dtsi create mode 100644 arch/arm/mach-kirkwood/board-ts219.c diff --git a/arch/arm/boot/dts/kirkwood-ts219-6281.dts b/arch/arm/boot/dts/kirkwood-ts219-6281.dts new file mode 100644 index 000..ccbf327 --- /dev/null +++ b/arch/arm/boot/dts/kirkwood-ts219-6281.dts @@ -0,0 +1,21 @@ +/dts-v1/; + +/include/ kirkwood-ts219.dtsi + +/ { + gpio_keys { + compatible = gpio-keys; + #address-cells = 1; + #size-cells = 0; + button@1 { + label = USB Copy; + linux,code = 133; + gpios = gpio0 15 1; + }; + button@2 { + label = Reset; + linux,code = 0x198; + gpios = gpio0 16 1; + }; + }; +}; \ No newline at end of file diff --git a/arch/arm/boot/dts/kirkwood-ts219-6282.dts b/arch/arm/boot/dts/kirkwood-ts219-6282.dts new file mode 100644 index 000..fbe9932 --- /dev/null +++ b/arch/arm/boot/dts/kirkwood-ts219-6282.dts @@ -0,0 +1,21 @@ +/dts-v1/; + +/include/ kirkwood-ts219.dtsi + +/ { + gpio_keys { + compatible = gpio-keys; + #address-cells = 1; + #size-cells = 0; + button@1 { + label = USB Copy; + linux,code = 133; + gpios = gpio1 11 1; + }; + button@2 { + label = Reset; + linux,code = 0x198; + gpios = gpio1 5 1; + }; + }; +}; \ No newline at end of file diff --git a/arch/arm/boot/dts/kirkwood-ts219.dtsi b/arch/arm/boot/dts/kirkwood-ts219.dtsi new file mode 100644 index 000..e0520c3 --- /dev/null +++ b/arch/arm/boot/dts/kirkwood-ts219.dtsi @@ -0,0 +1,73 @@ +/include/ kirkwood.dtsi + +/ { + model = QNAP TS219 family; + compatible = qnap,ts219, mrvl,kirkwood; + + memory { + device_type = memory; + reg = 0x 0x2000; + }; + + chosen { + bootargs = console=ttyS0,115200n8; + }; + + ocp@f100 { + i2c@11000 { + status = okay; + + s35390a: s35390a@30 { + compatible = s35390a; + reg = 0x30; + }; + }; + serial@12000 { + clock-frequency = 2; + status = okay; + }; + serial@12100 { + clock-frequency = 2; + status = okay; + }; + spi@10600 { + status = okay; + + m25p128@0 { + #address-cells = 1; + #size-cells = 1; + compatible = m25p128; + reg = 0; + spi-max-frequency = 2000; + mode = 0; + + partition@000 { + reg = 0x 0x0008; + label = U-Boot; + }; + + partition@0020 { + reg = 0x0020 0x0020; + label = Kernel; + }; + + partition@0040 { + reg = 0x0040 0x0090; + label = RootFS1; + }; + partition@00d0 { + reg = 0x00d0 0x0030; + label = RootFS2; + }; +
Re: [PATCH 1/2 V3] MXS: Set I2C timing registers for mxs-i2c
Dear Marek Vasut, This patch configures the I2C bus timing registers according to information passed via DT. Currently, 100kHz and 400kHz modes are supported. [...] +struct mxs_i2c_speed_config { + uint32_ttiming0; + uint32_ttiming1; + uint32_ttiming2; +}; + +/* Timing values for the default 24MHz clock supplied into the i2c block. Thinking about these further -- does anyone have any idea how these numbers were derived? And possibly even formula for that? And maybe we should somehow make sure the source runs on 24MHz (how?). */ +const struct mxs_i2c_speed_config mxs_i2c_95kHz_config = { + .timing0= 0x00780030, + .timing1= 0x00800030, + .timing2= 0x0015000d, +}; + +const struct mxs_i2c_speed_config mxs_i2c_400kHz_config = { + .timing0= 0x000f0007, + .timing1= 0x001f000f, + .timing2= 0x0015000d, +}; [...] Best regards, Marek Vasut -- To unsubscribe from this list: send the line unsubscribe linux-i2c in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [lm-sensors] lm75_remove: LM75 Device remove using sysfs delete_device
On Sun, Jun 10, 2012 at 10:41:03AM -0400, Sasikanth babu wrote: Hi all, when I'm trying to delete lm75 device using sysfs delete_device attribute (echo 0x4e /sys/bus/i2c/devices/i2c-3/delete_device) It hangs at lm75_remove function. I started the device using sysfs attribute new_device. Kernel verion : 2.6.34.12 echo 0 /proc/sys/kernel/hung_task_timeout_secs disables this message. i2cinit D 814a04e0 0 2064 2059 0x0004 880271928a70 0086 0096 880273215b48 8802 880477306a70 00010140 880273215fd8 00010140 880271928a70 880273215fd8 880273215fd8 Call Trace: [8103ecd0] ? default_wake_function+0x0/0x20 [8148765f] ? __rt_mutex_slowlock+0x4f/0x110 [814879e3] ? rt_mutex_slowlock+0x93/0x190 [813278d9] ? i2c_smbus_xfer+0x49/0x110 [814e1de0] ? dev_sysfs_ops+0x0/0x10 [81327c40] ? i2c_smbus_write_byte_data+0x30/0x40 [811361f9] ? sysfs_remove_group+0x59/0x100 [8132ec2d] ? lm75_remove+0x4d/0x80 [81326ef9] ? i2c_device_remove+0xa9/0xc0 [8129ffb6] ? __device_release_driver+0x56/0xc0 [812a00f5] ? device_release_driver+0x25/0x40 [8129f481] ? bus_remove_device+0x91/0xc0 [8129d7a8] ? device_del+0x118/0x190 [8129d829] ? device_unregister+0x9/0x20 [813281bc] ? i2c_sysfs_delete_device+0x17c/0x200 [81133046] ? sysfs_write_file+0x1c6/0x260 [810d5323] ? vfs_write+0x103/0x200 [810d550e] ? sys_write+0x4e/0x90 [814884e4] ? page_fault+0x24/0x30 [810024ab] ? system_call_done+0x0/0x5 Hi, I don't see anything wrong in the lm75 driver. The problem seems to be related to the I2C bus master driver, or possibly to another device access pending on the same I2C bus which does not complete. What is the I2C bus master driver, and do you have anything else happening on the same bus ? Guenter -- To unsubscribe from this list: send the line unsubscribe linux-i2c in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: lm75_remove: LM75 Device remove using sysfs delete_device
(Note: Frodo is out of the lm-sensors project for years, no need to Cc him.) On Sun, 10 Jun 2012 07:41:03 -0700, Sasikanth babu wrote: when I'm trying to delete lm75 device using sysfs delete_device attribute (echo 0x4e /sys/bus/i2c/devices/i2c-3/delete_device) It hangs at lm75_remove function. I started the device using sysfs attribute new_device. Kernel verion : 2.6.34.12 I can't reproduce this with kernel 3.4.2. Did you try reproducing this with a more recent kernel? 2.6.34 is getting old. Is there anything you can think of which makes your system special? I2C bus multiplexing ? Some unusual kernel option maybe? echo 0 /proc/sys/kernel/hung_task_timeout_secs disables this message. i2cinit D 814a04e0 0 2064 2059 0x0004 880271928a70 0086 0096 880273215b48 8802 880477306a70 00010140 880273215fd8 00010140 880271928a70 880273215fd8 880273215fd8 Call Trace: [8103ecd0] ? default_wake_function+0x0/0x20 [8148765f] ? __rt_mutex_slowlock+0x4f/0x110 [814879e3] ? rt_mutex_slowlock+0x93/0x190 [813278d9] ? i2c_smbus_xfer+0x49/0x110 [814e1de0] ? dev_sysfs_ops+0x0/0x10 [81327c40] ? i2c_smbus_write_byte_data+0x30/0x40 This looks odd, sysfs_remove_group() doesn't call i2c_smbus_write_byte_data(), and i2c_smbus_write_byte_data() doesn't touch dev_sysfs_ops... So this stack trace is approximate. [811361f9] ? sysfs_remove_group+0x59/0x100 [8132ec2d] ? lm75_remove+0x4d/0x80 [81326ef9] ? i2c_device_remove+0xa9/0xc0 [8129ffb6] ? __device_release_driver+0x56/0xc0 [812a00f5] ? device_release_driver+0x25/0x40 [8129f481] ? bus_remove_device+0x91/0xc0 [8129d7a8] ? device_del+0x118/0x190 [8129d829] ? device_unregister+0x9/0x20 [813281bc] ? i2c_sysfs_delete_device+0x17c/0x200 [81133046] ? sysfs_write_file+0x1c6/0x260 [810d5323] ? vfs_write+0x103/0x200 [810d550e] ? sys_write+0x4e/0x90 [814884e4] ? page_fault+0x24/0x30 [810024ab] ? system_call_done+0x0/0x5 -- Jean Delvare -- To unsubscribe from this list: send the line unsubscribe linux-i2c in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [lm-sensors] lm75_remove: LM75 Device remove using sysfs delete_device
On Sun, Jun 10, 2012 at 11:36:40AM -0400, Jean Delvare wrote: (Note: Frodo is out of the lm-sensors project for years, no need to Cc him.) On Sun, 10 Jun 2012 07:41:03 -0700, Sasikanth babu wrote: when I'm trying to delete lm75 device using sysfs delete_device attribute (echo 0x4e /sys/bus/i2c/devices/i2c-3/delete_device) It hangs at lm75_remove function. I started the device using sysfs attribute new_device. Kernel verion : 2.6.34.12 I can't reproduce this with kernel 3.4.2. Did you try reproducing this with a more recent kernel? 2.6.34 is getting old. Is there anything you can think of which makes your system special? I2C bus multiplexing ? Some unusual kernel option maybe? echo 0 /proc/sys/kernel/hung_task_timeout_secs disables this message. i2cinit D 814a04e0 0 2064 2059 0x0004 880271928a70 0086 0096 880273215b48 8802 880477306a70 00010140 880273215fd8 00010140 880271928a70 880273215fd8 880273215fd8 Call Trace: [8103ecd0] ? default_wake_function+0x0/0x20 [8148765f] ? __rt_mutex_slowlock+0x4f/0x110 [814879e3] ? rt_mutex_slowlock+0x93/0x190 [813278d9] ? i2c_smbus_xfer+0x49/0x110 [814e1de0] ? dev_sysfs_ops+0x0/0x10 [81327c40] ? i2c_smbus_write_byte_data+0x30/0x40 This looks odd, sysfs_remove_group() doesn't call i2c_smbus_write_byte_data(), and i2c_smbus_write_byte_data() doesn't touch dev_sysfs_ops... So this stack trace is approximate. I thought it was probably the call to lm75_write_value() in lm75_remove() after sysfs_remove_group() returned. Guenter [811361f9] ? sysfs_remove_group+0x59/0x100 [8132ec2d] ? lm75_remove+0x4d/0x80 [81326ef9] ? i2c_device_remove+0xa9/0xc0 [8129ffb6] ? __device_release_driver+0x56/0xc0 [812a00f5] ? device_release_driver+0x25/0x40 [8129f481] ? bus_remove_device+0x91/0xc0 [8129d7a8] ? device_del+0x118/0x190 [8129d829] ? device_unregister+0x9/0x20 [813281bc] ? i2c_sysfs_delete_device+0x17c/0x200 [81133046] ? sysfs_write_file+0x1c6/0x260 [810d5323] ? vfs_write+0x103/0x200 [810d550e] ? sys_write+0x4e/0x90 [814884e4] ? page_fault+0x24/0x30 [810024ab] ? system_call_done+0x0/0x5 -- Jean Delvare ___ lm-sensors mailing list lm-sens...@lm-sensors.org http://lists.lm-sensors.org/mailman/listinfo/lm-sensors -- To unsubscribe from this list: send the line unsubscribe linux-i2c in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: lm75_remove: LM75 Device remove using sysfs delete_device
On Sun, 10 Jun 2012 08:46:29 -0700, Guenter Roeck wrote: On Sun, Jun 10, 2012 at 11:36:40AM -0400, Jean Delvare wrote: echo 0 /proc/sys/kernel/hung_task_timeout_secs disables this message. i2cinit D 814a04e0 0 2064 2059 0x0004 880271928a70 0086 0096 880273215b48 8802 880477306a70 00010140 880273215fd8 00010140 880271928a70 880273215fd8 880273215fd8 Call Trace: [8103ecd0] ? default_wake_function+0x0/0x20 [8148765f] ? __rt_mutex_slowlock+0x4f/0x110 [814879e3] ? rt_mutex_slowlock+0x93/0x190 [813278d9] ? i2c_smbus_xfer+0x49/0x110 [814e1de0] ? dev_sysfs_ops+0x0/0x10 [81327c40] ? i2c_smbus_write_byte_data+0x30/0x40 This looks odd, sysfs_remove_group() doesn't call i2c_smbus_write_byte_data(), and i2c_smbus_write_byte_data() doesn't touch dev_sysfs_ops... So this stack trace is approximate. I thought it was probably the call to lm75_write_value() in lm75_remove() after sysfs_remove_group() returned. Certainly. We see a mix of the function calls in lm75_remove(). lm75_write_value() is definitely the one causing the deadlock. And your analysis is correct... there's nothing special about this byte write, so there must be something wrong with the underlying I2C bus even before that. -- Jean Delvare -- To unsubscribe from this list: send the line unsubscribe linux-i2c in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 2/9] SPI: Refactor spi-orion to use SPI framework queue.
On Sun, Jun 10, 2012 at 12:31 PM, Andrew Lunn and...@lunn.ch wrote: Replace the deprecated master-transfer with transfer_one_message() and allow the SPI subsystem handle all the queuing of messages. Signed-off-by: Andrew Lunn and...@lunn.ch Acked-by: Linus Walleij linus.wall...@linaro.org Looks good to me: Acked-by: Linus Walleij linus.wall...@linaro.org Yours, Linus Walleij -- To unsubscribe from this list: send the line unsubscribe linux-i2c in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 0/9] Kirkwood DT support For IRQ, SPI, I2C, GPIO
On Sun, Jun 10, 2012 at 12:31:52PM +0200, Andrew Lunn wrote: This patch set adds Device Tree support for IRQ, SPI, I2C and GPIO on Orion based drivers, and makes use of these for kirkwood devices. It also adds the ability to boot QNAP TS219 based systems using device tree. Andrew, thanks for the patch series. At first glance, things look good. I'll let this sit on the mailinglist for a few days and try to test it early this week. thx, Jason. The SPI DT patches are from Michael Walle, and have been previously posted. I've addressed the issues raised during the review. The SPI refactor to use the SPI framework was submitted for merge into 3.5, but due to dependency issues, which are now resolved, the patch was not accepted. This patch has been modified to remove two NOP functions, which the SPI framework no longer needs. Andrew Lunn (5): ARM: Kirkwood: Add interrupt controller support for DT boards SPI: Refactor spi-orion to use SPI framework queue. I2C: MV64XXX: Add Device Tree support ARM: Kirkwood: Add DT support for GPIO controllers Kirkwood: Add basic device tree support for QNAP TS219. Michael Walle (4): spi-orion: remove uneeded spi_info spi-orion: add device tree binding ARM: kirkwood: use devicetree for orion-spi ARM: kirkwood: use devicetree for SPI on dreamplug .../devicetree/bindings/arm/mrvl/intc.txt | 20 ++ .../devicetree/bindings/gpio/mrvl-gpio.txt | 25 +++ Documentation/devicetree/bindings/i2c/mrvl-i2c.txt | 35 ++- .../devicetree/bindings/spi/spi-orion.txt |5 + arch/arm/boot/dts/kirkwood-dreamplug.dts | 29 +++ arch/arm/boot/dts/kirkwood-ts219-6281.dts | 21 ++ arch/arm/boot/dts/kirkwood-ts219-6282.dts | 21 ++ arch/arm/boot/dts/kirkwood-ts219.dtsi | 73 +++ arch/arm/boot/dts/kirkwood.dtsi| 51 + arch/arm/mach-kirkwood/Kconfig | 15 ++ arch/arm/mach-kirkwood/Makefile|1 + arch/arm/mach-kirkwood/Makefile.boot |1 + arch/arm/mach-kirkwood/board-dreamplug.c | 41 arch/arm/mach-kirkwood/board-dt.c | 36 +++- arch/arm/mach-kirkwood/board-ts219.c | 86 arch/arm/mach-kirkwood/common.h|5 + arch/arm/mach-kirkwood/irq.c | 20 +- arch/arm/plat-orion/gpio.c | 68 +- arch/arm/plat-orion/include/plat/gpio.h|2 + drivers/i2c/busses/i2c-mv64xxx.c | 38 +++- drivers/spi/spi-orion.c| 223 ++-- 21 files changed, 605 insertions(+), 211 deletions(-) create mode 100644 Documentation/devicetree/bindings/spi/spi-orion.txt create mode 100644 arch/arm/boot/dts/kirkwood-ts219-6281.dts create mode 100644 arch/arm/boot/dts/kirkwood-ts219-6282.dts create mode 100644 arch/arm/boot/dts/kirkwood-ts219.dtsi create mode 100644 arch/arm/mach-kirkwood/board-ts219.c -- 1.7.10 -- To unsubscribe from this list: send the line unsubscribe linux-i2c in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 1/9] ARM: Kirkwood: Add interrupt controller support for DT boards
On Sun, Jun 10, 2012 at 12:31:53PM +0200, Andrew Lunn wrote: Signed-off-by: Andrew Lunn and...@lunn.ch --- .../devicetree/bindings/arm/mrvl/intc.txt | 20 ++ arch/arm/boot/dts/kirkwood.dtsi|9 arch/arm/mach-kirkwood/board-dt.c | 22 +++- 3 files changed, 50 insertions(+), 1 deletion(-) diff --git a/Documentation/devicetree/bindings/arm/mrvl/intc.txt b/Documentation/devicetree/bindings/arm/mrvl/intc.txt index 80b9a94..612536e 100644 --- a/Documentation/devicetree/bindings/arm/mrvl/intc.txt +++ b/Documentation/devicetree/bindings/arm/mrvl/intc.txt @@ -38,3 +38,23 @@ Example: reg-names = mux status, mux mask; mrvl,intc-nr-irqs = 2; }; + +* Marvell Orion Interrupt controller + +Required properties +- compatible : Should be marvell,orion-intc +- #interrupt-cells: Specifies the number of cells needed to encode an + interrupt source. Supported value is 1 +- interrupt-controller : So that its clear its an interrupt controller. nit. Declare this node to be an interrupt controller. If you end up doing a v2 for other reasons, go ahead and add this. Otherwise, don't worry about it. +Optional properties +- reg : Not used yet, but will contain the interrupt mask address + +Example: + + intc: interrupt-controller { + compatible = marvell,orion-intc, marvell,intc; + interrupt-controller; + #interrupt-cells = 1; +reg = 0xfed20204 0x04, + 0xfed20214 0x04; +}; diff --git a/arch/arm/boot/dts/kirkwood.dtsi b/arch/arm/boot/dts/kirkwood.dtsi index 926528b..8eab7c4 100644 --- a/arch/arm/boot/dts/kirkwood.dtsi +++ b/arch/arm/boot/dts/kirkwood.dtsi @@ -2,6 +2,15 @@ / { compatible = mrvl,kirkwood; + interrupt-parent = intc; + + intc: interrupt-controller { + compatible = marvell,orion-intc, marvell,intc; + interrupt-controller; + #interrupt-cells = 1; +reg = 0xfed20204 0x04, + 0xfed20214 0x04; +}; ocp@f100 { compatible = simple-bus; diff --git a/arch/arm/mach-kirkwood/board-dt.c b/arch/arm/mach-kirkwood/board-dt.c index edc3f8a..fa51586 100644 --- a/arch/arm/mach-kirkwood/board-dt.c +++ b/arch/arm/mach-kirkwood/board-dt.c @@ -14,6 +14,7 @@ #include linux/init.h #include linux/of.h #include linux/of_platform.h +#include linux/of_irq.h #include linux/kexec.h #include asm/mach/arch.h #include asm/mach/map.h @@ -80,11 +81,30 @@ static const char *kirkwood_dt_board_compat[] = { NULL }; +static int __init kirkwood_add_irq_domain(struct device_node *np, + struct device_node *interrupt_parent) +{ + kirkwood_init_irq(); + irq_domain_add_legacy(np, 64, 0, 0, irq_domain_simple_ops, NULL); + return 0; +} + +static const struct of_device_id kirkwood_irq_match[] = { + { .compatible = marvell,orion-intc, + .data = kirkwood_add_irq_domain, }, + {}, +}; + +static void __init kirkwood_dt_init_irq(void) +{ + of_irq_init(kirkwood_irq_match); +} + DT_MACHINE_START(KIRKWOOD_DT, Marvell Kirkwood (Flattened Device Tree)) /* Maintainer: Jason Cooper ja...@lakedaemon.net */ .map_io = kirkwood_map_io, .init_early = kirkwood_init_early, - .init_irq = kirkwood_init_irq, + .init_irq = kirkwood_dt_init_irq, .timer = kirkwood_timer, .init_machine = kirkwood_dt_init, .restart= kirkwood_restart, -- 1.7.10 Looks good. Acked-by: Jason Cooper ja...@lakedaemon.net I'll add Tested-by: once I get a chance. thx, Jason. -- To unsubscribe from this list: send the line unsubscribe linux-i2c in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 4/9] spi-orion: add device tree binding
On Sun, Jun 10, 2012 at 12:31:56PM +0200, Andrew Lunn wrote: From: Michael Walle mich...@walle.cc Signed-off-by: Michael Walle mich...@walle.cc Signed-off-by: Andrew Lunn and...@lunn.ch Looks good. Acked-by: Jason Cooper ja...@lakedaemon.net --- Documentation/devicetree/bindings/spi/spi-orion.txt |5 + drivers/spi/spi-orion.c |9 + 2 files changed, 14 insertions(+) create mode 100644 Documentation/devicetree/bindings/spi/spi-orion.txt diff --git a/Documentation/devicetree/bindings/spi/spi-orion.txt b/Documentation/devicetree/bindings/spi/spi-orion.txt new file mode 100644 index 000..e68597a --- /dev/null +++ b/Documentation/devicetree/bindings/spi/spi-orion.txt @@ -0,0 +1,5 @@ +Marvell Orion SPI device + +Required properties: +- compatible : should be marvell,orion-spi. +- reg : offset and length of the register set for the device diff --git a/drivers/spi/spi-orion.c b/drivers/spi/spi-orion.c index 8c3d625..b16db3d 100644 --- a/drivers/spi/spi-orion.c +++ b/drivers/spi/spi-orion.c @@ -17,6 +17,7 @@ #include linux/io.h #include linux/spi/spi.h #include linux/module.h +#include linux/of.h #include linux/clk.h #include asm/unaligned.h @@ -429,6 +430,7 @@ static int __init orion_spi_probe(struct platform_device *pdev) if (orion_spi_reset(spi) 0) goto out_rel_mem; + master-dev.of_node = pdev-dev.of_node; status = spi_register_master(master); if (status 0) goto out_rel_mem; @@ -468,10 +470,17 @@ static int __exit orion_spi_remove(struct platform_device *pdev) MODULE_ALIAS(platform: DRIVER_NAME); +static const struct of_device_id orion_spi_of_match_table[] __devinitdata = { + { .compatible = marvell,orion-spi, }, + {} +}; +MODULE_DEVICE_TABLE(of, orion_spi_of_match_table); + static struct platform_driver orion_spi_driver = { .driver = { .name = DRIVER_NAME, .owner = THIS_MODULE, + .of_match_table = of_match_ptr(orion_spi_of_match_table), }, .remove = __exit_p(orion_spi_remove), }; -- 1.7.10 -- To unsubscribe from this list: send the line unsubscribe linux-i2c in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 5/9] ARM: kirkwood: use devicetree for orion-spi
On Sun, Jun 10, 2012 at 12:31:57PM +0200, Andrew Lunn wrote: From: Michael Walle mich...@walle.cc Populate the devices with auxdata to set the device names which are used by clkdev to lookup the clocks. Signed-off-by: Michael Walle mich...@walle.cc Signed-off-by: Andrew Lunn and...@lunn.ch --- arch/arm/boot/dts/kirkwood.dtsi |9 + arch/arm/mach-kirkwood/board-dt.c |8 +++- 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/arch/arm/boot/dts/kirkwood.dtsi b/arch/arm/boot/dts/kirkwood.dtsi index 8eab7c4..7d282ab 100644 --- a/arch/arm/boot/dts/kirkwood.dtsi +++ b/arch/arm/boot/dts/kirkwood.dtsi @@ -42,6 +42,15 @@ interrupts = 53; }; + spi@10600 { + compatible = marvell,orion-spi; + #address-cells = 1; + #size-cells = 0; + cell-index = 0; + reg = 0x10600 0x28; + status = disabled; + }; + nand@300 { #address-cells = 1; #size-cells = 1; diff --git a/arch/arm/mach-kirkwood/board-dt.c b/arch/arm/mach-kirkwood/board-dt.c index fa51586..0942139 100644 --- a/arch/arm/mach-kirkwood/board-dt.c +++ b/arch/arm/mach-kirkwood/board-dt.c @@ -26,6 +26,11 @@ static struct of_device_id kirkwood_dt_match_table[] __initdata = { { } }; +struct of_dev_auxdata kirkwood_auxdata_lookup[] __initdata = { + OF_DEV_AUXDATA(marvell,orion-spi, 0xf1010600, orion_spi.0, NULL), Isn't this -^^ defined somewhere? This is done about 1/4 of the time (56 / 187) in the kernel. But honestly, I'd prefer it to be named. Other than that, Acked-by: Jason Cooper ja...@lakedaemon.net + {}, +}; + static void __init kirkwood_dt_init(void) { pr_info(Kirkwood: %s, TCLK=%d.\n, kirkwood_id(), kirkwood_tclk); @@ -69,7 +74,8 @@ static void __init kirkwood_dt_init(void) if (of_machine_is_compatible(raidsonic,ib-nas62x0)) ib62x0_init(); - of_platform_populate(NULL, kirkwood_dt_match_table, NULL, NULL); + of_platform_populate(NULL, kirkwood_dt_match_table, + kirkwood_auxdata_lookup, NULL); } static const char *kirkwood_dt_board_compat[] = { -- 1.7.10 -- To unsubscribe from this list: send the line unsubscribe linux-i2c in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 6/9] ARM: kirkwood: use devicetree for SPI on dreamplug
On Sun, Jun 10, 2012 at 12:31:58PM +0200, Andrew Lunn wrote: From: Michael Walle mich...@walle.cc Use the device tree for the SPI driver and partition layout. Signed-off-by: Michael Walle mich...@walle.cc Signed-off-by: Andrew Lunn and...@lunn.ch Acked-by: Jason Cooper ja...@lakedaemon.net --- arch/arm/boot/dts/kirkwood-dreamplug.dts | 29 + arch/arm/mach-kirkwood/board-dreamplug.c | 41 -- 2 files changed, 29 insertions(+), 41 deletions(-) diff --git a/arch/arm/boot/dts/kirkwood-dreamplug.dts b/arch/arm/boot/dts/kirkwood-dreamplug.dts index a5376b8..d74d1ae 100644 --- a/arch/arm/boot/dts/kirkwood-dreamplug.dts +++ b/arch/arm/boot/dts/kirkwood-dreamplug.dts @@ -20,5 +20,34 @@ clock-frequency = 2; status = ok; }; + + spi@10600 { + status = okay; + + m25p40@0 { + #address-cells = 1; + #size-cells = 1; + compatible = mx25l1606e; + reg = 0; + spi-max-frequency = 5000; + mode = 0; + + partition@0 { + reg = 0x0 0x8; + label = u-boot; + }; + + partition@10 { + reg = 0x10 0x1; + label = u-boot env; + }; + + partition@18 { + reg = 0x18 0x1; + label = dtb; + }; + }; + }; }; + }; diff --git a/arch/arm/mach-kirkwood/board-dreamplug.c b/arch/arm/mach-kirkwood/board-dreamplug.c index 55e357a..eb0e4d5 100644 --- a/arch/arm/mach-kirkwood/board-dreamplug.c +++ b/arch/arm/mach-kirkwood/board-dreamplug.c @@ -14,7 +14,6 @@ #include linux/kernel.h #include linux/init.h #include linux/platform_device.h -#include linux/mtd/partitions.h #include linux/ata_platform.h #include linux/mv643xx_eth.h #include linux/of.h @@ -36,42 +35,6 @@ #include common.h #include mpp.h -struct mtd_partition dreamplug_partitions[] = { - { - .name = u-boot, - .size = SZ_512K, - .offset = 0, - }, - { - .name = u-boot env, - .size = SZ_64K, - .offset = SZ_512K + SZ_512K, - }, - { - .name = dtb, - .size = SZ_64K, - .offset = SZ_512K + SZ_512K + SZ_512K, - }, -}; - -static const struct flash_platform_data dreamplug_spi_slave_data = { - .type = mx25l1606e, - .name = spi_flash, - .parts = dreamplug_partitions, - .nr_parts = ARRAY_SIZE(dreamplug_partitions), -}; - -static struct spi_board_info __initdata dreamplug_spi_slave_info[] = { - { - .modalias = m25p80, - .platform_data = dreamplug_spi_slave_data, - .irq= -1, - .max_speed_hz = 5000, - .bus_num= 0, - .chip_select= 0, - }, -}; - static struct mv643xx_eth_platform_data dreamplug_ge00_data = { .phy_addr = MV643XX_ETH_PHY_ADDR(0), }; @@ -137,10 +100,6 @@ void __init dreamplug_init(void) */ kirkwood_mpp_conf(dreamplug_mpp_config); - spi_register_board_info(dreamplug_spi_slave_info, - ARRAY_SIZE(dreamplug_spi_slave_info)); - kirkwood_spi_init(); - kirkwood_ehci_init(); kirkwood_ge00_init(dreamplug_ge00_data); kirkwood_ge01_init(dreamplug_ge01_data); -- 1.7.10 -- To unsubscribe from this list: send the line unsubscribe linux-i2c in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 8/9] ARM: Kirkwood: Add DT support for GPIO controllers
On Sun, Jun 10, 2012 at 12:32:00PM +0200, Andrew Lunn wrote: The GPIO controllers can now be described in DT. Origionally GPIO controllers were instantiated during IRQ setup. The origional none-DT nit. non-DT code has been split out, and is only called if no DT GPIO controllers are found. Signed-off-by: Andrew Lunn and...@lunn.ch Acked-by: Jason Cooper ja...@lakedaemon.net --- .../devicetree/bindings/gpio/mrvl-gpio.txt | 25 +++ arch/arm/boot/dts/kirkwood.dtsi| 20 ++ arch/arm/mach-kirkwood/irq.c | 20 -- arch/arm/plat-orion/gpio.c | 68 +++- arch/arm/plat-orion/include/plat/gpio.h|2 + 5 files changed, 126 insertions(+), 9 deletions(-) diff --git a/Documentation/devicetree/bindings/gpio/mrvl-gpio.txt b/Documentation/devicetree/bindings/gpio/mrvl-gpio.txt index 05428f3..d94ebc1 100644 --- a/Documentation/devicetree/bindings/gpio/mrvl-gpio.txt +++ b/Documentation/devicetree/bindings/gpio/mrvl-gpio.txt @@ -27,3 +27,28 @@ Example: interrupt-controller; #interrupt-cells = 1; }; + +* Marvell Orion GPIO Controller + +Required properties: +- compatible : Should be marvell,orion-gpio +- reg: Address and length of the register set for controller. +- gpio-controller: So we know this is a gpio controller. +- gpio-base : Number of first gpio pin. +- ngpio : How many gpios this controller has. +- secondary-irq-base : IRQ number base + +Optional properties: +- mask-offset: For SMP Orions, offset for Nth CPU + +Example: + + gpio0: gpio@10100 { + compatible = marvell,orion-gpio; + #gpio-cells = 2; + gpio-controller; + reg = 0x10100 0x40; + gpio-base = 0; + ngpio = 32; + secondary-irq-base = 64; + }; diff --git a/arch/arm/boot/dts/kirkwood.dtsi b/arch/arm/boot/dts/kirkwood.dtsi index 3091c01..6de66dc 100644 --- a/arch/arm/boot/dts/kirkwood.dtsi +++ b/arch/arm/boot/dts/kirkwood.dtsi @@ -18,6 +18,26 @@ #address-cells = 1; #size-cells = 1; + gpio0: gpio@10100 { + compatible = marvell,orion-gpio; + #gpio-cells = 2; + gpio-controller; + reg = 0x10100 0x40; + gpio-base = 0; + ngpio = 32; + secondary-irq-base = 64; + }; + + gpio1: gpio@10140 { + compatible = marvell,orion-gpio; + #gpio-cells = 2; + gpio-controller; + reg = 0x10140 0x40; + gpio-base = 32; + ngpio = 18; + secondary-irq-base = 96; + }; + serial@12000 { compatible = ns16550a; reg = 0x12000 0x100; diff --git a/arch/arm/mach-kirkwood/irq.c b/arch/arm/mach-kirkwood/irq.c index c4c68e5..81340c2 100644 --- a/arch/arm/mach-kirkwood/irq.c +++ b/arch/arm/mach-kirkwood/irq.c @@ -24,25 +24,33 @@ static void gpio_irq_handler(unsigned int irq, struct irq_desc *desc) orion_gpio_irq_handler((irq - IRQ_KIRKWOOD_GPIO_LOW_0_7) 3); } -void __init kirkwood_init_irq(void) +static void __init kirkwood_init_gpio(void) { - orion_irq_init(0, (void __iomem *)(IRQ_VIRT_BASE + IRQ_MASK_LOW_OFF)); - orion_irq_init(32, (void __iomem *)(IRQ_VIRT_BASE + IRQ_MASK_HIGH_OFF)); - /* * Initialize gpiolib for GPIOs 0-49. */ orion_gpio_init(0, 32, GPIO_LOW_VIRT_BASE, 0, IRQ_KIRKWOOD_GPIO_START); + orion_gpio_init(32, 18, GPIO_HIGH_VIRT_BASE, 0, + IRQ_KIRKWOOD_GPIO_START + 32); +} +void __init kirkwood_init_irq(void) +{ + orion_irq_init(0, (void __iomem *)(IRQ_VIRT_BASE + IRQ_MASK_LOW_OFF)); + orion_irq_init(32, (void __iomem *)(IRQ_VIRT_BASE + IRQ_MASK_HIGH_OFF)); + irq_set_chained_handler(IRQ_KIRKWOOD_GPIO_LOW_0_7, gpio_irq_handler); irq_set_chained_handler(IRQ_KIRKWOOD_GPIO_LOW_8_15, gpio_irq_handler); irq_set_chained_handler(IRQ_KIRKWOOD_GPIO_LOW_16_23, gpio_irq_handler); irq_set_chained_handler(IRQ_KIRKWOOD_GPIO_LOW_24_31, gpio_irq_handler); - orion_gpio_init(32, 18, GPIO_HIGH_VIRT_BASE, 0, - IRQ_KIRKWOOD_GPIO_START + 32); irq_set_chained_handler(IRQ_KIRKWOOD_GPIO_HIGH_0_7, gpio_irq_handler); irq_set_chained_handler(IRQ_KIRKWOOD_GPIO_HIGH_8_15, gpio_irq_handler); irq_set_chained_handler(IRQ_KIRKWOOD_GPIO_HIGH_16_23, gpio_irq_handler); + + /* Try initializing the GPIO controllers via DT. If zero +controllers are found, fall back to hard coded values
Re: [PATCH 9/9] Kirkwood: Add basic device tree support for QNAP TS219.
On Sun, Jun 10, 2012 at 12:32:01PM +0200, Andrew Lunn wrote: The two different variants of QNAP TS devices, varying by SoC, put the GPIO keys on different GPIO lines. Hence we need two different DT board descriptions, which share the same board-ts219.c file. Signed-off-by: Andrew Lunn and...@lunn.ch --- arch/arm/boot/dts/kirkwood-ts219-6281.dts | 21 +++ arch/arm/boot/dts/kirkwood-ts219-6282.dts | 21 +++ arch/arm/boot/dts/kirkwood-ts219.dtsi | 73 arch/arm/mach-kirkwood/Kconfig| 15 + arch/arm/mach-kirkwood/Makefile |1 + arch/arm/mach-kirkwood/Makefile.boot |1 + arch/arm/mach-kirkwood/board-dt.c |4 ++ arch/arm/mach-kirkwood/board-ts219.c | 86 + arch/arm/mach-kirkwood/common.h |5 ++ 9 files changed, 227 insertions(+) create mode 100644 arch/arm/boot/dts/kirkwood-ts219-6281.dts create mode 100644 arch/arm/boot/dts/kirkwood-ts219-6282.dts create mode 100644 arch/arm/boot/dts/kirkwood-ts219.dtsi create mode 100644 arch/arm/mach-kirkwood/board-ts219.c diff --git a/arch/arm/boot/dts/kirkwood-ts219-6281.dts b/arch/arm/boot/dts/kirkwood-ts219-6281.dts new file mode 100644 index 000..ccbf327 --- /dev/null +++ b/arch/arm/boot/dts/kirkwood-ts219-6281.dts @@ -0,0 +1,21 @@ +/dts-v1/; + +/include/ kirkwood-ts219.dtsi + +/ { + gpio_keys { + compatible = gpio-keys; + #address-cells = 1; + #size-cells = 0; + button@1 { + label = USB Copy; + linux,code = 133; + gpios = gpio0 15 1; + }; + button@2 { + label = Reset; + linux,code = 0x198; + gpios = gpio0 16 1; + }; + }; +}; \ No newline at end of file diff --git a/arch/arm/boot/dts/kirkwood-ts219-6282.dts b/arch/arm/boot/dts/kirkwood-ts219-6282.dts new file mode 100644 index 000..fbe9932 --- /dev/null +++ b/arch/arm/boot/dts/kirkwood-ts219-6282.dts @@ -0,0 +1,21 @@ +/dts-v1/; + +/include/ kirkwood-ts219.dtsi + +/ { + gpio_keys { + compatible = gpio-keys; + #address-cells = 1; + #size-cells = 0; + button@1 { + label = USB Copy; + linux,code = 133; + gpios = gpio1 11 1; + }; + button@2 { + label = Reset; + linux,code = 0x198; + gpios = gpio1 5 1; + }; + }; +}; \ No newline at end of file diff --git a/arch/arm/boot/dts/kirkwood-ts219.dtsi b/arch/arm/boot/dts/kirkwood-ts219.dtsi new file mode 100644 index 000..e0520c3 --- /dev/null +++ b/arch/arm/boot/dts/kirkwood-ts219.dtsi @@ -0,0 +1,73 @@ +/include/ kirkwood.dtsi + +/ { + model = QNAP TS219 family; + compatible = qnap,ts219, mrvl,kirkwood; + + memory { + device_type = memory; + reg = 0x 0x2000; + }; + + chosen { + bootargs = console=ttyS0,115200n8; + }; + + ocp@f100 { + i2c@11000 { + status = okay; + + s35390a: s35390a@30 { + compatible = s35390a; + reg = 0x30; + }; + }; + serial@12000 { + clock-frequency = 2; + status = okay; + }; + serial@12100 { + clock-frequency = 2; + status = okay; + }; + spi@10600 { + status = okay; + + m25p128@0 { + #address-cells = 1; + #size-cells = 1; + compatible = m25p128; + reg = 0; + spi-max-frequency = 2000; + mode = 0; + + partition@000 { + reg = 0x 0x0008; + label = U-Boot; + }; + + partition@0020 { + reg = 0x0020 0x0020; + label = Kernel; + }; + + partition@0040 { + reg = 0x0040 0x0090; + label = RootFS1; + }; + partition@00d0 { + reg = 0x00d0 0x0030; +
Re: [PATCH 1/9] ARM: Kirkwood: Add interrupt controller support for DT boards
Am Sonntag 10 Juni 2012, 12:31:53 schrieb Andrew Lunn: Signed-off-by: Andrew Lunn and...@lunn.ch --- .../devicetree/bindings/arm/mrvl/intc.txt | 20 ++ arch/arm/boot/dts/kirkwood.dtsi| 9 arch/arm/mach-kirkwood/board-dt.c | 22 +++- 3 files changed, 50 insertions(+), 1 deletion(-) diff --git a/Documentation/devicetree/bindings/arm/mrvl/intc.txt b/Documentation/devicetree/bindings/arm/mrvl/intc.txt index 80b9a94..612536e 100644 --- a/Documentation/devicetree/bindings/arm/mrvl/intc.txt +++ b/Documentation/devicetree/bindings/arm/mrvl/intc.txt @@ -38,3 +38,23 @@ Example: reg-names = mux status, mux mask; mrvl,intc-nr-irqs = 2; }; + +* Marvell Orion Interrupt controller + +Required properties +- compatible : Should be marvell,orion-intc +- #interrupt-cells: Specifies the number of cells needed to encode an + interrupt source. Supported value is 1 +- interrupt-controller : So that its clear its an interrupt controller. +Optional properties +- reg : Not used yet, but will contain the interrupt mask address + +Example: + + intc: interrupt-controller { + compatible = marvell,orion-intc, marvell,intc; + interrupt-controller; + #interrupt-cells = 1; +reg = 0xfed20204 0x04, + 0xfed20214 0x04; +}; please fix whitespaces/tabs diff --git a/arch/arm/boot/dts/kirkwood.dtsi b/arch/arm/boot/dts/kirkwood.dtsi index 926528b..8eab7c4 100644 --- a/arch/arm/boot/dts/kirkwood.dtsi +++ b/arch/arm/boot/dts/kirkwood.dtsi @@ -2,6 +2,15 @@ / { compatible = mrvl,kirkwood; + interrupt-parent = intc; + + intc: interrupt-controller { + compatible = marvell,orion-intc, marvell,intc; + interrupt-controller; + #interrupt-cells = 1; +reg = 0xfed20204 0x04, + 0xfed20214 0x04; +}; ditto -- Michael -- To unsubscribe from this list: send the line unsubscribe linux-i2c in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 9/9] Kirkwood: Add basic device tree support for QNAP TS219.
Am Sonntag 10 Juni 2012, 12:32:01 schrieb Andrew Lunn: [..] +config MACH_TS219_DT + bool Device Tree for QNAP TS-110, TS-119, TS-119P+, TS-210, TS-219, TS-219P and TS-219P+ Turbo NAS + select ARCH_KIRKWOOD_DT + select ARM_APPENDED_DTB + select ARM_ATAG_DTB_COMPAT + help + Say 'Y' here if you want your kernel to support the QNAP + TS-110, TS-119, TS-119P+, TS-210, TS-219, TS-219P and + TS-219P+ Turbo NAS devices using Fattened Device Tree. + There are two different Device Tree descriptions, depending + on if the device is based on an if the board uses the MV6281 + or MV6282. If you have the wrong one, the buttons will not + work. + whitespace errors above -- Michael -- To unsubscribe from this list: send the line unsubscribe linux-i2c in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 8/9] ARM: Kirkwood: Add DT support for GPIO controllers
On 06/10/2012 05:32 AM, Andrew Lunn wrote: The GPIO controllers can now be described in DT. Origionally GPIO controllers were instantiated during IRQ setup. The origional none-DT code has been split out, and is only called if no DT GPIO controllers are found. Signed-off-by: Andrew Lunn and...@lunn.ch --- .../devicetree/bindings/gpio/mrvl-gpio.txt | 25 +++ arch/arm/boot/dts/kirkwood.dtsi| 20 ++ arch/arm/mach-kirkwood/irq.c | 20 -- arch/arm/plat-orion/gpio.c | 68 +++- arch/arm/plat-orion/include/plat/gpio.h|2 + 5 files changed, 126 insertions(+), 9 deletions(-) diff --git a/Documentation/devicetree/bindings/gpio/mrvl-gpio.txt b/Documentation/devicetree/bindings/gpio/mrvl-gpio.txt index 05428f3..d94ebc1 100644 --- a/Documentation/devicetree/bindings/gpio/mrvl-gpio.txt +++ b/Documentation/devicetree/bindings/gpio/mrvl-gpio.txt @@ -27,3 +27,28 @@ Example: interrupt-controller; #interrupt-cells = 1; }; + +* Marvell Orion GPIO Controller + +Required properties: +- compatible : Should be marvell,orion-gpio +- reg: Address and length of the register set for controller. +- gpio-controller: So we know this is a gpio controller. +- gpio-base : Number of first gpio pin. +- ngpio : How many gpios this controller has. +- secondary-irq-base : IRQ number base + +Optional properties: +- mask-offset: For SMP Orions, offset for Nth CPU + +Example: + + gpio0: gpio@10100 { + compatible = marvell,orion-gpio; + #gpio-cells = 2; + gpio-controller; + reg = 0x10100 0x40; + gpio-base = 0; + ngpio = 32; + secondary-irq-base = 64; This and gpio-base are wrong. The DT should describe h/w and these are Linux gpio and irq numbers. You need to create an irqdomain for the gpio controller. Rob + }; diff --git a/arch/arm/boot/dts/kirkwood.dtsi b/arch/arm/boot/dts/kirkwood.dtsi index 3091c01..6de66dc 100644 --- a/arch/arm/boot/dts/kirkwood.dtsi +++ b/arch/arm/boot/dts/kirkwood.dtsi @@ -18,6 +18,26 @@ #address-cells = 1; #size-cells = 1; + gpio0: gpio@10100 { + compatible = marvell,orion-gpio; + #gpio-cells = 2; + gpio-controller; + reg = 0x10100 0x40; + gpio-base = 0; + ngpio = 32; + secondary-irq-base = 64; + }; + + gpio1: gpio@10140 { + compatible = marvell,orion-gpio; + #gpio-cells = 2; + gpio-controller; + reg = 0x10140 0x40; + gpio-base = 32; + ngpio = 18; + secondary-irq-base = 96; + }; + serial@12000 { compatible = ns16550a; reg = 0x12000 0x100; diff --git a/arch/arm/mach-kirkwood/irq.c b/arch/arm/mach-kirkwood/irq.c index c4c68e5..81340c2 100644 --- a/arch/arm/mach-kirkwood/irq.c +++ b/arch/arm/mach-kirkwood/irq.c @@ -24,25 +24,33 @@ static void gpio_irq_handler(unsigned int irq, struct irq_desc *desc) orion_gpio_irq_handler((irq - IRQ_KIRKWOOD_GPIO_LOW_0_7) 3); } -void __init kirkwood_init_irq(void) +static void __init kirkwood_init_gpio(void) { - orion_irq_init(0, (void __iomem *)(IRQ_VIRT_BASE + IRQ_MASK_LOW_OFF)); - orion_irq_init(32, (void __iomem *)(IRQ_VIRT_BASE + IRQ_MASK_HIGH_OFF)); - /* * Initialize gpiolib for GPIOs 0-49. */ orion_gpio_init(0, 32, GPIO_LOW_VIRT_BASE, 0, IRQ_KIRKWOOD_GPIO_START); + orion_gpio_init(32, 18, GPIO_HIGH_VIRT_BASE, 0, + IRQ_KIRKWOOD_GPIO_START + 32); +} +void __init kirkwood_init_irq(void) +{ + orion_irq_init(0, (void __iomem *)(IRQ_VIRT_BASE + IRQ_MASK_LOW_OFF)); + orion_irq_init(32, (void __iomem *)(IRQ_VIRT_BASE + IRQ_MASK_HIGH_OFF)); + irq_set_chained_handler(IRQ_KIRKWOOD_GPIO_LOW_0_7, gpio_irq_handler); irq_set_chained_handler(IRQ_KIRKWOOD_GPIO_LOW_8_15, gpio_irq_handler); irq_set_chained_handler(IRQ_KIRKWOOD_GPIO_LOW_16_23, gpio_irq_handler); irq_set_chained_handler(IRQ_KIRKWOOD_GPIO_LOW_24_31, gpio_irq_handler); - orion_gpio_init(32, 18, GPIO_HIGH_VIRT_BASE, 0, - IRQ_KIRKWOOD_GPIO_START + 32); irq_set_chained_handler(IRQ_KIRKWOOD_GPIO_HIGH_0_7, gpio_irq_handler); irq_set_chained_handler(IRQ_KIRKWOOD_GPIO_HIGH_8_15, gpio_irq_handler); irq_set_chained_handler(IRQ_KIRKWOOD_GPIO_HIGH_16_23, gpio_irq_handler); + + /* Try initializing the GPIO