DT enablement for Snowball
Subsystems (7)
cover DT enablement for Snowball
Hopefully the penultimate large patch-stack for Snowball enablement. After that only bits and bobs will remain.
arch/arm/boot/dts/db8500.dtsi | 92 +++++++++++++++- arch/arm/boot/dts/snowball.dts | 3 + arch/arm/configs/u8500_defconfig | 3 + arch/arm/mach-ux500/Kconfig | 1 + arch/arm/mach-ux500/board-mop500.c | 55 +++------- drivers/i2c/busses/i2c-nomadik.c | 43 +++++++- drivers/mfd/Makefile | 5 +- drivers/mfd/ab8500-core.c | 176 ++++++++++++++++++++++++++----- drivers/mfd/ab8500-debugfs.c | 6 ++ drivers/mfd/ab8500-gpadc.c | 8 +- drivers/mfd/ab8500-i2c.c | 160 ---------------------------- drivers/regulator/ab8500.c | 204 +++++++++++++++++++++++++----------- 12 files changed, 457 insertions(+), 299 deletions(-)
PATCH 1/18 i2c: Add Device Tree support to the Nomadik I2C driver
Here we move the i2c-nomadik's default settings into the driver rather than specifying them from platform code. At the time of this writing we only have one user, the u8500. As new users are added, it is expected that they will be Device Tree compliant. If this is the case, we will look up their initialisation values by compatible entry, then apply them forthwith.
--- drivers/i2c/busses/i2c-nomadik.c | 40 +++++++++++++++++++++++++++++++++++++- 1 file changed, 39 insertions(+), 1 deletion(-)
drivers/i2c/busses/i2c-nomadik.c +39 -1
@@ -23,6 +23,7 @@#include <linux/io.h> #include <linux/regulator/consumer.h> #include <linux/pm_runtime.h> +#include <linux/of_device.h> #include <plat/i2c.h>
@@ -899,15 +900,51 @@ static const struct i2c_algorithm nmk_i2c_algo = { .functionality = nmk_i2c_functionality }; +static struct nmk_i2c_controller u8500_i2c = { +/* +* slave data setup time, which is +* 250 ns,100ns,10ns which is 14,6,2 +* respectively for a 48 Mhz +* i2c clock +*/ + .slsu =0xe , +/* Tx FIFO threshold */ + .tft =1 , +/* Rx FIFO threshold */ + .rft =8 , +/* std. mode operation */ + .clk_freq =100000 , +/* Slave response timeout(ms) */ + .timeout =200 , + .sm =I2C_FREQ_MODE_FAST , +}; + + +static const struct of_device_id nmk_gpio_match[] = { + { .compatible ="st,nomadik-i2c" , .data = &u8500_i2c, }, + {} +}; +static int __devinit nmk_i2c_probe (struct platform_device *pdev) {int ret =0 ;struct resource *res; -struct nmk_i2c_controller *pdata = +const struct nmk_i2c_controller *pdata = pdev->dev.platform_data; +const struct of_device_id *of_id = +of_match_device (nmk_gpio_match, &pdev->dev);struct nmk_i2c_dev *dev;struct i2c_adapter *adap; +if (!pdata) { +if (of_id && of_id->data) +/* Looks like we're booting via Device Tree. */ + pdata = of_id->data; +else +/* No i2c configuration found, using the default. */ + pdata = &u8500_i2c; + } + dev =kzalloc (sizeof (struct nmk_i2c_dev ),GFP_KERNEL );if (!dev) {dev_err (&pdev->dev,"cannot allocate memory\n" );
@@ -1044,6 +1081,7 @@ static struct platform_driver nmk_i2c_driver = { .owner = THIS_MODULE, .name = DRIVER_NAME, .pm = &nmk_i2c_pm, + .of_match_table = nmk_gpio_match, }, .probe = nmk_i2c_probe, .remove = __devexit_p(nmk_i2c_remove),
Signature · 1 line
1.7.9.5
Re: [PATCH 01/18] i2c: Add Device Tree support to the Nomadik I2C driver
Quoted 10 lines · Lee Jones
Here we move the i2c-nomadik's default settings into the driver rather than specifying them from platform code. At the time of this writing we only have one user, the u8500. As new users are added, it is expected that they will be Device Tree compliant. If this is the case, we will look up their initialisation values by compatible entry, then apply them forthwith.
Cc linux-i2c at vger.kernel.orgCc linux-kernel at vger.kernel.orgSigned-off-by Lee Jones <[email protected]>
Nice!
BTW: you want to CC Wolfram on the I2C patches.
Yours,
Linus Walleij
PATCH 2/18 ARM: ux500: Remove unused i2c platform_data initialisation code
In reply to Lee JonesNow that u5500 is obsolete, u8500 is the only user of the Nomadik i2c driver. As such there is no requirement to differentiate between initialisation values. By the time a new SoC is released, almost all of the ux500 platform will be DT:ed, so we can make decisions based on the compatible property instead.
--- arch/arm/mach-ux500/board-mop500.c | 39 ++++-------------------------------- drivers/i2c/busses/i2c-nomadik.c | 3 +-- 2 files changed, 5 insertions(+), 37 deletions(-)
arch/arm/mach-ux500/board-mop500.c +4 -35
@@ -330,43 +330,12 @@ static struct i2c_board_info __initdata mop500_i2c2_devices[] = { }, }; -#define U8500_I2C_CONTROLLER(id, _slsu, _tft, _rft, clk, t_out, _sm) \ -static struct nmk_i2c_controller u8500_i2c##id##_data = { \ - /* \ - * slave data setup time, which is \ - * 250 ns,100ns,10ns which is 14,6,2 \ - * respectively for a 48 Mhz \ - * i2c clock \ - */ \ - .slsu = _slsu, \ - /* Tx FIFO threshold */ \ - .tft = _tft, \ - /* Rx FIFO threshold */ \ - .rft = _rft, \ - /* std. mode operation */ \ - .clk_freq = clk, \ - /* Slave response timeout(ms) */\ - .timeout = t_out, \ - .sm = _sm, \ -} - -/* -* The board uses 4 i2c controllers, initialize all of -* them with slave data setup time of 250 ns, -* Tx & Rx FIFO threshold values as 8 and standard -* mode of operation -*/ -U8500_I2C_CONTROLLER (0 ,0xe ,1 ,8 ,100000 ,200 ,I2C_FREQ_MODE_FAST ); -U8500_I2C_CONTROLLER (1 ,0xe ,1 ,8 ,100000 ,200 ,I2C_FREQ_MODE_FAST ); -U8500_I2C_CONTROLLER (2 ,0xe ,1 ,8 ,100000 ,200 ,I2C_FREQ_MODE_FAST ); -U8500_I2C_CONTROLLER (3 ,0xe ,1 ,8 ,100000 ,200 ,I2C_FREQ_MODE_FAST ); -static void __init mop500_i2c_init (struct device *parent) { -db8500_add_i2c0 (parent, &u8500_i2c0_data); -db8500_add_i2c1 (parent, &u8500_i2c1_data); -db8500_add_i2c2 (parent, &u8500_i2c2_data); -db8500_add_i2c3 (parent, &u8500_i2c3_data); +db8500_add_i2c0 (parent,NULL ); +db8500_add_i2c1 (parent,NULL ); +db8500_add_i2c2 (parent,NULL ); +db8500_add_i2c3 (parent,NULL ); }static struct gpio_keys_button mop500_gpio_keys[] = {
drivers/i2c/busses/i2c-nomadik.c +1 -2
@@ -1002,8 +1002,7 @@ static int __devinit nmk_i2c_probe(struct platform_device *pdev) adap->owner =THIS_MODULE ; adap->class =I2C_CLASS_HWMON |I2C_CLASS_SPD ; adap->algo = &nmk_i2c_algo; - adap->timeout = pdata->timeout ?msecs_to_jiffies (pdata->timeout) : -msecs_to_jiffies (20000 ); + adap->timeout =msecs_to_jiffies (pdata->timeout);snprintf (adap->name,sizeof (adap->name),"Nomadik I2C%d at %lx" , pdev->id, (unsigned long )res->start);
Signature · 1 line
1.7.9.5
PATCH 3/18 ARM: ux500: Provide auxdata to be used as name base clock search for nmk-i2c
In reply to Lee JonesThis patch provides a way for find_clk() to complete its name-based searches and still find the nmk-i2c clocks. As Device Tree has a different naming structure to that of more traditional initialisation methods, find_clk() not succeed without these bindings.
--- arch/arm/mach-ux500/board-mop500.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
arch/arm/mach-ux500/board-mop500.c +5 -1
@@ -757,6 +757,11 @@ struct of_dev_auxdata u8500_auxdata_lookup[] __initdata = {OF_DEV_AUXDATA ("st,nomadik-gpio" ,0x8011e000 ,"gpio.6" ,NULL ),OF_DEV_AUXDATA ("st,nomadik-gpio" ,0x8011e080 ,"gpio.7" ,NULL ),OF_DEV_AUXDATA ("st,nomadik-gpio" ,0xa03fe000 ,"gpio.8" ,NULL ), +OF_DEV_AUXDATA ("st,nomadik-i2c" ,0x80004000 ,"nmk-i2c.0" ,NULL ), +OF_DEV_AUXDATA ("st,nomadik-i2c" ,0x80122000 ,"nmk-i2c.1" ,NULL ), +OF_DEV_AUXDATA ("st,nomadik-i2c" ,0x80128000 ,"nmk-i2c.2" ,NULL ), +OF_DEV_AUXDATA ("st,nomadik-i2c" ,0x80110000 ,"nmk-i2c.3" ,NULL ), + OF_DEV_AUXDATA("st,nomadik-i2c", 0x8012a000, "nmk-i2c.4", NULL), {}, };
@@ -838,7 +843,6 @@ static void __init u8500_init_machine(void)i2c_register_board_info (2 , mop500_i2c2_devices,ARRAY_SIZE (mop500_i2c2_devices)); } -mop500_i2c_init (parent);/* This board has full regulator constraints */ regulator_has_full_constraints ();
Signature · 1 line
1.7.9.5
PATCH 4/18 ARM: ux500: CONFIG: Compile in support for leds-gpio
In reply to Lee JonesCode exists in the mop500 board file (used for HREF and Snowball) to initialise Snowball's user LED via the leds-gpio driver. However, the driver isn't currently built when using the default configuration file. This patch aims to change that behavior.
--- arch/arm/configs/u8500_defconfig | 3 +++ arch/arm/mach-ux500/Kconfig | 1 + 2 files changed, 4 insertions(+)
arch/arm/configs/u8500_defconfig +3 -0
@@ -85,6 +85,9 @@ CONFIG_NEW_LEDS=y CONFIG_LEDS_CLASS=y CONFIG_LEDS_LM3530=y CONFIG_LEDS_LP5521=y +CONFIG_LEDS_GPIO=y +CONFIG_LEDS_TRIGGERS=y +CONFIG_LEDS_TRIGGER_HEARTBEAT=y CONFIG_RTC_CLASS=y CONFIG_RTC_DRV_AB8500=y CONFIG_RTC_DRV_PL031=y
arch/arm/mach-ux500/Kconfig +1 -0
@@ -41,6 +41,7 @@ config MACH_HREFV60 config MACH_SNOWBALL bool "U8500 Snowball platform" select MACH_MOP500 + select LEDS_GPIO help Include support for the snowball development platform.
Signature · 1 line
1.7.9.5
PATCH 5/18 ARM: ux500: Enable the user LED on Snowball via Device Tree
In reply to Lee JonesThis patch enables and illuminates the user_led on the Snowball low-cost development board using DT. It also removes initialisation carried out from platform code.
--- arch/arm/boot/dts/snowball.dts | 1 + arch/arm/mach-ux500/board-mop500.c | 3 +-- 2 files changed, 2 insertions(+), 2 deletions(-)
arch/arm/boot/dts/snowball.dts +1 -0
@@ -67,6 +67,7 @@ used-led { label = "user_led"; gpios = <&gpio4 14 0x4>; + default-state = "on"; }; };
arch/arm/mach-ux500/board-mop500.c +1 -2
@@ -600,7 +600,6 @@ static struct platform_device *snowball_platform_devs[] __initdata = { };static struct platform_device *snowball_of_platform_devs[]__initdata = { - &snowball_led_dev, &snowball_key_dev, &ab8500_device, };
@@ -814,7 +813,7 @@ static void __init u8500_init_machine(void)/* * Devices to be DT:ed: -* snowball_led_dev = todo +* snowball_led_dev = done * snowball_key_dev = todo * snowball_sbnet_dev = done * ab8500_device = todo
Signature · 1 line
1.7.9.5
PATCH 6/18 mfd: ab8500: Remove confusing ab8500-i2c file and merge into ab8500-core
In reply to Lee Jonesab8500-i2c is used as core code to register the ab8500 device. After allocating ab8500 memory, it immediately calls into ab8500-core where the real initialisation takes place. This patch moves all core registration and memory allocation into the true ab8500-core file and removes ab8500-i2c completely.
--- arch/arm/mach-ux500/board-mop500.c | 2 +- drivers/mfd/Makefile | 5 +- drivers/mfd/ab8500-core.c | 105 +++++++++++++++++++++-- drivers/mfd/ab8500-i2c.c | 160 ------------------------------------ 4 files changed, 103 insertions(+), 169 deletions(-) delete mode 100644 drivers/mfd/ab8500-i2c.c
arch/arm/mach-ux500/board-mop500.c +1 -1
@@ -205,7 +205,7 @@ static struct resource ab8500_resources[] = { };struct platform_device ab8500_device = { - .name ="ab8500-i2c" , + .name ="ab8500-core" , .id =0 , .dev = { .platform_data = &ab8500_platdata,
drivers/mfd/Makefile +2 -3
@@ -90,12 +90,11 @@ obj-$(CONFIG_PCF50633_GPIO) += pcf50633-gpio.o obj-$(CONFIG_ABX500_CORE) += abx500-core.o obj-$(CONFIG_AB3100_CORE) += ab3100-core.o obj-$(CONFIG_AB3100_OTP) += ab3100-otp.o -obj-$(CONFIG_AB8500_CORE) += ab8500-core.o ab8500-sysctrl.o obj-$(CONFIG_AB8500_DEBUG) += ab8500-debugfs.o obj-$(CONFIG_AB8500_GPADC) += ab8500-gpadc.o obj-$(CONFIG_MFD_DB8500_PRCMU) += db8500-prcmu.o -# ab8500-i2c need to come after db8500-prcmu (which provides the channel) -obj-$(CONFIG_AB8500_I2C_CORE) += ab8500-i2c.o +# ab8500-core needs to come after db8500-prcmu (which provides the channel) +obj-$(CONFIG_AB8500_CORE) += ab8500-core.o ab8500-sysctrl.o obj-$(CONFIG_MFD_TIMBERDALE) += timberdale.o obj-$(CONFIG_PMIC_ADP5520) += adp5520.o obj-$(CONFIG_LPC_SCH) += lpc_sch.o
drivers/mfd/ab8500-core.c +100 -5
168 lines not on this page · raw message
drivers/mfd/ab8500-i2c.c deleted +0 -160
160 lines not on this page · raw message
Signature · 1 line
1.7.9.5
PATCH 6/18 mfd: ab8500: Remove confusing ab8500-i2c file and merge into ab8500-core
Quoted 8 lines · Lee Jones
ab8500-i2c is used as core code to register the ab8500 device. After allocating ab8500 memory, it immediately calls into ab8500-core where the real initialisation takes place. This patch moves all core registration and memory allocation into the true ab8500-core file and removes ab8500-i2c completely.
Signed-off-by Lee Jones <[email protected]>---
(...)
Quoted 1 line
+static int
ab8500_i2c_write(struct ab8500 *ab8500, u16 addr, u8 data)
So what happened to the promised (optional as add-on) patch also renaming these functions to ab8500_prcmu_write() etc?
The reason I insist on not ACK:in on a "promise to fix later, really sure"-basis is exactly that these things tends to be forgotten ;-)
Yours,
Linus Walleij
PATCH 6/18 mfd: ab8500: Remove confusing ab8500-i2c file and merge into ab8500-core
Quoted 10 lines · Linus Walleij
Quoted 8 lines · Lee Jones
ab8500-i2c is used as core code to register the ab8500 device. After allocating ab8500 memory, it immediately calls into ab8500-core where the real initialisation takes place. This patch moves all core registration and memory allocation into the true ab8500-core file and removes ab8500-i2c completely.
Signed-off-by Lee Jones<[email protected]>---
Quoted 8 lines
(...)
Quoted 1 line
+static int
ab8500_i2c_write(struct ab8500 *ab8500, u16 addr, u8 data)So what happened to the promised (optional as add-on) patch also renaming these functions to
ab8500_prcmu_write()etc?The reason I insist on not ACK:in on a "promise to fix later, really sure"-basis is exactly that these things tends to be forgotten ;-)
I have not forgotten. It's the 2nd and 3rd entry on my TODO list:
- TODO
<snip>
- Clean-up (simplify) ab8500-core
- Change i2c_[read|write] to prcmu_[read|write] - COMMENTS in [PATCH 06/15]
</snip>
Everything on my TODO gets done. :)
Signature · 5 lines
Lee Jones Linaro ST-Ericsson Landing Team Lead M: +44 77 88 633 515 Linaro.org ? Open source software for ARM SoCs Follow Linaro: Facebook | Twitter | Blog
PATCH 7/18 ARM: ux500: PRCMU related configuration and layout corrections for Device Tree
In reply to Lee JonesApply db8500 related PRCMU Device Tree settings and clean up some formatting errors. We also remove one of the PRCMU assigned IRQs, as it is currently not used.
--- arch/arm/boot/dts/db8500.dtsi | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
arch/arm/boot/dts/db8500.dtsi +3 -2
@@ -187,12 +187,12 @@ prcmu at 80157000 { compatible = "stericsson,db8500-prcmu"; reg = <0x80157000 0x1000>; - interrupts = <46 47>; + interrupts = <0 47 0x4>; #address-cells = <1>; #size-cells = <1>; ranges; - prcmu-timer-4 at 80157450 { + prcmu-timer-4 at 80157450 { compatible = "stericsson,db8500-prcmu-timer-4"; reg = <0x80157450 0xC>; };
@@ -201,6 +201,7 @@ compatible = "stericsson,ab8500"; reg = <5>; /* mailbox 5 is i2c */ interrupts = <0 40 0x4>; + stericsson,irq-base = <520>; }; };
Signature · 1 line
1.7.9.5
PATCH 8/18 mfd: Enable Device Tree for ab8500-core driver
In reply to Lee JonesThis patch will allow the ab8500-core driver to be probed and set up when booting when Device Tree is enabled. This includes platform ID look-up which identifies the machine it is currently running on. If we are undergoing a DT enabled boot, we will refuse to setup each of the other ab8500-* devices, as they will be probed individually by DT.
--- drivers/mfd/ab8500-core.c | 73 +++++++++++++++++++++++++++++++-------------- 1 file changed, 51 insertions(+), 22 deletions(-)
drivers/mfd/ab8500-core.c +51 -22
@@ -20,6 +20,8 @@#include <linux/mfd/abx500/ab8500.h> #include <linux/mfd/dbx500-prcmu.h> #include <linux/regulator/ab8500.h> +#include <linux/of.h> +#include <linux/of_device.h> /* * Interrupt register offsets
@@ -1112,11 +1114,20 @@ static struct attribute_group ab9540_attr_group = { .attrs = ab9540_sysfs_entries, }; +static const struct of_device_id ab8500_match[] = { + { + .compatible ="stericsson,ab8500" , + .data = (void *)AB8500_VERSION_AB8500 , + }, + {}, +}; +static int __devinit ab8500_probe (struct platform_device *pdev) {struct ab8500_platform_data *plat =dev_get_platdata (&pdev->dev);const struct platform_device_id *platid =platform_get_device_id (pdev); -enum ab8500_version version = platid->driver_data; +enum ab8500_version version =AB8500_VERSION_UNDEFINED ; +struct device_node *np = pdev->dev.of_node;struct ab8500 *ab8500;struct resource *resource;int ret;
@@ -1129,6 +1140,14 @@ static int __devinit ab8500_probe(struct platform_device *pdev)if (plat) ab8500->irq_base = plat->irq_base; +else if (np) + ret =of_property_read_u32 (np,"stericsson,irq-base" , &ab8500->irq_base); + +if (!ab8500->irq_base) { +dev_info (&pdev->dev,"couldn't find irq-base\n" ); + ret = -EINVAL ; + goto out_free_ab8500; + } ab8500->dev = &pdev->dev;
@@ -1150,6 +1169,12 @@ static int __devinit ab8500_probe(struct platform_device *pdev)platform_set_drvdata (pdev, ab8500); +if (platid) + version = platid->driver_data; +else if (np) + version = (unsigned int ) +of_match_device (ab8500_match, &pdev->dev)->data; +if (version !=AB8500_VERSION_UNDEFINED ) ab8500->version = version;else {
@@ -1246,29 +1271,32 @@ static int __devinit ab8500_probe(struct platform_device *pdev) goto out_removeirq; } - ret =mfd_add_devices (ab8500->dev,0 , abx500_common_devs, -ARRAY_SIZE (abx500_common_devs),NULL , - ab8500->irq_base); - -if (ret) - goto out_freeirq; +if (!np) { + ret =mfd_add_devices (ab8500->dev,0 , abx500_common_devs, +ARRAY_SIZE (abx500_common_devs),NULL , + ab8500->irq_base); -if (is_ab9540 (ab8500)) - ret =mfd_add_devices (ab8500->dev,0 , ab9540_devs, -ARRAY_SIZE (ab9540_devs),NULL , - ab8500->irq_base); -else - ret =mfd_add_devices (ab8500->dev,0 , ab8500_devs, -ARRAY_SIZE (ab8500_devs),NULL , - ab8500->irq_base); - -if (is_ab9540 (ab8500) ||is_ab8505 (ab8500)) - ret =mfd_add_devices (ab8500->dev,0 , ab9540_ab8505_devs, -ARRAY_SIZE (ab9540_ab8505_devs),NULL , - ab8500->irq_base); +if (ret) + goto out_freeirq; + +if (is_ab9540 (ab8500)) + ret =mfd_add_devices (ab8500->dev,0 , ab9540_devs, +ARRAY_SIZE (ab9540_devs),NULL , + ab8500->irq_base); +else + ret =mfd_add_devices (ab8500->dev,0 , ab8500_devs, +ARRAY_SIZE (ab8500_devs),NULL , + ab8500->irq_base); +if (ret) + goto out_freeirq; -if (ret) - goto out_freeirq; +if (is_ab9540 (ab8500) ||is_ab8505 (ab8500)) + ret =mfd_add_devices (ab8500->dev,0 , ab9540_ab8505_devs, +ARRAY_SIZE (ab9540_ab8505_devs),NULL , + ab8500->irq_base); +if (ret) + goto out_freeirq; + }if (!no_bm) {/* Add battery management devices */
@@ -1338,6 +1366,7 @@ static struct platform_driver ab8500_core_driver = { .driver = { .name = "ab8500-core", .owner = THIS_MODULE, + .of_match_table = ab8500_match, }, .probe = ab8500_probe, .remove = __devexit_p(ab8500_remove),
Signature · 1 line
1.7.9.5
PATCH 9/18 regulator: ab8500: Split up probe() into manageable pieces
In reply to Lee Jonesab8500's probe() function is becoming quite large, so in the lead up to Device Tree enablement which will fork the thread of execution this patch splits it into 3 main areas; basic error checking will remain in probe(), but regulator register initialisation and regulator registration have been moved to their own functions which will be called in sequence by probe() and the DT equivalent.
--- drivers/regulator/ab8500.c | 150 +++++++++++++++++++++++++------------------- 1 file changed, 87 insertions(+), 63 deletions(-)
drivers/regulator/ab8500.c +87 -63
@@ -708,11 +708,92 @@ static struct ab8500_reg_init ab8500_reg_init[] = { REG_INIT(AB8500_REGUCTRLDISCH2, 0x04, 0x44, 0x16), }; +static __devinit int +ab8500_regulator_init_registers (struct platform_device *pdev,int id,int value) +{ +int err; + +if (value & ~ab8500_reg_init[id].mask) { +dev_err (&pdev->dev, +"Configuration error: value outside mask.\n" ); +return -EINVAL ; + } + + err =abx500_mask_and_set_register_interruptible ( + &pdev->dev, + ab8500_reg_init[id].bank, + ab8500_reg_init[id].addr, + ab8500_reg_init[id].mask, + value); +if (err <0 ) { +dev_err (&pdev->dev, +"Failed to initialize 0x%02x, 0x%02x.\n" , + ab8500_reg_init[id].bank, + ab8500_reg_init[id].addr); +return err; + } + +dev_vdbg (&pdev->dev, +"init: 0x%02x, 0x%02x, 0x%02x, 0x%02x\n" , + ab8500_reg_init[id].bank, + ab8500_reg_init[id].addr, + ab8500_reg_init[id].mask, + value); + +return 0 ; +} + +static __devinit int ab8500_regulator_register (struct platform_device *pdev, +struct regulator_init_data *init_data, +int id, +struct device_node *np) +{ +struct ab8500_regulator_info *info =NULL ; +struct regulator_config config = { }; +int err; + +/* assign per-regulator data */ + info = &ab8500_regulator_info[id]; + info->dev = &pdev->dev; + + config.dev = &pdev->dev; + config.init_data = init_data; + config.driver_data = info; + config.of_node = np; + +/* fix for hardware before ab8500v2.0 */ +if (abx500_get_chip_id (info->dev) <0x20 ) { +if (info->desc.id ==AB8500_LDO_AUX3 ) { + info->desc.n_voltages = +ARRAY_SIZE (ldo_vauxn_voltages); + info->voltages = ldo_vauxn_voltages; + info->voltages_len = +ARRAY_SIZE (ldo_vauxn_voltages); + info->voltage_mask =0xf ; + } + } + +/* register regulator with framework */ + info->regulator =regulator_register (&info->desc, &config); +if (IS_ERR (info->regulator)) { + err =PTR_ERR (info->regulator); +dev_err (&pdev->dev,"failed to register regulator %s\n" , + info->desc.name); +/* when we fail, un-register all earlier regulators */ +while (--id >=0 ) { + info = &ab8500_regulator_info[id]; +regulator_unregister (info->regulator); + } +return err; + } + +return 0 ; +} +static __devinit int ab8500_regulator_probe (struct platform_device *pdev) {struct ab8500 *ab8500 =dev_get_drvdata (pdev->dev.parent);struct ab8500_platform_data *pdata; -struct regulator_config config = { };int i, err;if (!ab8500) {
@@ -733,8 +814,7 @@ static __devinit int ab8500_regulator_probe(struct platform_device *pdev)/* initialize registers */ for (i =0 ; i < pdata->num_regulator_reg_init; i++) { -int id; -u8 value; +int id, value; id = pdata->regulator_reg_init[i].id; value = pdata->regulator_reg_init[i].value;
@@ -745,73 +825,17 @@ static __devinit int ab8500_regulator_probe(struct platform_device *pdev) "Configuration error: id outside range.\n");return -EINVAL ; } -if (value & ~ab8500_reg_init[id].mask) { -dev_err (&pdev->dev, -"Configuration error: value outside mask.\n" ); -return -EINVAL ; - } -/* initialize register */ - err =abx500_mask_and_set_register_interruptible (&pdev->dev, - ab8500_reg_init[id].bank, - ab8500_reg_init[id].addr, - ab8500_reg_init[id].mask, - value); -if (err <0 ) { -dev_err (&pdev->dev, -"Failed to initialize 0x%02x, 0x%02x.\n" , - ab8500_reg_init[id].bank, - ab8500_reg_init[id].addr); + err =ab8500_regulator_init_registers (pdev, id, value); +if (err <0 )return err; - } -dev_vdbg (&pdev->dev, -" init: 0x%02x, 0x%02x, 0x%02x, 0x%02x\n" , - ab8500_reg_init[id].bank, - ab8500_reg_init[id].addr, - ab8500_reg_init[id].mask, - value); }/* register all regulators */ for (i =0 ; i <ARRAY_SIZE (ab8500_regulator_info); i++) { -struct ab8500_regulator_info *info =NULL ; - -/* assign per-regulator data */ - info = &ab8500_regulator_info[i]; - info->dev = &pdev->dev; - - config.dev = &pdev->dev; - config.init_data = &pdata->regulator[i]; - config.driver_data = info; - -/* fix for hardware before ab8500v2.0 */ -if (abx500_get_chip_id (info->dev) <0x20 ) { -if (info->desc.id ==AB8500_LDO_AUX3 ) { - info->desc.n_voltages = -ARRAY_SIZE (ldo_vauxn_voltages); - info->voltages = ldo_vauxn_voltages; - info->voltages_len = -ARRAY_SIZE (ldo_vauxn_voltages); - info->voltage_mask =0xf ; - } - } - -/* register regulator with framework */ - info->regulator =regulator_register (&info->desc, &config); -if (IS_ERR (info->regulator)) { - err =PTR_ERR (info->regulator); -dev_err (&pdev->dev,"failed to register regulator %s\n" , - info->desc.name); -/* when we fail, un-register all earlier regulators */ -while (--i >=0 ) { - info = &ab8500_regulator_info[i]; -regulator_unregister (info->regulator); - } + err =ab8500_regulator_register (pdev, &pdata->regulator[i], i,NULL ); +if (err <0 )return err; - } - -dev_vdbg (rdev_get_dev (info->regulator), -"%s-probed\n" , info->desc.name); }return 0 ;
Signature · 1 line
1.7.9.5
Re: [PATCH 09/18] regulator: ab8500: Split up probe() into manageable pieces
Quoted 6 lines · Lee Jones
ab8500's
probe()function is becoming quite large, so in the lead up to Device Tree enablement which will fork the thread of execution this patch splits it into 3 main areas; basic error checking will remain inprobe(), but regulator register initialisation and regulator registration have been moved to their own functions which will be called in sequence byprobe()and the DT equivalent.
Applied, thanks.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20120518/f852959b/attachment.sig>
Re: [PATCH 09/18] regulator: ab8500: Split up probe() into manageable pieces
Quoted 9 lines · Mark Brown
Quoted 6 lines · Lee Jones
ab8500's
probe()function is becoming quite large, so in the lead up to Device Tree enablement which will fork the thread of execution this patch splits it into 3 main areas; basic error checking will remain inprobe(), but regulator register initialisation and regulator registration have been moved to their own functions which will be called in sequence byprobe()and the DT equivalent.Applied, thanks.
Thank you.
Signature · 5 lines
Lee Jones Linaro ST-Ericsson Landing Team Lead M: +44 77 88 633 515 Linaro.org ? Open source software for ARM SoCs Follow Linaro: Facebook | Twitter | Blog
Re: [PATCH 09/18] regulator: ab8500: Split up probe() into manageable pieces
In reply to Lee JonesQuoted 9 lines · Lee Jones
ab8500's
probe()function is becoming quite large, so in the lead up to Device Tree enablement which will fork the thread of execution this patch splits it into 3 main areas; basic error checking will remain inprobe(), but regulator register initialisation and regulator registration have been moved to their own functions which will be called in sequence byprobe()and the DT equivalent.Cc linux-kernel at vger.kernel.orgSigned-off-by Lee Jones <[email protected]>
Thanks to Mark for review and merge,
Linus Walleij
PATCH 10/18 ARM: ux500: Add support for ab8500 regulators into the Device Tree
In reply to Lee JonesHere we supply the information required to setup regulators successfully on Snowball and other db8500 variants which use the ab8500 regulators.
--- arch/arm/boot/dts/db8500.dtsi | 68 ++++++++++++++++++++++++++++++++++++++++ arch/arm/boot/dts/snowball.dts | 2 ++ 2 files changed, 70 insertions(+)
arch/arm/boot/dts/db8500.dtsi +68 -0
@@ -202,6 +202,74 @@ reg = <5>; /* mailbox 5 is i2c */ interrupts = <0 40 0x4>; stericsson,irq-base = <520>; + + ab8500-regulators { + compatible = "stericsson,ab8500-regulator"; + + // supplies to the display/camera + ab8500_ldo_aux1_reg: ab8500_ldo_aux1 { + regulator-name = "V-DISPLAY"; + regulator-min-microvolt = <2500000>; + regulator-max-microvolt = <2900000>; + regulator-boot-on; + /* BUG: If turned off MMC will be affected. */ + regulator-always-on; + }; + + // supplies to the on-board eMMC + ab8500_ldo_aux2_reg: ab8500_ldo_aux2 { + regulator-name = "V-eMMC1"; + regulator-min-microvolt = <1100000>; + regulator-max-microvolt = <3300000>; + }; + + // supply for VAUX3; SDcard slots + ab8500_ldo_aux3_reg: ab8500_ldo_aux3 { + regulator-name = "V-MMC-SD"; + regulator-min-microvolt = <1100000>; + regulator-max-microvolt = <3300000>; + }; + + // supply for v-intcore12; VINTCORE12 LDO + ab8500_ldo_initcore_reg: ab8500_ldo_initcore { + regulator-name = "V-INTCORE"; + }; + + // supply for tvout; gpadc; TVOUT LDO + ab8500_ldo_tvout_reg: ab8500_ldo_tvout { + regulator-name = "V-TVOUT"; + }; + + // supply for ab8500-usb; USB LDO + ab8500_ldo_usb_reg: ab8500_ldo_usb { + regulator-name = "dummy"; + }; + + // supply for ab8500-vaudio; VAUDIO LDO + ab8500_ldo_audio_reg: ab8500_ldo_audio { + regulator-name = "V-AUD"; + }; + + // supply for v-anamic1 VAMic1-LDO + ab8500_ldo_anamic1_reg: ab8500_ldo_anamic1 { + regulator-name = "V-AMIC1"; + }; + + // supply for v-amic2; VAMIC2 LDO; reuse constants for AMIC1 + ab8500_ldo_amamic2_reg: ab8500_ldo_amamic2 { + regulator-name = "V-AMIC2"; + }; + + // supply for v-dmic; VDMIC LDO + ab8500_ldo_dmic_reg: ab8500_ldo_dmic { + regulator-name = "V-DMIC"; + }; + + // supply for U8500 CSI/DSI; VANA LDO + ab8500_ldo_ana_reg: ab8500_ldo_ana { + regulator-name = "V-CSI/DSI"; + }; + }; }; };
arch/arm/boot/dts/snowball.dts +2 -0
@@ -94,6 +94,7 @@ arm,primecell-periphid = <0x10480180>; max-frequency = <50000000>; bus-width = <8>; + vmmc-supply = <&ab8500_ldo_aux3_reg>; mmc-cap-mmc-highspeed; cd-gpios = <&gpio6 26 0x4>; // 218
@@ -107,6 +108,7 @@ arm,primecell-periphid = <0x10480180>; max-frequency = <50000000>; bus-width = <8>; + vmmc-supply = <&ab8500_ldo_aux2_reg>; mmc-cap-mmc-highspeed; status = "okay";
Signature · 1 line
1.7.9.5
PATCH 11/18 regulator: Enable the ab8500 for Device Tree
In reply to Lee JonesHere we setup the ab8500 regulator driver for DT. We first do this in the normal way, by providing a match structure during initialisation, but then we provide information so that whilst probing we can use existing data structures to do DT look-ups.
--- drivers/regulator/ab8500.c | 54 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 54 insertions(+)
drivers/regulator/ab8500.c +54 -0
@@ -18,9 +18,12 @@#include <linux/platform_device.h> #include <linux/mfd/abx500.h> #include <linux/mfd/abx500/ab8500.h> +#include <linux/of.h> +#include <linux/regulator/of_regulator.h> #include <linux/regulator/driver.h> #include <linux/regulator/machine.h> #include <linux/regulator/ab8500.h> +#include <linux/slab.h> /** * struct ab8500_regulator_info - ab8500 regulator information
@@ -790,12 +793,57 @@ static __devinit int ab8500_regulator_register(struct platform_device *pdev,return 0 ; } +static struct of_regulator_match ab8500_regulator_matches[] = { + { .name ="LDO-AUX1" , .driver_data = (void *)AB8500_LDO_AUX1 , }, + { .name ="LDO-AUX2" , .driver_data = (void *)AB8500_LDO_AUX2 , }, + { .name ="LDO-AUX3" , .driver_data = (void *)AB8500_LDO_AUX3 , }, + { .name ="LDO-INTCORE" , .driver_data = (void *)AB8500_LDO_INTCORE , }, + { .name ="LDO-TVOUT" , .driver_data = (void *)AB8500_LDO_TVOUT , }, + { .name ="LDO-USB" , .driver_data = (void *)AB8500_LDO_USB , }, + { .name ="LDO-AUDIO" , .driver_data = (void *)AB8500_LDO_AUDIO , }, + { .name ="LDO-ANAMIC1" , .driver_data = (void *)AB8500_LDO_ANAMIC1 , }, + { .name ="LDO-ANAMIC2" , .driver_data = (void *)AB8500_LDO_ANAMIC2 , }, + { .name ="LDO-DMIC" , .driver_data = (void *)AB8500_LDO_DMIC , }, + { .name ="LDO-ANA" , .driver_data = (void *)AB8500_LDO_ANA , }, +}; + +static __devinit int +ab8500_regulator_of_probe (struct platform_device *pdev,struct device_node *np) +{ +int err, i; + +for (i =0 ; i <ARRAY_SIZE (ab8500_regulator_info); i++) { + err =ab8500_regulator_register ( + pdev, ab8500_regulator_matches[i].init_data, + i, ab8500_regulator_matches[i].of_node); +if (err) +return err; + } + +return 0 ; +} +static __devinit int ab8500_regulator_probe (struct platform_device *pdev) {struct ab8500 *ab8500 =dev_get_drvdata (pdev->dev.parent);struct ab8500_platform_data *pdata; +struct device_node *np = pdev->dev.of_node;int i, err; +if (np) { + err =of_regulator_match (&pdev->dev, np, + ab8500_regulator_matches, +ARRAY_SIZE (ab8500_regulator_matches)); +if (err <0 ) { +dev_err (&pdev->dev, +"Error parsing regulator init data: %d\n" , err); +return err; + } + + err =ab8500_regulator_of_probe (pdev, np); +return err; + } +if (!ab8500) {dev_err (&pdev->dev,"null mfd parent\n" );return -EINVAL ;
@@ -858,12 +906,18 @@ static __devexit int ab8500_regulator_remove(struct platform_device *pdev)return 0 ; } +static const struct of_device_id ab8500_regulator_match[] = { + { .compatible ="stericsson,ab8500-regulator" , }, + {} +}; +static struct platform_driver ab8500_regulator_driver = { .probe = ab8500_regulator_probe, .remove =__devexit_p (ab8500_regulator_remove), .driver = { .name ="ab8500-regulator" , .owner =THIS_MODULE , + .of_match_table = ab8500_regulator_match, }, };
Signature · 1 line
1.7.9.5
Re: [PATCH 11/18] regulator: Enable the ab8500 for Device Tree
Quoted 5 lines · Lee Jones
Here we setup the ab8500 regulator driver for DT. We first do this in the normal way, by providing a match structure during initialisation, but then we provide information so that whilst probing we can use existing data structures to do DT look-ups.
Applied, thanks. This and your previous patch look really good now!
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20120518/8656c2cf/attachment.sig>
Re: [PATCH 11/18] regulator: Enable the ab8500 for Device Tree
Quoted 8 lines · Mark Brown
Quoted 5 lines · Lee Jones
Here we setup the ab8500 regulator driver for DT. We first do this in the normal way, by providing a match structure during initialisation, but then we provide information so that whilst probing we can use existing data structures to do DT look-ups.
Applied, thanks. This and your previous patch look really good now!
Cheers Mark. Much obliged.
Signature · 5 lines
Lee Jones Linaro ST-Ericsson Landing Team Lead M: +44 77 88 633 515 Linaro.org ? Open source software for ARM SoCs Follow Linaro: Facebook | Twitter | Blog
Re: [PATCH 11/18] regulator: Enable the ab8500 for Device Tree
In reply to Lee JonesQuoted 8 lines · Lee Jones
Here we setup the ab8500 regulator driver for DT. We first do this in the normal way, by providing a match structure during initialisation, but then we provide information so that whilst probing we can use existing data structures to do DT look-ups.
Cc linux-kernel at vger.kernel.orgSigned-off-by Lee Jones <[email protected]>
& thanks to Mark for merging.
Thanks!
Linus Walleij
PATCH 12/18 ARM: ux500: Disable platform setup of the ab8500 when DT is enabled
In reply to Lee JonesThe final piece of the ab8500 puzzle. Here we prevent any of the ab8500-* drivers from being registered from platform code when Device Tree is enabled, as we expect DT do probe each of these individually. We also provide the relevant compatible strings, so that DT knows which nodes it needs to pay attention to during population.
--- arch/arm/mach-ux500/board-mop500.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
arch/arm/mach-ux500/board-mop500.c +3 -2
@@ -601,7 +601,6 @@ static struct platform_device *snowball_platform_devs[] __initdata = {static struct platform_device *snowball_of_platform_devs[]__initdata = { &snowball_key_dev, - &ab8500_device, };static void __init mop500_init_machine (void )
@@ -767,6 +766,9 @@ struct of_dev_auxdata u8500_auxdata_lookup[] __initdata = {static const struct of_device_id u8500_local_bus_nodes[] = {/* only create devices below soc node */ { .compatible ="stericsson,db8500" , }, + { .compatible ="stericsson,db8500-prcmu" , }, + { .compatible ="stericsson,ab8500" , }, + { .compatible ="stericsson,ab8500-regulator" , }, { .compatible ="simple-bus" }, { }, };
@@ -802,7 +804,6 @@ static void __init u8500_init_machine(void) ARRAY_SIZE(mop500_platform_devs));mop500_sdi_init (parent); - i2c0_devs =ARRAY_SIZE (mop500_i2c0_devices);i2c_register_board_info (0 , mop500_i2c0_devices, i2c0_devs); i2c_register_board_info(2, mop500_i2c2_devices,
Signature · 1 line
1.7.9.5
PATCH 12/18 ARM: ux500: Disable platform setup of the ab8500 when DT is enabled
Quoted 9 lines · Lee Jones
arch/arm/mach-ux500/board-mop500.c +0
-1@@ -601,7 +601,6 @@ static struct platform_device *snowball_platform_devs[] __initdata = {static struct platform_device *snowball_of_platform_devs[]__initdata = { &snowball_key_dev, - &ab8500_device, };static void __init mop500_init_machine (void )
arch/arm/mach-ux500/board-mop500.c struct of_dev_auxdata u8500_auxdata_lookup[] __initdata = { · line 774
Quoted 9 lines
arch/arm/mach-ux500/board-mop500.c +3
-0@@ -767,6 +766,9 @@ struct of_dev_auxdata u8500_auxdata_lookup[] __initdata = {static const struct of_device_id u8500_local_bus_nodes[] = {/* only create devices below soc node */ { .compatible ="stericsson,db8500" , }, + { .compatible ="stericsson,db8500-prcmu" , }, + { .compatible ="stericsson,ab8500" , }, + { .compatible ="stericsson,ab8500-regulator" , }, { .compatible ="simple-bus" }, { }, };
You remove the ab8500_device registration from snowball but add the prcmu and ab8500 in a place that is common to all three machines, so they will show up twice on mop500 and hrefv60. If those two are not broken before this patch, I think they are after it.
I think the two options you have here are to either remove the ab8500 device from mop500_platform_devs[] too (essentially registering mop500_gpio_keys_device and ab8500_device separately when you need them, instead of doing the loop), or to split u8500_local_bus_nodes so you use a different table for snowball from the one you use for the other boards.
Arnd
PATCH 12/18 ARM: ux500: Disable platform setup of the ab8500 when DT is enabled
Quoted 25 lines · Arnd Bergmann
Quoted 9 lines · Lee Jones
arch/arm/mach-ux500/board-mop500.c +0
-1@@ -601,7 +601,6 @@ static struct platform_device *snowball_platform_devs[] __initdata = {static struct platform_device *snowball_of_platform_devs[]__initdata = { &snowball_key_dev, -&ab8500_device, };static void __init mop500_init_machine (void )arch/arm/mach-ux500/board-mop500.c struct of_dev_auxdata u8500_auxdata_lookup[] __initdata = { · line 774
Quoted 9 lines
arch/arm/mach-ux500/board-mop500.c +3
-0@@ -767,6 +766,9 @@ struct of_dev_auxdata u8500_auxdata_lookup[] __initdata = {static const struct of_device_id u8500_local_bus_nodes[] = {/* only create devices below soc node */ { .compatible ="stericsson,db8500" , }, + { .compatible ="stericsson,db8500-prcmu" , }, + { .compatible ="stericsson,ab8500" , }, + { .compatible ="stericsson,ab8500-regulator" , }, { .compatible ="simple-bus" }, { }, };You remove the
ab8500_deviceregistration from snowball but add the prcmu and ab8500 in a place that is common to all three machines, so they will show up twice on mop500 and hrefv60. If those two are not broken before this patch, I think they are after it.
Quoted 5 lines
I think the two options you have here are to either remove the ab8500 device from mop500_platform_devs[] too (essentially registering
mop500_gpio_keys_deviceandab8500_deviceseparately when you need them, instead of doing the loop), or to splitu8500_local_bus_nodesso you use a different table for snowball from the one you use for the other boards.
It's late here, so if I have the wrong end of the stick, just tell me ..
I figure that at the same time as enabling the other machines we'll be stripping out the platform registrations in the same way as be have done with Snowball. This will prevent two of anything from being registered at any time.
Or am I mistaken?
Signature · 5 lines
Lee Jones Linaro ST-Ericsson Landing Team Lead M: +44 77 88 633 515 Linaro.org ? Open source software for ARM SoCs Follow Linaro: Facebook | Twitter | Blog
PATCH 12/18 ARM: ux500: Disable platform setup of the ab8500 when DT is enabled
Quoted 6 lines · Lee Jones
Quoted 5 lines
I think the two options you have here are to either remove the ab8500 device from mop500_platform_devs[] too (essentially registering
mop500_gpio_keys_deviceandab8500_deviceseparately when you need them, instead of doing the loop), or to splitu8500_local_bus_nodesso you use a different table for snowball from the one you use for the other boards.
Quoted 8 lines
It's late here, so if I have the wrong end of the stick, just tell me ..
I figure that at the same time as enabling the other machines we'll be stripping out the platform registrations in the same way as be have done with Snowball. This will prevent two of anything from being registered at any time.
Or am I mistaken?
Well, as far as I can tell, you duplicated a lot of functions or data structures so you can remove the parts one by one, but when you duplicated snowball_platform_devs[] you did not also duplicate mop500_platform_devs[].
Arnd
PATCH 12/18 ARM: ux500: Disable platform setup of the ab8500 when DT is enabled
Quoted 14 lines · Arnd Bergmann
Quoted 13 lines · Lee Jones
Quoted 5 lines
I think the two options you have here are to either remove the ab8500 device from mop500_platform_devs[] too (essentially registering
mop500_gpio_keys_deviceandab8500_deviceseparately when you need them, instead of doing the loop), or to splitu8500_local_bus_nodesso you use a different table for snowball from the one you use for the other boards.It's late here, so if I have the wrong end of the stick, just tell me ..
I figure that at the same time as enabling the other machines we'll be stripping out the platform registrations in the same way as be have done with Snowball. This will prevent two of anything from being registered at any time.
Quoted 6 lines
Quoted 1 line
Or am I mistaken?
Well, as far as I can tell, you duplicated a lot of functions or data structures so you can remove the parts one by one, but when you duplicated snowball_platform_devs[] you did not also duplicate mop500_platform_devs[].
That's true, but why would I have done? I would think that whoever writes the DT for that platform would do that?
So I see four ways round this: 1) disable all the nodes in db8500.dtsi and force snowball.dts and mop500.dts et. al to re-enable them as appropriate. 2) duplicate mop500_platform_devs[] for DT booting and strip out the ab8500 entry, essentially only leaving in only mop500_gpio_keys_device, 3) DT gpio-keys for the mop500 and do away with platform_add()ing mop500_platform_devs[] in u8500_init_machine() altogether. Or my personal favorite 4) as there is no DT or compatible entry for st-ericsson,mop500 or st-ericsson,hrefv60+ yet, don't worry about it and let whoever enables DT for those platforms (me?) to deal with at a later date.
Signature · 5 lines
Lee Jones Linaro ST-Ericsson Landing Team Lead M: +44 77 88 633 515 Linaro.org ? Open source software for ARM SoCs Follow Linaro: Facebook | Twitter | Blog
PATCH 12/18 ARM: ux500: Disable platform setup of the ab8500 when DT is enabled
Quoted 7 lines · Lee Jones
Quoted 4 lines
Well, as far as I can tell, you duplicated a lot of functions or data structures so you can remove the parts one by one, but when you duplicated snowball_platform_devs[] you did not also duplicate mop500_platform_devs[].
That's true, but why would I have done? I would think that whoever writes the DT for that platform would do that?
In order to not break them when you add the nodes to their device tree? ;-)
Quoted 10 lines
So I see four ways round this: 1) disable all the nodes in
db8500.dtsiand forcesnowball.dtsandmop500.dtset. al to re-enable them as appropriate. 2) duplicate mop500_platform_devs[] for DT booting and strip out the ab8500 entry, essentially only leaving in onlymop500_gpio_keys_device, 3) DT gpio-keys for the mop500 and do away with platform_add()ing mop500_platform_devs[] inu8500_init_machine()altogether. Or my personal favorite 4) as there is no DT or compatible entry for st-ericsson,mop500 or st-ericsson,hrefv60+ yet, don't worry about it and let whoever enables DT for those platforms (me?) to deal with at a later date.
Well, you've got a point there that no device tree has been written yet for those boards. I think my preference would be 2), since you can do that in a way that actually removes code (see below), but it's also fine if you want to leave it as is for now.
Arnd
arch/arm/mach-ux500/board-mop500.c +3 -7
@@ -806,8 +806,7 @@ static void __init u8500_init_machine(void) parent =u8500_init_devices (); -for (i =0 ; i <ARRAY_SIZE (mop500_platform_devs); i++) - mop500_platform_devs[i]->dev.parent = parent; + mop500_gpio_keys_device.parent = parent;for (i =0 ; i <ARRAY_SIZE (snowball_platform_devs); i++) snowball_platform_devs[i]->dev.parent = parent;
@@ -816,9 +815,7 @@ static void __init u8500_init_machine(void)if (of_machine_is_compatible ("st-ericsson,mop500" )) { mop500_gpio_keys[0 ].gpio =GPIO_PROX_SENSOR ; - -platform_add_devices (mop500_platform_devs, -ARRAY_SIZE (mop500_platform_devs)); +platform_device_register (&mop500_gpio_keys_device);mop500_sdi_init (parent);
@@ -839,8 +836,7 @@ static void __init u8500_init_machine(void)* instead. */ mop500_gpio_keys[0 ].gpio =HREFV60_PROX_SENSE_GPIO ; -platform_add_devices (mop500_platform_devs, -ARRAY_SIZE (mop500_platform_devs)); +platform_device_register (&mop500_gpio_keys_device);hrefv60_sdi_init (parent);
PATCH 12/18 ARM: ux500: Disable platform setup of the ab8500 when DT is enabled
Quoted 55 lines · Arnd Bergmann
Quoted 7 lines · Lee Jones
Quoted 4 lines
Well, as far as I can tell, you duplicated a lot of functions or data structures so you can remove the parts one by one, but when you duplicated snowball_platform_devs[] you did not also duplicate mop500_platform_devs[].
That's true, but why would I have done? I would think that whoever writes the DT for that platform would do that?
In order to not break them when you add the nodes to their device tree? ;-)
Quoted 10 lines
So I see four ways round this: 1) disable all the nodes in
db8500.dtsiand forcesnowball.dtsandmop500.dtset. al to re-enable them as appropriate. 2) duplicate mop500_platform_devs[] for DT booting and strip out the ab8500 entry, essentially only leaving in onlymop500_gpio_keys_device, 3) DT gpio-keys for the mop500 and do away with platform_add()ing mop500_platform_devs[] inu8500_init_machine()altogether. Or my personal favorite 4) as there is no DT or compatible entry for st-ericsson,mop500 or st-ericsson,hrefv60+ yet, don't worry about it and let whoever enables DT for those platforms (me?) to deal with at a later date.Well, you've got a point there that no device tree has been written yet for those boards. I think my preference would be 2), since you can do that in a way that actually removes code (see below), but it's also fine if you want to leave it as is for now.
Arnd
arch/arm/mach-ux500/board-mop500.c +2
-5@@ -806,8 +806,7 @@ static void __init u8500_init_machine(void) parent =u8500_init_devices (); -for (i =0 ; i<ARRAY_SIZE (mop500_platform_devs); i++) - mop500_platform_devs[i]->dev.parent = parent; + mop500_gpio_keys_device.parent = parent;for (i =0 ; i<ARRAY_SIZE (snowball_platform_devs); i++) snowball_platform_devs[i]->dev.parent = parent;@@ -816,9 +815,7 @@ static void __init u8500_init_machine(void)if (of_machine_is_compatible ("st-ericsson,mop500" )) { mop500_gpio_keys[0 ].gpio =GPIO_PROX_SENSOR ; - -platform_add_devices (mop500_platform_devs, -ARRAY_SIZE (mop500_platform_devs)); +platform_device_register (&mop500_gpio_keys_device);mop500_sdi_init (parent);
arch/arm/mach-ux500/board-mop500.c static void __init u8500_init_machine(void) · line 841
Quoted 8 lines
arch/arm/mach-ux500/board-mop500.c +1
-2@@ -839,8 +836,7 @@ static void __init u8500_init_machine(void)* instead. */ mop500_gpio_keys[0 ].gpio =HREFV60_PROX_SENSE_GPIO ; -platform_add_devices (mop500_platform_devs, -ARRAY_SIZE (mop500_platform_devs)); +platform_device_register (&mop500_gpio_keys_device);hrefv60_sdi_init (parent);
This is nice. Can I leave it for a now and submit this with the rest of my clean-ups? I have a nice TODO list now that this would fit nicely into. The way I see it, as long as this is submitted before we add a mop500.dts then it's not going to cause anyone issues.
Signature · 5 lines
Lee Jones Linaro ST-Ericsson Landing Team Lead M: +44 77 88 633 515 Linaro.org ? Open source software for ARM SoCs Follow Linaro: Facebook | Twitter | Blog
PATCH 12/18 ARM: ux500: Disable platform setup of the ab8500 when DT is enabled
Quoted 4 lines · Lee Jones
This is nice. Can I leave it for a now and submit this with the rest of my clean-ups? I have a nice TODO list now that this would fit nicely into. The way I see it, as long as this is submitted before we add a
mop500.dtsthen it's not going to cause anyone issues.
Yes, fine with me. I was thinking you'd fold it into the patch we are commenting on, but if that's problematic, just add it to the end of your queue.
Arnd
PATCH 13/18 ARM: ux500: Apply ab8500-debug node do the db8500 DT structure
In reply to Lee JonesThis node has no properties. It merely allows probing of the ab8500-debugfs driver during Device Tree initialisation.
--- arch/arm/boot/dts/db8500.dtsi | 4 ++++ 1 file changed, 4 insertions(+)
arch/arm/boot/dts/db8500.dtsi +4 -0
@@ -203,6 +203,10 @@ interrupts = <0 40 0x4>; stericsson,irq-base = <520>; + ab8500-debugfs { + compatible = "stericsson,ab8500-debug"; + }; + ab8500-regulators { compatible = "stericsson,ab8500-regulator";
Signature · 1 line
1.7.9.5
PATCH 13/18 ARM: ux500: Apply ab8500-debug node do the db8500 DT structure
Quoted 4 lines · Lee Jones
This node has no properties. It merely allows probing of the ab8500-debugfs driver during Device Tree initialisation.
Signed-off-by Lee Jones <[email protected]>
Thanks,
Linus Walleij
PATCH 14/18 mfd: Enable ab8500-debug when Device Tree is enabled
In reply to Lee JonesAllow the ab8500-debugfs driver to be probed during DT start-up.
--- drivers/mfd/ab8500-debugfs.c | 6 ++++++ 1 file changed, 6 insertions(+)
drivers/mfd/ab8500-debugfs.c +6 -0
@@ -608,10 +608,16 @@ static int __devexit ab8500_debug_remove(struct platform_device *plf)return 0 ; } +static const struct of_device_id ab8500_debug_match[] = { + { .compatible ="stericsson,ab8500-debug" , }, + {} +}; +static struct platform_driver ab8500_debug_driver = { .driver = { .name ="ab8500-debug" , .owner =THIS_MODULE , + .of_match_table = ab8500_debug_match, }, .probe = ab8500_debug_probe, .remove =__devexit_p (ab8500_debug_remove)
Signature · 1 line
1.7.9.5
PATCH 14/18 mfd: Enable ab8500-debug when Device Tree is enabled
Quoted 3 lines · Lee Jones
Allow the ab8500-debugfs driver to be probed during DT start-up.
Signed-off-by Lee Jones <[email protected]>
Thanks,
Linus Walleij
PATCH 15/18 mfd: Prevent unassigned pointer from being used in ab8500-gpadc driver
In reply to Lee JonesBefore this patch if probe failed to find the platform IRQ it would attempt to print a message out using dev_err, which in turn was being passed an unassigned pointer. This patch ensures the information passed to dev_err is correct.
--- drivers/mfd/ab8500-gpadc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/mfd/ab8500-gpadc.c +1 -1
@@ -584,7 +584,7 @@ static int __devinit ab8500_gpadc_probe(struct platform_device *pdev) gpadc->irq =platform_get_irq_byname (pdev,"SW_CONV_END" );if (gpadc->irq <0 ) { -dev_err (gpadc->dev,"failed to get platform irq-%d\n" , +dev_err (&pdev->dev,"failed to get platform irq-%d\n" , gpadc->irq); ret = gpadc->irq; goto fail;
Signature · 1 line
1.7.9.5
PATCH 15/18 mfd: Prevent unassigned pointer from being used in ab8500-gpadc driver
Quoted 6 lines · Lee Jones
Before this patch if probe failed to find the platform IRQ it would attempt to print a message out using
dev_err, which in turn was being passed an unassigned pointer. This patch ensures the information passed todev_erris correct.Signed-off-by Lee Jones <[email protected]>
Thanks,
Linus Walleij
PATCH 16/18 ARM: ux500: Add a ab8500-gpadc node to the db8500 Device Tree
In reply to Lee JonesThis patch provides support for the ab8500-gpadc driver.
--- arch/arm/boot/dts/db8500.dtsi | 8 ++++++++ 1 file changed, 8 insertions(+)
arch/arm/boot/dts/db8500.dtsi +8 -0
@@ -207,6 +207,14 @@ compatible = "stericsson,ab8500-debug"; }; + ab8500-gpadc { + compatible = "stericsson,ab8500-gpadc"; + interrupts = <0 32 0x4 + 0 39 0x4>; + interrupt-names = "HW_CONV_END", "SW_CONV_END"; + vddadc-supply = <&ab8500_ldo_tvout_reg>; + }; + ab8500-regulators { compatible = "stericsson,ab8500-regulator";
Signature · 1 line
1.7.9.5
PATCH 16/18 ARM: ux500: Add a ab8500-gpadc node to the db8500 Device Tree
Quoted 3 lines · Lee Jones
This patch provides support for the ab8500-gpadc driver.
Signed-off-by Lee Jones <[email protected]>
Yours,
Linus Walleij
PATCH 17/18 mfd: Enable ab8500-gpadc driver for Device Tree
In reply to Lee JonesThis patch will allow the ab8500-gpadc driver to be probed during Device Tree enabled boot.
--- drivers/mfd/ab8500-gpadc.c | 6 ++++++ 1 file changed, 6 insertions(+)
drivers/mfd/ab8500-gpadc.c +6 -0
@@ -648,12 +648,18 @@ static int __devexit ab8500_gpadc_remove(struct platform_device *pdev)return 0 ; } +static const struct of_device_id ab8500_gpadc_match[] = { + { .compatible ="stericsson,ab8500-gpadc" , }, + {} +}; +static struct platform_driver ab8500_gpadc_driver = { .probe = ab8500_gpadc_probe, .remove =__devexit_p (ab8500_gpadc_remove), .driver = { .name ="ab8500-gpadc" , .owner =THIS_MODULE , + .of_match_table = ab8500_gpadc_match, }, };
Signature · 1 line
1.7.9.5
PATCH 17/18 mfd: Enable ab8500-gpadc driver for Device Tree
Quoted 4 lines · Lee Jones
This patch will allow the ab8500-gpadc driver to be probed during Device Tree enabled boot.
Signed-off-by Lee Jones <[email protected]>
Thanks,
Linus Walleij
PATCH 18/18 ARM: ux500: Add support for input/ponkey into the db8500's Device Tree
In reply to Lee Jones--- arch/arm/boot/dts/db8500.dtsi | 7 +++++++ 1 file changed, 7 insertions(+)
arch/arm/boot/dts/db8500.dtsi +7 -0
@@ -215,6 +215,13 @@ vddadc-supply = <&ab8500_ldo_tvout_reg>; }; + ab8500-ponkey { + compatible = "stericsson,ab8500-ponkey"; + interrupts = <0 6 0x4 + 0 7 0x4>; + interrupt-names = "ONKEY_DBF", "ONKEY_DBR"; + }; + ab8500-regulators { compatible = "stericsson,ab8500-regulator";
Signature · 1 line
1.7.9.5
PATCH 18/18 ARM: ux500: Add support for input/ponkey into the db8500's Device Tree
Quoted 4 lines · Lee Jones
Signed-off-by Lee Jones <[email protected]>---
?arch/arm/boot/dts/db8500.dtsi | ? ?7 +++++++
?1 file changed, 7 insertions(+)
Thanks,
Linus Walleij
cover DT enablement for Snowball
In reply to Lee JonesQuoted 2 lines · Lee Jones
Hopefully the penultimate large patch-stack for Snowball enablement. After that only bits and bobs will remain.
Hi Lee,
I'm quite happy with the series overall, but it's really late for v3.5 now, and I can't really judge the quality of the regulator changes. If LinusW, Mark, Grant and Olof are all ok with this series, I think we can add it in as a late branch for the 3.5 merge window. If there are serious objections I think we should do it for 3.6 instead.
I've commented on one patch that looks wrong to me, but it won't be hard to fix that.
Arnd
cover DT enablement for Snowball
Quoted 5 lines · Arnd Bergmann
I'm quite happy with the series overall, but it's really late for v3.5 now, and I can't really judge the quality of the regulator changes. If LinusW, Mark, Grant and Olof are all ok with this series, I think we can add it in as a late branch for the 3.5 merge window. If there are serious objections I think we should do it for 3.6 instead.
I was just going to apply the regulator changes tomorrow morning (not
the DT updates, just the drivers/regulator bits), I'd mostly been
holding off to give Linus a chance to ack.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20120517/1dfce0ff/attachment.sig>
cover DT enablement for Snowball
Quoted 7 lines · Mark Brown
Quoted 5 lines · Arnd Bergmann
I'm quite happy with the series overall, but it's really late for v3.5 now, and I can't really judge the quality of the regulator changes. If LinusW, Mark, Grant and Olof are all ok with this series, I think we can add it in as a late branch for the 3.5 merge window. If there are serious objections I think we should do it for 3.6 instead.
I will work though your comments first thing.
Quoted 3 lines
I was just going to apply the regulator changes tomorrow morning (not the DT updates, just the
drivers/regulatorbits), I'd mostly been holding off to give Linus a chance to ack.
Thanks Mark.
They should be orthogonal to each other, so shouldn't require the DT updates straight away. Hopefully Linus will be round to it tomorrow. He's usually fairly efficient.
Signature · 5 lines
Lee Jones Linaro ST-Ericsson Landing Team Lead M: +44 77 88 633 515 Linaro.org ? Open source software for ARM SoCs Follow Linaro: Facebook | Twitter | Blog
cover DT enablement for Snowball
In reply to Lee JonesHi Lee,
Quoted 16 lines · Lee Jones
Hopefully the penultimate large patch-stack for Snowball enablement. After that only bits and bobs will remain.
arch/arm/boot/dts/db8500.dtsi | 92 +++++++++++++++- arch/arm/boot/dts/snowball.dts | 3 + arch/arm/configs/u8500_defconfig | 3 + arch/arm/mach-ux500/Kconfig | 1 + arch/arm/mach-ux500/board-mop500.c | 55 +++------- drivers/i2c/busses/i2c-nomadik.c | 43 +++++++- drivers/mfd/Makefile | 5 +- drivers/mfd/ab8500-core.c | 176 ++++++++++++++++++++++++++----- drivers/mfd/ab8500-debugfs.c | 6 ++ drivers/mfd/ab8500-gpadc.c | 8 +- drivers/mfd/ab8500-i2c.c | 160 ---------------------------- drivers/regulator/ab8500.c | 204 +++++++++++++++++++++++++----------- 12 files changed, 457 insertions(+), 299 deletions(-)
All mfd patches (6, 8, 14, 15 and 17) applied, thanks.
Cheers,
Samuel.
Signature · 2 lines
Intel Open Source Technology Centre http://oss.intel.com/