cbus: add of_match_table
Subsystems (4)
PATCH 1/4 cbus: add of_match_table
then we can make DeviceTree conversion happen.
--- drivers/cbus/retu.c | 9 +++++++++ drivers/cbus/tahvo.c | 10 ++++++++++ 2 files changed, 19 insertions(+), 0 deletions(-)
drivers/cbus/retu.c +9 -0
@@ -522,11 +522,20 @@ static int __devexit retu_remove(struct platform_device *pdev)return 0 ; } +static const struct of_device_id retu_match_table[]__devinitconst = { + { + .compatible ="nokia,retu" , + }, + {}, +}; +MODULE_DEVICE_TABLE (of, retu_match); +static struct platform_driver retu_driver = { .probe = retu_probe, .remove =__devexit_p (retu_remove), .driver = { .name ="retu" , + .of_match_table = retu_match_table, }, };
drivers/cbus/tahvo.c +10 -0
@@ -395,11 +395,21 @@ static int __devexit tahvo_remove(struct platform_device *pdev)return 0 ; } + +static const struct of_device_id tahvo_match_table[]__devinitconst = { + { + .compatible ="nokia,tahvo" , + }, + {}, +}; +MODULE_DEVICE_TABLE (of, tahvo_match); +static struct platform_driver tahvo_driver = { .probe = tahvo_probe, .remove =__devexit_p (tahvo_remove), .driver = { .name ="tahvo" , + .of_match_table = tahvo_match_table, }, };
Signature · 1 line
1.7.7
PATCH 2/4 cbus: retu: no need to pass devid via pdata
that's a constant, which will never change.
--- drivers/cbus/retu.c | 8 ++------ 1 files changed, 2 insertions(+), 6 deletions(-)
drivers/cbus/retu.c +2 -6
@@ -46,8 +46,6 @@ struct retu {struct mutex mutex;struct device *dev; -int devid; -int irq_base;int irq_end;
@@ -71,7 +69,7 @@ static struct retu *the_retu;*/ static int __retu_read_reg (struct retu *retu,unsigned reg) { -return cbus_read_reg (retu->dev, retu->devid, reg); +return cbus_read_reg (retu->dev,CBUS_RETU_DEVICE_ID , reg); }/**
@@ -82,7 +80,7 @@ static int __retu_read_reg(struct retu *retu, unsigned reg)*/ static void __retu_write_reg (struct retu *retu,unsigned reg,u16 val) { -cbus_write_reg (retu->dev, retu->devid, reg, val); +cbus_write_reg (retu->dev,CBUS_RETU_DEVICE_ID , reg, val); }/**
@@ -430,7 +428,6 @@ static int retu_allocate_children(struct device *parent, int irq_base)static int __devinit retu_probe (struct platform_device *pdev) {struct retu *retu; -struct cbus_retu_platform_data *pdata = pdev->dev.platform_data;int ret = -ENOMEM ;int rev;
@@ -452,7 +449,6 @@ static int __devinit retu_probe(struct platform_device *pdev) retu->irq =platform_get_irq (pdev,0 ); retu->irq_base = ret; retu->irq_end = ret +MAX_RETU_IRQ_HANDLERS ; - retu->devid = pdata->devid; retu->dev = &pdev->dev; the_retu = retu;
Signature · 1 line
1.7.7
PATCH 3/4 cbus: move device IDs to local header
In reply to Felipe Balbithere's no need to show that to the world.
--- drivers/cbus/cbus.h | 3 +++ include/linux/platform_data/cbus.h | 3 --- 2 files changed, 3 insertions(+), 3 deletions(-)
drivers/cbus/cbus.h +3 -0
@@ -23,6 +23,9 @@#ifndef __DRIVERS_CBUS_CBUS_H#define __DRIVERS_CBUS_CBUS_H +#define CBUS_RETU_DEVICE_ID 0x01 +#define CBUS_TAHVO_DEVICE_ID 0x02 +extern int cbus_read_reg (struct device *,unsigned dev,unsigned reg);extern int cbus_write_reg (struct device *,unsigned dev,unsigned reg,unsigned val);
include/linux/platform_data/cbus.h +0 -3
@@ -22,9 +22,6 @@ #ifndef __INCLUDE_LINUX_CBUS_H #define __INCLUDE_LINUX_CBUS_H -#define CBUS_RETU_DEVICE_ID 0x01 -#define CBUS_TAHVO_DEVICE_ID 0x02 - struct cbus_host_platform_data { int dat_gpio; int clk_gpio;
Signature · 1 line
1.7.7
PATCH 4/4 cbus: retu: drop useless platform_data
In reply to Felipe Balbithere's no need for that at all.
--- arch/arm/mach-omap1/board-nokia770.c | 5 ----- arch/arm/mach-omap2/board-n8x0.c | 5 ----- include/linux/platform_data/cbus.h | 4 ---- 3 files changed, 0 insertions(+), 14 deletions(-)
arch/arm/mach-omap1/board-nokia770.c +0 -5
@@ -123,17 +123,12 @@ static struct resource retu_resource[] = { }, }; -static struct cbus_retu_platform_data nokia770_retu_data = { - .devid =CBUS_RETU_DEVICE_ID , -}; -static struct platform_device retu_device = { .name ="retu" , .id =-1 , .resource = retu_resource, .num_resources =ARRAY_SIZE (retu_resource), .dev = { - .platform_data = &nokia770_retu_data, .parent = &nokia770_cbus_device.dev, }, };
arch/arm/mach-omap2/board-n8x0.c +0 -5
@@ -219,17 +219,12 @@ static struct resource retu_resource[] = { }, }; -static struct cbus_retu_platform_data n8x0_retu_data = { - .devid =CBUS_RETU_DEVICE_ID , -}; -static struct platform_device retu_device = { .name ="retu" , .id =-1 , .resource = retu_resource, .num_resources =ARRAY_SIZE (retu_resource), .dev = { - .platform_data = &n8x0_retu_data, .parent = &n8x0_cbus_device.dev, }, };
include/linux/platform_data/cbus.h +0 -4
@@ -28,8 +28,4 @@ struct cbus_host_platform_data { int sel_gpio; }; -struct cbus_retu_platform_data { -int devid; -}; -#endif /* __INCLUDE_LINUX_CBUS_H */
Signature · 1 line
1.7.7
Tony Lindgren
maintainerQuoted 1 line · Felipe Balbi
then we can make DeviceTree conversion happen.
Cool. Looks like n800 keeps running after these, pushing to cbus branch.
Tony
Hi,
Quoted 5 lines · Tony Lindgren
Quoted 1 line · Felipe Balbi
then we can make DeviceTree conversion happen.
Cool. Looks like n800 keeps running after these, pushing to cbus branch.
need to find out a way to create all devices via devicetree. Do you have a branch which I could patch on top of ?
Signature · 1 line
balbi
Hi Felipe,
Quoted 11 lines · Felipe
Hi,
Quoted 5 lines · Tony Lindgren
Quoted 1 line · Felipe Balbi
then we can make DeviceTree conversion happen.
Cool. Looks like n800 keeps running after these, pushing to cbus branch.
need to find out a way to create all devices via devicetree. Do you have a branch which I could patch on top of ?
The latest mainline master branch does contain the first DT patches for basic OMAP3 & 4 support. You can probably start from here for OMAP2 DT support as well.
Regards,
Benoit