omap: cleanup board files
Subsystems (4)
cover omap: cleanup board files
Hi Tony,
These patches cleanup some of the common code in the board files. The changes are basically almost mechanically move the code shared among several boards into some common place.
There are a lot of places for further improvement, especially DSS and TWL initialization. I'll try to find some time to sort these out as well.
Special thanks to Igor Grinberg for the original idea :)
Mike Rapoport (4):
omap: consolidate touch screen initialization among different boards
omap: use common initialization for PMIC i2c bus
omap: move detection of NAND CS to common-board-devices
omap: musb: introduce default baord config
arch/arm/mach-omap2/Makefile | 2 + arch/arm/mach-omap2/board-2430sdp.c | 20 +--- arch/arm/mach-omap2/board-3430sdp.c | 85 ++------------- arch/arm/mach-omap2/board-4430sdp.c | 16 +--- arch/arm/mach-omap2/board-cm-t35.c | 78 +------------- arch/arm/mach-omap2/board-devkit8000.c | 119 +-------------------- arch/arm/mach-omap2/board-igep0020.c | 23 +---- arch/arm/mach-omap2/board-igep0030.c | 21 +--- arch/arm/mach-omap2/board-ldp.c | 77 +------------- arch/arm/mach-omap2/board-omap3beagle.c | 66 +----------- arch/arm/mach-omap2/board-omap3evm.c | 72 +------------ arch/arm/mach-omap2/board-omap3logic.c | 13 +-- arch/arm/mach-omap2/board-omap3pandora.c | 69 +----------- arch/arm/mach-omap2/board-omap3stalker.c | 78 +------------- arch/arm/mach-omap2/board-omap3touchbook.c | 101 ++---------------- arch/arm/mach-omap2/board-omap4panda.c | 17 +--- arch/arm/mach-omap2/board-overo.c | 108 +------------------ arch/arm/mach-omap2/board-rm680.c | 21 +--- arch/arm/mach-omap2/board-rx51-peripherals.c | 13 +-- arch/arm/mach-omap2/board-zoom-peripherals.c | 21 +--- arch/arm/mach-omap2/common-board-devices.c | 148 ++++++++++++++++++++++++++ arch/arm/mach-omap2/common-board-devices.h | 52 +++++++++ arch/arm/mach-omap2/usb-musb.c | 14 +++- 23 files changed, 293 insertions(+), 941 deletions(-) create mode 100644 arch/arm/mach-omap2/common-board-devices.c create mode 100644 arch/arm/mach-omap2/common-board-devices.h
Signature · 1 line
1.7.3.1
PATCH 1/4 omap: consolidate touch screen initialization among different boards
Add common-board-devices.c that will contain the code for peripheral devices initializatoin shared between multiple boards. Start small with touchscreen initialization.
--- arch/arm/mach-omap2/Makefile | 2 + arch/arm/mach-omap2/board-3430sdp.c | 65 ++------------------- arch/arm/mach-omap2/board-cm-t35.c | 58 +------------------ arch/arm/mach-omap2/board-devkit8000.c | 56 +------------------ arch/arm/mach-omap2/board-ldp.c | 57 +------------------ arch/arm/mach-omap2/board-omap3evm.c | 51 +---------------- arch/arm/mach-omap2/board-omap3pandora.c | 49 +--------------- arch/arm/mach-omap2/board-omap3stalker.c | 49 +--------------- arch/arm/mach-omap2/board-omap3touchbook.c | 36 +----------- arch/arm/mach-omap2/board-overo.c | 46 +-------------- arch/arm/mach-omap2/common-board-devices.c | 85 ++++++++++++++++++++++++++++ arch/arm/mach-omap2/common-board-devices.h | 18 ++++++ 12 files changed, 128 insertions(+), 444 deletions(-) create mode 100644 arch/arm/mach-omap2/common-board-devices.c create mode 100644 arch/arm/mach-omap2/common-board-devices.h
arch/arm/mach-omap2/Makefile +2 -0
@@ -270,3 +270,5 @@ obj-$(CONFIG_ARCH_OMAP4) += hwspinlock.o disp-$(CONFIG_OMAP2_DSS) := display.o obj-y += $(disp-m) $(disp-y) + +obj-y += common-board-devices.o
arch/arm/mach-omap2/board-3430sdp.c +6 -59
96 lines not on this page · raw message
arch/arm/mach-omap2/board-cm-t35.c +2 -56
76 lines not on this page · raw message
arch/arm/mach-omap2/board-devkit8000.c +2 -54
81 lines not on this page · raw message
arch/arm/mach-omap2/board-ldp.c +2 -55
81 lines not on this page · raw message
arch/arm/mach-omap2/board-omap3evm.c +2 -49
75 lines not on this page · raw message
arch/arm/mach-omap2/board-omap3pandora.c +2 -47
75 lines not on this page · raw message
arch/arm/mach-omap2/board-omap3stalker.c +2 -47
77 lines not on this page · raw message
arch/arm/mach-omap2/board-omap3touchbook.c +3 -33
@@ -52,6 +52,7 @@#include "mux.h" #include "hsmmc.h" #include "timer-gp.h" +#include "common-board-devices.h" #include <asm/setup.h>
@@ -301,19 +302,7 @@ static int __init omap3_touchbook_i2c_init(void)return 0 ; } -static void __init omap3_ads7846_init (void ) -{ -if (gpio_request (OMAP3_TS_GPIO ,"ads7846_pen_down" )) { -printk (KERN_ERR "Failed to request GPIO %d for " -"ads7846 pen down IRQ\n" ,OMAP3_TS_GPIO ); -return ; - } - -gpio_direction_input (OMAP3_TS_GPIO ); -gpio_set_debounce (OMAP3_TS_GPIO ,310 ); -} - -static struct ads7846_platform_data ads7846_config = { +static struct ads7846_platform_data ads7846_pdata = { .x_min =100 , .y_min =265 , .x_max =3950 ,
@@ -327,23 +316,6 @@ static struct ads7846_platform_data ads7846_config = { .keep_vref_on = 1, }; -static struct omap2_mcspi_device_config ads7846_mcspi_config = { - .turbo_mode =0 , - .single_channel =1 ,/* 0: slave, 1: master */ -}; - -static struct spi_board_info omap3_ads7846_spi_board_info[]__initdata = { - { - .modalias ="ads7846" , - .bus_num =4 , - .chip_select =0 , - .max_speed_hz =1500000 , - .controller_data = &ads7846_mcspi_config, - .irq =OMAP_GPIO_IRQ (OMAP3_TS_GPIO ), - .platform_data = &ads7846_config, - } -}; -static struct gpio_led gpio_leds[] = { { .name ="touchbook::usr0" ,
@@ -526,9 +498,7 @@ static void __init omap3_touchbook_init(void)gpio_direction_output (176 , true);/* Touchscreen and accelerometer */ -spi_register_board_info (omap3_ads7846_spi_board_info, -ARRAY_SIZE (omap3_ads7846_spi_board_info)); -omap3_ads7846_init (); +omap_ads7846_init (4 ,OMAP3_TS_GPIO ,310 , &ads7846_pdata);usb_musb_init (&musb_board_data);usbhs_init (&usbhs_bdata);omap3touchbook_flash_init ();
arch/arm/mach-omap2/board-overo.c +2 -44
70 lines not on this page · raw message
arch/arm/mach-omap2/common-board-devices.c new file +85 -0
85 lines not on this page · raw message
arch/arm/mach-omap2/common-board-devices.h new file +18 -0
@@ -0,0 +1,18 @@ +#ifndef __OMAP_COMMON_BOARD_DEVICES__ +#define __OMAP_COMMON_BOARD_DEVICES__ + +#if defined(CONFIG_TOUCHSCREEN_ADS7846 ) || \ + defined(CONFIG_TOUCHSCREEN_ADS7846_MODULE ) +struct ads7846_platform_data ; + +void omap_ads7846_init (int bus_num,int gpio_pendown,int gpio_debounce, +struct ads7846_platform_data *board_pdata); +#else +static inline void omap_ads7846_init (int bus_num, +int gpio_pendown,int gpio_debounce, +struct ads7846_platform_data *board_data) +{ +} +#endif + +#endif /* __OMAP_COMMON_BOARD_DEVICES__ */
Signature · 1 line
1.7.3.1
PATCH 1/4 omap: consolidate touch screen initialization among different boards
Hello!
This patch breaks compile for me.
Quoted 16 lines · Mike Rapoport
arch/arm/mach-omap2/common-board-devices.c new file +4
-0@@ -0,0 +1,85 @@ +void __init omap_ads7846_init (int bus_num,int gpio_pendown,int gpio_debounce, +struct ads7846_platform_data *board_pdata) +{ +}arch/arm/mach-omap2/common-board-devices.h new file +0
-0
arch/arm/mach-omap2/common-board-devices.h line 10
Quoted 10 lines
arch/arm/mach-omap2/common-board-devices.h new file +10
-0@@ -0,0 +1,18 @@ +#ifndef __OMAP_COMMON_BOARD_DEVICES__ +#define __OMAP_COMMON_BOARD_DEVICES__ + +#if defined(CONFIG_TOUCHSCREEN_ADS7846 ) || \ + defined(CONFIG_TOUCHSCREEN_ADS7846_MODULE ) +struct ads7846_platform_data ; + +void omap_ads7846_init (int bus_num,int gpio_pendown,int gpio_debounce, +struct ads7846_platform_data *board_pdata); +#else
arch/arm/mach-omap2/common-board-devices.c:80: error: redefinition of 'omap_ads7846_init' arch/arm/mach-omap2/common-board-devices.h:36: note: previous definition of 'omap_ads7846_init' was here
Of course I don't have the CONFIG_TOUCHSCREEN_ADS7846 defined.
Bye,
Oleg
PATCH 1/4 omap: consolidate touch screen initialization among different boards
In reply to Mike RapoportHello,
because ads7846_get_pendown_state() is not longer set in ads7846_platform_data, the ads7846_setup_pendown tries to request the pendown gpio and fails because the gpio is already requested.
Thomas
Am 25.04.2011 00:09, schrieb Mike Rapoport:
Quoted 113 lines
Add
common-board-devices.cthat will contain the code for peripheral devices initializatoin shared between multiple boards. Start small with touchscreen initialization.Signed-off-by Mike Rapoport <[email protected]>--- arch/arm/mach-omap2/Makefile | 2 + arch/arm/mach-omap2/board-3430sdp.c | 65 ++------------------- arch/arm/mach-omap2/board-cm-t35.c | 58 +------------------ arch/arm/mach-omap2/board-devkit8000.c | 56 +------------------ arch/arm/mach-omap2/board-ldp.c | 57 +------------------ arch/arm/mach-omap2/board-omap3evm.c | 51 +---------------- arch/arm/mach-omap2/board-omap3pandora.c | 49 +--------------- arch/arm/mach-omap2/board-omap3stalker.c | 49 +--------------- arch/arm/mach-omap2/board-omap3touchbook.c | 36 +----------- arch/arm/mach-omap2/board-overo.c | 46 +-------------- arch/arm/mach-omap2/common-board-devices.c | 85 ++++++++++++++++++++++++++++ arch/arm/mach-omap2/common-board-devices.h | 18 ++++++ 12 files changed, 128 insertions(+), 444 deletions(-) create mode 100644 arch/arm/mach-omap2/common-board-devices.c create mode 100644 arch/arm/mach-omap2/common-board-devices.h...
arch/arm/mach-omap2/board-devkit8000.c +2
-54@@ -51,7 +51,6 @@#include <plat/mcspi.h> #include <linux/input/matrix_keypad.h> #include <linux/spi/spi.h> -#include <linux/spi/ads7846.h> #include <linux/dm9000.h> #include <linux/interrupt.h> @@ -60,6 +59,7 @@#include "mux.h" #include "hsmmc.h" #include "timer-gp.h" +#include "common-board-devices.h" #define NAND_BLOCK_SIZE SZ_128K@@ -463,56 +463,6 @@ static void __init devkit8000_init_irq(void)#endif } -static void __init devkit8000_ads7846_init (void ) -{ -int gpio =OMAP3_DEVKIT_TS_GPIO ; -int ret; - - ret =gpio_request (gpio,"ads7846_pen_down" ); -if (ret <0 ) { -printk (KERN_ERR "Failed to request GPIO %d for " -"ads7846 pen down IRQ\n" , gpio); -return ; - } - -gpio_direction_input (gpio); -} - -static int ads7846_get_pendown_state (void ) -{ -return !gpio_get_value (OMAP3_DEVKIT_TS_GPIO ); -} - -static struct ads7846_platform_data ads7846_config = { - .x_max =0x0fff , - .y_max =0x0fff , - .x_plate_ohms =180 , - .pressure_max =255 , - .debounce_max =10 , - .debounce_tol =5 , - .debounce_rep =1 , - .get_pendown_state = ads7846_get_pendown_state, - .keep_vref_on =1 , - .settle_delay_usecs =150 , -}; - -static struct omap2_mcspi_device_config ads7846_mcspi_config = { - .turbo_mode =0 , - .single_channel =1 ,/* 0: slave, 1: master */ -}; - -static struct spi_board_info devkit8000_spi_board_info[]__initdata = { - { - .modalias ="ads7846" , - .bus_num =2 , - .chip_select =0 , - .max_speed_hz =1500000 , - .controller_data = &ads7846_mcspi_config, - .irq =OMAP_GPIO_IRQ (OMAP3_DEVKIT_TS_GPIO ), - .platform_data = &ads7846_config, - } -}; -#define OMAP_DM9000_BASE 0x2c000000static struct resource omap_dm9000_resources[] = {@@ -795,10 +745,8 @@ static void __init devkit8000_init(void) ARRAY_SIZE(devkit8000_devices));omap_display_init (&devkit8000_dss_data); -spi_register_board_info (devkit8000_spi_board_info, -ARRAY_SIZE (devkit8000_spi_board_info)); -devkit8000_ads7846_init (); +omap_ads7846_init (2 ,OMAP3_DEVKIT_TS_GPIO ,0 ,NULL );usb_musb_init (&musb_board_data);usbhs_init (&usbhs_bdata);
...
Quoted 115 lines
arch/arm/mach-omap2/common-board-devices.c new file +85
-0@@ -0,0 +1,85 @@ +/* +* common-board-devices.c +* +* Copyright (C) 2011 CompuLab, Ltd. +* Author: Mike Rapoport <[email protected]> +* +* This program is free software; you can redistribute it and/or +* modify it under the terms of the GNU General Public License +* version 2 as published by the Free Software Foundation. +* +* This program is distributed in the hope that it will be useful, but +* WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +* General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program; if not, write to the Free Software +* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA +* 02110-1301 USA +* +*/ + +#include <linux/gpio.h> +#include <linux/spi/spi.h> +#include <linux/spi/ads7846.h> + +#include <plat/mcspi.h> + +#include "common-board-devices.h" + +static struct omap2_mcspi_device_config ads7846_mcspi_config = { + .turbo_mode =0 , + .single_channel =1 ,/* 0: slave, 1: master */ +}; + +static struct ads7846_platform_data ads7846_config = { + .x_max =0x0fff , + .y_max =0x0fff , + .x_plate_ohms =180 , + .pressure_max =255 , + .debounce_max =10 , + .debounce_tol =3 , + .debounce_rep =1 , + .gpio_pendown = -EINVAL , + .keep_vref_on =1 , +}; + +static struct spi_board_info ads7846_spi_board_info__initdata = { + .modalias ="ads7846" , + .bus_num = -EINVAL , + .chip_select =0 , + .max_speed_hz =1500000 , + .controller_data = &ads7846_mcspi_config, + .irq = -EINVAL , + .platform_data = &ads7846_config, +}; + +void __init omap_ads7846_init (int bus_num,int gpio_pendown,int gpio_debounce, +struct ads7846_platform_data *board_pdata) +{ +struct spi_board_info *spi_bi = &ads7846_spi_board_info; +int err; + + err =gpio_request (gpio_pendown,"TS PenDown" ); +if (err) { +pr_err ("Could not obtain gpio for TS PenDown: %d\n" , err); +return ; + } + +gpio_direction_input (gpio_pendown); +gpio_export (gpio_pendown,0 ); + +if (gpio_debounce) +gpio_set_debounce (gpio_pendown, gpio_debounce); + + ads7846_config.gpio_pendown = gpio_pendown; + + spi_bi->bus_num = bus_num; + spi_bi->irq =OMAP_GPIO_IRQ (gpio_pendown); + +if (board_pdata) + spi_bi->platform_data = board_pdata; + +spi_register_board_info (&ads7846_spi_board_info,1 ); +}arch/arm/mach-omap2/common-board-devices.h new file +18
-0@@ -0,0 +1,18 @@ +#ifndef __OMAP_COMMON_BOARD_DEVICES__ +#define __OMAP_COMMON_BOARD_DEVICES__ + +#if defined(CONFIG_TOUCHSCREEN_ADS7846 ) || \ + defined(CONFIG_TOUCHSCREEN_ADS7846_MODULE ) +struct ads7846_platform_data ; + +void omap_ads7846_init (int bus_num,int gpio_pendown,int gpio_debounce, +struct ads7846_platform_data *board_pdata); +#else +static inline void omap_ads7846_init (int bus_num, +int gpio_pendown,int gpio_debounce, +struct ads7846_platform_data *board_data) +{ +} +#endif + +#endif /* __OMAP_COMMON_BOARD_DEVICES__ */
PATCH 1/4 omap: consolidate touch screen initialization among different boards
Hi Thomas,
Quoted 5 lines · Thomas Weber
Hello,
because
ads7846_get_pendown_state()is not longer set inads7846_platform_data, theads7846_setup_pendowntries to request the pendown gpio and fails because the gpio is already requested.
Thanks, for testing.
I've sent a patch for this a couple of minutes ago.
Signature · 2 lines
Regards, Igor.
PATCH 2/4 omap: use common initialization for PMIC i2c bus
In reply to Mike RapoportIntroduce omap_pmic_init that registers i2c bus and PMIC device on that bus and add omap2/3/4 wrappers for common cases.
--- arch/arm/mach-omap2/board-2430sdp.c | 13 ++----------- arch/arm/mach-omap2/board-3430sdp.c | 12 +----------- arch/arm/mach-omap2/board-4430sdp.c | 16 ++-------------- arch/arm/mach-omap2/board-cm-t35.c | 12 +----------- arch/arm/mach-omap2/board-devkit8000.c | 12 +----------- arch/arm/mach-omap2/board-igep0020.c | 15 ++------------- arch/arm/mach-omap2/board-igep0030.c | 13 ++----------- arch/arm/mach-omap2/board-ldp.c | 12 +----------- arch/arm/mach-omap2/board-omap3beagle.c | 13 ++----------- arch/arm/mach-omap2/board-omap3evm.c | 21 +++------------------ arch/arm/mach-omap2/board-omap3logic.c | 13 ++----------- arch/arm/mach-omap2/board-omap3pandora.c | 12 +----------- arch/arm/mach-omap2/board-omap3stalker.c | 21 +++------------------ arch/arm/mach-omap2/board-omap3touchbook.c | 12 +----------- arch/arm/mach-omap2/board-omap4panda.c | 17 ++--------------- arch/arm/mach-omap2/board-overo.c | 12 +----------- arch/arm/mach-omap2/board-rm680.c | 13 ++----------- arch/arm/mach-omap2/board-rx51-peripherals.c | 13 ++----------- arch/arm/mach-omap2/board-zoom-peripherals.c | 13 ++----------- arch/arm/mach-omap2/common-board-devices.c | 21 +++++++++++++++++++++ arch/arm/mach-omap2/common-board-devices.h | 24 ++++++++++++++++++++++++ 21 files changed, 78 insertions(+), 232 deletions(-)
arch/arm/mach-omap2/board-2430sdp.c +2 -11
@@ -41,6 +41,7 @@#include "mux.h" #include "hsmmc.h" +#include "common-board-devices.h" #define SDP2430_CS0_BASE 0x04000000#define SECONDARY_LCD_GPIO 147
@@ -180,15 +181,6 @@ static struct twl4030_platform_data sdp2430_twldata = { .vmmc1 = &sdp2430_vmmc1, }; -static struct i2c_board_info __initdata sdp2430_i2c_boardinfo[] = { - { -I2C_BOARD_INFO ("twl4030" ,0x48 ), - .flags =I2C_CLIENT_WAKE , - .irq =INT_24XX_SYS_NIRQ , - .platform_data = &sdp2430_twldata, - }, -}; -static struct i2c_board_info __initdata sdp2430_i2c1_boardinfo[] = { {I2C_BOARD_INFO ("isp1301_omap" ,0x2D ),
@@ -201,8 +193,7 @@ static int __init omap2430_i2c_init(void) {omap_register_i2c_bus (1 ,100 , sdp2430_i2c1_boardinfo,ARRAY_SIZE (sdp2430_i2c1_boardinfo)); -omap_register_i2c_bus (2 ,2600 , sdp2430_i2c_boardinfo, -ARRAY_SIZE (sdp2430_i2c_boardinfo)); +omap2_pmic_init ("twl4030" , &sdp2430_twldata);return 0 ; }
arch/arm/mach-omap2/board-3430sdp.c +1 -11
@@ -528,20 +528,10 @@ static struct twl4030_platform_data sdp3430_twldata = { .vpll2 = &sdp3430_vpll2, }; -static struct i2c_board_info __initdata sdp3430_i2c_boardinfo[] = { - { -I2C_BOARD_INFO ("twl4030" ,0x48 ), - .flags =I2C_CLIENT_WAKE , - .irq =INT_34XX_SYS_NIRQ , - .platform_data = &sdp3430_twldata, - }, -}; -static int __init omap3430_i2c_init (void ) {/* i2c1 for PMIC only */ -omap_register_i2c_bus (1 ,2600 , sdp3430_i2c_boardinfo, -ARRAY_SIZE (sdp3430_i2c_boardinfo)); +omap3_pmic_init ("twl4030" , &sdp3430_twldata);/* i2c2 on camera connector (for sensor control) and optional isp1301 */ omap_register_i2c_bus (2 ,400 ,NULL ,0 );/* i2c3 on display connector (for DVI, tfp410) */
arch/arm/mach-omap2/board-4430sdp.c +2 -14
@@ -42,6 +42,7 @@#include "hsmmc.h" #include "timer-gp.h" #include "control.h" +#include "common-board-devices.h" #define ETH_KS8851_IRQ 34#define ETH_KS8851_POWER_ON 48
@@ -575,14 +576,6 @@ static struct twl4030_platform_data sdp4430_twldata = { .usb = &omap4_usbphy_data }; -static struct i2c_board_info __initdata sdp4430_i2c_boardinfo[] = { - { -I2C_BOARD_INFO ("twl6030" ,0x48 ), - .flags =I2C_CLIENT_WAKE , - .irq =OMAP44XX_IRQ_SYS_1N , - .platform_data = &sdp4430_twldata, - }, -};static struct i2c_board_info __initdata sdp4430_i2c_3_boardinfo[] = { {I2C_BOARD_INFO ("tmp105" ,0x48 ),
@@ -598,12 +591,7 @@ static struct i2c_board_info __initdata sdp4430_i2c_4_boardinfo[] = { };static int __init omap4_i2c_init (void ) { -/* -* Phoenix Audio IC needs I2C1 to -* start with 400 KHz or less -*/ -omap_register_i2c_bus (1 ,400 , sdp4430_i2c_boardinfo, -ARRAY_SIZE (sdp4430_i2c_boardinfo)); +omap4_pmic_init ("twl6030" , &sdp4430_twldata);omap_register_i2c_bus (2 ,400 ,NULL ,0 );omap_register_i2c_bus (3 ,400 , sdp4430_i2c_3_boardinfo,ARRAY_SIZE (sdp4430_i2c_3_boardinfo));
arch/arm/mach-omap2/board-cm-t35.c +1 -11
@@ -539,19 +539,9 @@ static struct twl4030_platform_data cm_t35_twldata = { .vpll2 = &cm_t35_vpll2, }; -static struct i2c_board_info __initdata cm_t35_i2c_boardinfo[] = { - { -I2C_BOARD_INFO ("tps65930" ,0x48 ), - .flags =I2C_CLIENT_WAKE , - .irq =INT_34XX_SYS_NIRQ , - .platform_data = &cm_t35_twldata, - }, -}; -static void __init cm_t35_init_i2c (void ) { -omap_register_i2c_bus (1 ,2600 , cm_t35_i2c_boardinfo, -ARRAY_SIZE (cm_t35_i2c_boardinfo)); +omap3_pmic_init ("tps65930" , &cm_t35_twldata); }static void __init cm_t35_init_early (void )
arch/arm/mach-omap2/board-devkit8000.c +1 -11
@@ -366,19 +366,9 @@ static struct twl4030_platform_data devkit8000_twldata = { .keypad = &devkit8000_kp_data, }; -static struct i2c_board_info __initdata devkit8000_i2c_boardinfo[] = { - { -I2C_BOARD_INFO ("tps65930" ,0x48 ), - .flags =I2C_CLIENT_WAKE , - .irq =INT_34XX_SYS_NIRQ , - .platform_data = &devkit8000_twldata, - }, -}; -static int __init devkit8000_i2c_init (void ) { -omap_register_i2c_bus (1 ,2600 , devkit8000_i2c_boardinfo, -ARRAY_SIZE (devkit8000_i2c_boardinfo)); +omap3_pmic_init ("tps65930" , &devkit8000_twldata);/* Bus 3 is attached to the DVI port where devices like the pico DLP * projector don't work reliably with 400kHz */ omap_register_i2c_bus (3 ,400 ,NULL ,0 );
arch/arm/mach-omap2/board-igep0020.c +2 -13
@@ -38,6 +38,7 @@#include "mux.h" #include "hsmmc.h" #include "sdram-numonyx-m65kxxxxam.h" +#include "common-board-devices.h" #define IGEP2_SMSC911X_CS 5#define IGEP2_SMSC911X_GPIO 176
@@ -536,15 +537,6 @@ static struct twl4030_platform_data igep2_twldata = { .vio = &igep2_vio, }; -static struct i2c_board_info __initdata igep2_i2c1_boardinfo[] = { - { -I2C_BOARD_INFO ("twl4030" ,0x48 ), - .flags =I2C_CLIENT_WAKE , - .irq =INT_34XX_SYS_NIRQ , - .platform_data = &igep2_twldata, - }, -}; -static struct i2c_board_info __initdata igep2_i2c3_boardinfo[] = { {I2C_BOARD_INFO ("eeprom" ,0x50 ),
@@ -555,10 +547,7 @@ static void __init igep2_i2c_init(void) {int ret; - ret =omap_register_i2c_bus (1 ,2600 , igep2_i2c1_boardinfo, -ARRAY_SIZE (igep2_i2c1_boardinfo)); -if (ret) -pr_warning ("IGEP2: Could not register I2C1 bus (%d)\n" , ret); +omap3_pmic_init ("twl4030" , &igep2_twldata);/* * Bus 3 is attached to the DVI port where devices like the pico DLP
arch/arm/mach-omap2/board-igep0030.c +2 -11
@@ -35,6 +35,7 @@#include "mux.h" #include "hsmmc.h" #include "sdram-numonyx-m65kxxxxam.h" +#include "common-board-devices.h" #define IGEP3_GPIO_LED0_GREEN 54#define IGEP3_GPIO_LED0_RED 53
@@ -349,19 +350,9 @@ static struct twl4030_platform_data igep3_twl4030_pdata = { .vio = &igep3_vio, }; -static struct i2c_board_info __initdata igep3_i2c_boardinfo[] = { - { -I2C_BOARD_INFO ("twl4030" ,0x48 ), - .flags =I2C_CLIENT_WAKE , - .irq =INT_34XX_SYS_NIRQ , - .platform_data = &igep3_twl4030_pdata, - }, -}; -static int __init igep3_i2c_init (void ) { -omap_register_i2c_bus (1 ,2600 , igep3_i2c_boardinfo, -ARRAY_SIZE (igep3_i2c_boardinfo)); +omap3_pmic_init ("twl4030" , &igep3_twl4030_pdata);return 0 ; }
arch/arm/mach-omap2/board-ldp.c +1 -11
@@ -265,19 +265,9 @@ static struct twl4030_platform_data ldp_twldata = { .keypad = &ldp_kp_twl4030_data, }; -static struct i2c_board_info __initdata ldp_i2c_boardinfo[] = { - { -I2C_BOARD_INFO ("twl4030" ,0x48 ), - .flags =I2C_CLIENT_WAKE , - .irq =INT_34XX_SYS_NIRQ , - .platform_data = &ldp_twldata, - }, -}; -static int __init omap_i2c_init (void ) { -omap_register_i2c_bus (1 ,2600 , ldp_i2c_boardinfo, -ARRAY_SIZE (ldp_i2c_boardinfo)); +omap3_pmic_init ("twl4030" , &ldp_twldata);omap_register_i2c_bus (2 ,400 ,NULL ,0 );omap_register_i2c_bus (3 ,400 ,NULL ,0 );return 0 ;
arch/arm/mach-omap2/board-omap3beagle.c +2 -11
@@ -52,6 +52,7 @@#include "hsmmc.h" #include "timer-gp.h" #include "pm.h" +#include "common-board-devices.h" #define NAND_BLOCK_SIZE SZ_128K
@@ -453,15 +454,6 @@ static struct twl4030_platform_data beagle_twldata = { .vpll2 = &beagle_vpll2, }; -static struct i2c_board_info __initdata beagle_i2c_boardinfo[] = { - { -I2C_BOARD_INFO ("twl4030" ,0x48 ), - .flags =I2C_CLIENT_WAKE , - .irq =INT_34XX_SYS_NIRQ , - .platform_data = &beagle_twldata, - }, -}; -static struct i2c_board_info __initdata beagle_i2c_eeprom[] = { {I2C_BOARD_INFO ("eeprom" ,0x50 ),
@@ -470,8 +462,7 @@ static struct i2c_board_info __initdata beagle_i2c_eeprom[] = {static int __init omap3_beagle_i2c_init (void ) { -omap_register_i2c_bus (1 ,2600 , beagle_i2c_boardinfo, -ARRAY_SIZE (beagle_i2c_boardinfo)); +omap3_pmic_init ("twl4030" , &beagle_twldata);/* Bus 3 is attached to the DVI port where devices like the pico DLP * projector don't work reliably with 400kHz */ omap_register_i2c_bus (3 ,100 , beagle_i2c_eeprom,ARRAY_SIZE (beagle_i2c_eeprom));
arch/arm/mach-omap2/board-omap3evm.c +3 -18
@@ -604,28 +604,13 @@ static struct twl4030_platform_data omap3evm_twldata = { .vdac = &omap3_evm_vdac, .vpll2 = &omap3_evm_vpll2, .vio = &omap3evm_vio, -}; - -static struct i2c_board_info __initdata omap3evm_i2c_boardinfo[] = { - { -I2C_BOARD_INFO ("twl4030" ,0x48 ), - .flags =I2C_CLIENT_WAKE , - .irq =INT_34XX_SYS_NIRQ , - .platform_data = &omap3evm_twldata, - }, + .vmmc1 = &omap3evm_vmmc1, + .vsim = &omap3evm_vsim, };static int __init omap3_evm_i2c_init (void ) { -/* -* REVISIT: These entries can be set in omap3evm_twl_data -* after a merge with MFD tree -*/ - omap3evm_twldata.vmmc1 = &omap3evm_vmmc1; - omap3evm_twldata.vsim = &omap3evm_vsim; - -omap_register_i2c_bus (1 ,2600 , omap3evm_i2c_boardinfo, -ARRAY_SIZE (omap3evm_i2c_boardinfo)); +omap3_pmic_init ("twl4030" , &omap3evm_twldata);omap_register_i2c_bus (2 ,400 ,NULL ,0 );omap_register_i2c_bus (3 ,400 ,NULL ,0 );return 0 ;
arch/arm/mach-omap2/board-omap3logic.c +2 -11
@@ -37,6 +37,7 @@#include "hsmmc.h" #include "timer-gp.h" #include "control.h" +#include "common-board-devices.h" #include <plat/mux.h> #include <plat/board.h>
@@ -93,19 +94,9 @@ static struct twl4030_platform_data omap3logic_twldata = { .vmmc1 = &omap3logic_vmmc1, }; -static struct i2c_board_info __initdata omap3logic_i2c_boardinfo[] = { - { -I2C_BOARD_INFO ("twl4030" ,0x48 ), - .flags =I2C_CLIENT_WAKE , - .irq =INT_34XX_SYS_NIRQ , - .platform_data = &omap3logic_twldata, - }, -}; -static int __init omap3logic_i2c_init (void ) { -omap_register_i2c_bus (1 ,2600 , omap3logic_i2c_boardinfo, -ARRAY_SIZE (omap3logic_i2c_boardinfo)); +omap3_pmic_init ("twl4030" , &omap3logic_twldata);return 0 ; }
arch/arm/mach-omap2/board-omap3pandora.c +1 -11
@@ -544,15 +544,6 @@ static struct twl4030_platform_data omap3pandora_twldata = { .bci = &pandora_bci_data, }; -static struct i2c_board_info __initdata omap3pandora_i2c_boardinfo[] = { - { -I2C_BOARD_INFO ("tps65950" ,0x48 ), - .flags =I2C_CLIENT_WAKE , - .irq =INT_34XX_SYS_NIRQ , - .platform_data = &omap3pandora_twldata, - }, -}; -static struct i2c_board_info __initdata omap3pandora_i2c3_boardinfo[] = { {I2C_BOARD_INFO ("bq27500" ,0x55 ),
@@ -562,8 +553,7 @@ static struct i2c_board_info __initdata omap3pandora_i2c3_boardinfo[] = {static int __init omap3pandora_i2c_init (void ) { -omap_register_i2c_bus (1 ,2600 , omap3pandora_i2c_boardinfo, -ARRAY_SIZE (omap3pandora_i2c_boardinfo)); +omap3_pmic_init ("tps65950" , &omap3pandora_twldata);/* i2c2 pins are not connected */ omap_register_i2c_bus (3 ,100 , omap3pandora_i2c3_boardinfo,ARRAY_SIZE (omap3pandora_i2c3_boardinfo));
arch/arm/mach-omap2/board-omap3stalker.c +3 -18
@@ -455,15 +455,8 @@ static struct twl4030_platform_data omap3stalker_twldata = { .codec = &omap3stalker_codec_data, .vdac = &omap3_stalker_vdac, .vpll2 = &omap3_stalker_vpll2, -}; - -static struct i2c_board_info __initdata omap3stalker_i2c_boardinfo[] = { - { -I2C_BOARD_INFO ("twl4030" ,0x48 ), - .flags =I2C_CLIENT_WAKE , - .irq =INT_34XX_SYS_NIRQ , - .platform_data = &omap3stalker_twldata, - }, + .vmmc1 = &omap3stalker_vmmc1, + .vsim = &omap3stalker_vsim, };static struct at24_platform_data fram_info = {
@@ -482,15 +475,7 @@ static struct i2c_board_info __initdata omap3stalker_i2c_boardinfo3[] = {static int __init omap3_stalker_i2c_init (void ) { -/* -* REVISIT: These entries can be set in omap3evm_twl_data -* after a merge with MFD tree -*/ - omap3stalker_twldata.vmmc1 = &omap3stalker_vmmc1; - omap3stalker_twldata.vsim = &omap3stalker_vsim; - -omap_register_i2c_bus (1 ,2600 , omap3stalker_i2c_boardinfo, -ARRAY_SIZE (omap3stalker_i2c_boardinfo)); +omap3_pmic_init ("twl4030" , &omap3stalker_twldata);omap_register_i2c_bus (2 ,400 ,NULL ,0 );omap_register_i2c_bus (3 ,400 , omap3stalker_i2c_boardinfo3,ARRAY_SIZE (omap3stalker_i2c_boardinfo3));
arch/arm/mach-omap2/board-omap3touchbook.c +1 -11
@@ -274,15 +274,6 @@ static struct twl4030_platform_data touchbook_twldata = { .vpll2 = &touchbook_vpll2, }; -static struct i2c_board_info __initdata touchbook_i2c_boardinfo[] = { - { -I2C_BOARD_INFO ("twl4030" ,0x48 ), - .flags =I2C_CLIENT_WAKE , - .irq =INT_34XX_SYS_NIRQ , - .platform_data = &touchbook_twldata, - }, -}; -static struct i2c_board_info __initdata touchBook_i2c_boardinfo[] = { {I2C_BOARD_INFO ("bq27200" ,0x55 ),
@@ -292,8 +283,7 @@ static struct i2c_board_info __initdata touchBook_i2c_boardinfo[] = {static int __init omap3_touchbook_i2c_init (void ) {/* Standard TouchBook bus */ -omap_register_i2c_bus (1 ,2600 , touchbook_i2c_boardinfo, -ARRAY_SIZE (touchbook_i2c_boardinfo)); +omap3_pmic_init ("twl4030" , &touchbook_twldata);/* Additional TouchBook bus */ omap_register_i2c_bus(3, 100, touchBook_i2c_boardinfo,
arch/arm/mach-omap2/board-omap4panda.c +2 -15
@@ -46,6 +46,7 @@#include "hsmmc.h" #include "control.h" #include "mux.h" +#include "common-board-devices.h" #define GPIO_HUB_POWER 1#define GPIO_HUB_NRESET 62
@@ -408,15 +409,6 @@ static struct twl4030_platform_data omap4_panda_twldata = { .usb = &omap4_usbphy_data, }; -static struct i2c_board_info __initdata omap4_panda_i2c_boardinfo[] = { - { -I2C_BOARD_INFO ("twl6030" ,0x48 ), - .flags =I2C_CLIENT_WAKE , - .irq =OMAP44XX_IRQ_SYS_1N , - .platform_data = &omap4_panda_twldata, - }, -}; -/* * Display monitor features are burnt in their EEPROM as EDID data. The EEPROM * is connected as I2C slave device, and can be accessed at address 0x50
@@ -429,12 +421,7 @@ static struct i2c_board_info __initdata panda_i2c_eeprom[] = {static int __init omap4_panda_i2c_init (void ) { -/* -* Phoenix Audio IC needs I2C1 to -* start with 400 KHz or less -*/ -omap_register_i2c_bus (1 ,400 , omap4_panda_i2c_boardinfo, -ARRAY_SIZE (omap4_panda_i2c_boardinfo)); +omap4_pmic_init ("twl6030" , &omap4_panda_twldata);omap_register_i2c_bus (2 ,400 ,NULL ,0 );/* * Bus 3 is attached to the DVI port where devices like the pico DLP
arch/arm/mach-omap2/board-overo.c +1 -11
@@ -538,19 +538,9 @@ static struct twl4030_platform_data overo_twldata = { .vpll2 = &overo_vpll2, }; -static struct i2c_board_info __initdata overo_i2c_boardinfo[] = { - { -I2C_BOARD_INFO ("tps65950" ,0x48 ), - .flags =I2C_CLIENT_WAKE , - .irq =INT_34XX_SYS_NIRQ , - .platform_data = &overo_twldata, - }, -}; -static int __init overo_i2c_init (void ) { -omap_register_i2c_bus (1 ,2600 , overo_i2c_boardinfo, -ARRAY_SIZE (overo_i2c_boardinfo)); +omap3_pmic_init ("tps65950" , &overo_twldata);/* i2c2 pins are used for gpio */ omap_register_i2c_bus (3 ,400 ,NULL ,0 );return 0 ;
arch/arm/mach-omap2/board-rm680.c +2 -11
@@ -31,6 +31,7 @@#include "mux.h" #include "hsmmc.h" #include "sdram-nokia.h" +#include "common-board-devices.h" static struct regulator_consumer_supply rm680_vemmc_consumers[] = {REGULATOR_SUPPLY ("vmmc" ,"omap_hsmmc.1" ),
@@ -90,19 +91,9 @@ static struct twl4030_platform_data rm680_twl_data = {/* add rest of the children here */ }; -static struct i2c_board_info __initdata rm680_twl_i2c_board_info[] = { - { -I2C_BOARD_INFO ("twl5031" ,0x48 ), - .flags =I2C_CLIENT_WAKE , - .irq =INT_34XX_SYS_NIRQ , - .platform_data = &rm680_twl_data, - }, -}; -static void __init rm680_i2c_init (void ) { -omap_register_i2c_bus (1 ,2900 , rm680_twl_i2c_board_info, -ARRAY_SIZE (rm680_twl_i2c_board_info)); +omap_pmic_init (1 ,2900 ,"twl5031" ,INT_34XX_SYS_NIRQ , &rm680_twl_data);omap_register_i2c_bus (2 ,400 ,NULL ,0 );omap_register_i2c_bus (3 ,400 ,NULL ,0 ); }
arch/arm/mach-omap2/board-rx51-peripherals.c +2 -11
@@ -43,6 +43,7 @@#include "mux.h" #include "hsmmc.h" +#include "common-board-devices.h" #define SYSTEM_REV_B_USES_VAUX3 0x1699#define SYSTEM_REV_S_USES_VAUX3 0x8
@@ -777,15 +778,6 @@ static struct tpa6130a2_platform_data rx51_tpa6130a2_data __initdata_or_module = .power_gpio = 98, }; -static struct i2c_board_info __initdata rx51_peripherals_i2c_board_info_1[] = { - { -I2C_BOARD_INFO ("twl5030" ,0x48 ), - .flags =I2C_CLIENT_WAKE , - .irq =INT_34XX_SYS_NIRQ , - .platform_data = &rx51_twldata, - }, -}; -/* Audio setup data */ static struct aic3x_setup_data rx51_aic34_setup = { .gpio_func[0 ] =AIC3X_GPIO1_FUNC_DISABLED ,
@@ -833,8 +825,7 @@ static int __init rx51_i2c_init(void) rx51_twldata.vaux3 = &rx51_vaux3_cam; } rx51_twldata.vmmc2 = &rx51_vmmc2; -omap_register_i2c_bus (1 ,2200 , rx51_peripherals_i2c_board_info_1, -ARRAY_SIZE (rx51_peripherals_i2c_board_info_1)); +omap_pmic_init (1 ,2200 ,"twl5030" ,INT_34XX_SYS_NIRQ , &rx51_twldata);omap_register_i2c_bus (2 ,100 , rx51_peripherals_i2c_board_info_2,ARRAY_SIZE (rx51_peripherals_i2c_board_info_2));omap_register_i2c_bus (3 ,400 ,NULL ,0 );
arch/arm/mach-omap2/board-zoom-peripherals.c +2 -11
@@ -31,6 +31,7 @@#include "mux.h" #include "hsmmc.h" +#include "common-board-devices.h" #define OMAP_ZOOM_WLAN_PMENA_GPIO (101)#define OMAP_ZOOM_WLAN_IRQ_GPIO (162)
@@ -349,15 +350,6 @@ static struct twl4030_platform_data zoom_twldata = { .vdac = &zoom_vdac, }; -static struct i2c_board_info __initdata zoom_i2c_boardinfo[] = { - { -I2C_BOARD_INFO ("twl5030" ,0x48 ), - .flags =I2C_CLIENT_WAKE , - .irq =INT_34XX_SYS_NIRQ , - .platform_data = &zoom_twldata, - }, -}; -static int __init omap_i2c_init (void ) {if (machine_is_omap_zoom2 ()) {
@@ -365,8 +357,7 @@ static int __init omap_i2c_init(void) zoom_audio_data.hs_extmute =1 ; zoom_audio_data.set_hs_extmute = zoom2_set_hs_extmute; } -omap_register_i2c_bus (1 ,2400 , zoom_i2c_boardinfo, -ARRAY_SIZE (zoom_i2c_boardinfo)); +omap_pmic_init (1 ,2400 ,"twl5030" ,INT_34XX_SYS_NIRQ , &zoom_twldata);omap_register_i2c_bus (2 ,400 ,NULL ,0 );omap_register_i2c_bus (3 ,400 ,NULL ,0 );return 0 ;
arch/arm/mach-omap2/common-board-devices.c +21 -0
@@ -20,14 +20,35 @@* */ +#include <linux/i2c.h> +#include <linux/i2c/twl.h> +#include <linux/gpio.h> #include <linux/spi/spi.h> #include <linux/spi/ads7846.h> +#include <plat/i2c.h> #include <plat/mcspi.h> #include "common-board-devices.h" +static struct i2c_board_info __initdata pmic_i2c_board_info = { + .addr =0x48 , + .flags =I2C_CLIENT_WAKE , +}; + +void __init omap_pmic_init (int bus,u32 clkrate, +const char *pmic_type,int pmic_irq, +struct twl4030_platform_data *pmic_data) +{ +strncpy (pmic_i2c_board_info.type, pmic_type, +sizeof (pmic_i2c_board_info.type)); + pmic_i2c_board_info.irq = pmic_irq; + pmic_i2c_board_info.platform_data = pmic_data; + +omap_register_i2c_bus (bus, clkrate, &pmic_i2c_board_info,1 ); +} +static struct omap2_mcspi_device_config ads7846_mcspi_config = { .turbo_mode =0 , .single_channel =1 ,/* 0: slave, 1: master */
arch/arm/mach-omap2/common-board-devices.h +24 -0
@@ -1,6 +1,30 @@#ifndef __OMAP_COMMON_BOARD_DEVICES__#define __OMAP_COMMON_BOARD_DEVICES__ +struct twl4030_platform_data ; + +void omap_pmic_init (int bus,u32 clkrate,const char *pmic_type,int pmic_irq, +struct twl4030_platform_data *pmic_data); + +static inline void omap2_pmic_init (const char *pmic_type, +struct twl4030_platform_data *pmic_data) +{ +omap_pmic_init (2 ,2600 , pmic_type,INT_24XX_SYS_NIRQ , pmic_data); +} + +static inline void omap3_pmic_init (const char *pmic_type, +struct twl4030_platform_data *pmic_data) +{ +omap_pmic_init (1 ,2600 , pmic_type,INT_34XX_SYS_NIRQ , pmic_data); +} + +static inline void omap4_pmic_init (const char *pmic_type, +struct twl4030_platform_data *pmic_data) +{ +/* Phoenix Audio IC needs I2C1 to start with 400 KHz or less */ +omap_pmic_init (1 ,400 , pmic_type,OMAP44XX_IRQ_SYS_1N , pmic_data); +} +#if defined(CONFIG_TOUCHSCREEN_ADS7846 ) || \ defined(CONFIG_TOUCHSCREEN_ADS7846_MODULE )struct ads7846_platform_data ;
Signature · 1 line
1.7.3.1
PATCH 3/4 omap: move detection of NAND CS to common-board-devices
In reply to Mike Rapoportand reduce amount of copy/paste
--- arch/arm/mach-omap2/board-devkit8000.c | 43 +------------------------- arch/arm/mach-omap2/board-omap3beagle.c | 45 +-------------------------- arch/arm/mach-omap2/board-omap3touchbook.c | 45 +-------------------------- arch/arm/mach-omap2/board-overo.c | 42 +------------------------ arch/arm/mach-omap2/common-board-devices.c | 42 ++++++++++++++++++++++++++ arch/arm/mach-omap2/common-board-devices.h | 10 ++++++ 6 files changed, 60 insertions(+), 167 deletions(-)
arch/arm/mach-omap2/board-devkit8000.c +2 -41
@@ -97,13 +97,6 @@ static struct mtd_partition devkit8000_nand_partitions[] = { }, }; -static struct omap_nand_platform_data devkit8000_nand_data = { - .options =NAND_BUSWIDTH_16 , - .parts = devkit8000_nand_partitions, - .nr_parts =ARRAY_SIZE (devkit8000_nand_partitions), - .dma_channel =-1 ,/* disable DMA in OMAP NAND driver */ -}; -static struct omap2_hsmmc_info mmc[] = { { .mmc =1 ,
@@ -516,39 +509,6 @@ static struct platform_device *devkit8000_devices[] __initdata = { &omap_dm9000_dev, }; -static void __init devkit8000_flash_init (void ) -{ -u8 cs =0 ; -u8 nandcs =GPMC_CS_NUM +1 ; - -/* find out the chip-select on which NAND exists */ -while (cs <GPMC_CS_NUM ) { -u32 ret =0 ; - ret =gpmc_cs_read_reg (cs,GPMC_CS_CONFIG1 ); - -if ((ret &0xC00 ) ==0x800 ) { -printk (KERN_INFO "Found NAND on CS%d\n" , cs); -if (nandcs >GPMC_CS_NUM ) - nandcs = cs; - } - cs++; - } - -if (nandcs >GPMC_CS_NUM ) { -printk (KERN_INFO "NAND: Unable to find configuration " -"in GPMC\n " ); -return ; - } - -if (nandcs <GPMC_CS_NUM ) { - devkit8000_nand_data.cs = nandcs; - -printk (KERN_INFO "Registering NAND on CS%d\n" , nandcs); -if (gpmc_nand_init (&devkit8000_nand_data) <0 ) -printk (KERN_ERR "Unable to register NAND device\n" ); - } -} -static struct omap_musb_board_data musb_board_data = { .interface_type =MUSB_INTERFACE_ULPI , .mode =MUSB_OTG ,
@@ -740,7 +700,8 @@ static void __init devkit8000_init(void)usb_musb_init (&musb_board_data);usbhs_init (&usbhs_bdata); -devkit8000_flash_init (); +omap_nand_flash_init (NAND_BUSWIDTH_16 , devkit8000_nand_partitions, +ARRAY_SIZE (devkit8000_nand_partitions));/* Ensure SDRC pins are mux'd for self-refresh */ omap_mux_init_signal ("sdrc_cke0" ,OMAP_PIN_OUTPUT );
arch/arm/mach-omap2/board-omap3beagle.c +2 -43
63 lines not on this page · raw message
arch/arm/mach-omap2/board-omap3touchbook.c +2 -43
63 lines not on this page · raw message
arch/arm/mach-omap2/board-overo.c +2 -40
54 lines not on this page · raw message
arch/arm/mach-omap2/common-board-devices.c +42 -0
51 lines not on this page · raw message
arch/arm/mach-omap2/common-board-devices.h +10 -0
@@ -2,6 +2,7 @@#define __OMAP_COMMON_BOARD_DEVICES__struct twl4030_platform_data ; +struct mtd_partition ;void omap_pmic_init (int bus,u32 clkrate,const char *pmic_type,int pmic_irq,struct twl4030_platform_data *pmic_data);
@@ -39,4 +40,13 @@ static inline void omap_ads7846_init(int bus_num, }#endif +#if defined(CONFIG_MTD_NAND_OMAP2 ) || defined(CONFIG_MTD_NAND_OMAP2_MODULE ) +void omap_nand_flash_init (int opts,struct mtd_partition *parts,int n_parts); +#else +static inline void omap_nand_flash_init (int opts,struct mtd_partition *parts, +int nr_parts) +{ +} +#endif +#endif /* __OMAP_COMMON_BOARD_DEVICES__ */
Signature · 1 line
1.7.3.1
PATCH 3/4 omap: move detection of NAND CS to common-board-devices
Hello!
This patch breaks compile for me:
Quoted 3 lines · Mike Rapoport
arch/arm/mach-omap2/common-board-devices.c +0
-0@@ -29,6 +29,7 @@
...
Quoted 3 lines
arch/arm/mach-omap2/common-board-devices.c +3
-0+void __init omap_nand_flash_init (int options,struct mtd_partition *parts, +int nr_parts) +{
...
Quoted 6 lines
arch/arm/mach-omap2/common-board-devices.c +1
-0+}arch/arm/mach-omap2/common-board-devices.h +0
-0
arch/arm/mach-omap2/common-board-devices.h static inline void omap_ads7846_init(int bus_num, · line 49
Quoted 10 lines
arch/arm/mach-omap2/common-board-devices.h +7
-0@@ -39,4 +40,13 @@ static inline void omap_ads7846_init(int bus_num, }#endif +#if defined(CONFIG_MTD_NAND_OMAP2 ) || defined(CONFIG_MTD_NAND_OMAP2_MODULE ) +void omap_nand_flash_init (int opts,struct mtd_partition *parts,int n_parts); +#else +static inline void omap_nand_flash_init (int opts,struct mtd_partition *parts, +int nr_parts) +{ +}
arch/arm/mach-omap2/common-board-devices.c:113: error: redefinition of 'omap_nand_flash_init' arch/arm/mach-omap2/common-board-devices.h:46: note: previous definition of 'omap_nand_flash_init' was here
I don't have CONFIG_MTD_NAND_OMAP2 defined of course as there is no NAND flash on my board.
Bye,
Oleg
PATCH 3/4 omap: move detection of NAND CS to common-board-devices
Ok, so here's a simple patch to save everyone trouble, I guess.
Though on the other hand I can imagine that perhaps including this generic common-board-devices.c might not be desirable for people that don't use anything from that file.
Would it be a better idea to split it to a file-per-feature?
-------------- next part --------------
A non-text attachment was scrubbed...
Name: compile-fix.diff
Type: application/octet-stream
Size: 1123 bytes
Desc: not available
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20110504/b83fcf3f/attachment.obj>
PATCH 3/4 omap: move detection of NAND CS to common-board-devices
Quoted 4 lines · Oleg Drokin
Ok, so here's a simple patch to save everyone trouble, I guess.
Though on the other hand I can imagine that perhaps including this generic
common-board-devices.cmight not be desirable for people that don't use anything from that file.
Since the common-board-devices.c has TWL initialization I doubt there would a board that does not use it at all...
Quoted 1 line
Would it be a better idea to split it to a file-per-feature?
Splitting the common-board-devices into a file-per-feature will diminish its added value, IMO.
We can either continue to use #ifdef CONFIG_SOMETHING in both common-board-devices.[ch] as your fix proposes or just drop #ifdefs and inlines from the header.
Tony, what is your preference?
Signature · 2 lines
Sincerely yours, Mike.
Tony Lindgren
maintainerPATCH 3/4 omap: move detection of NAND CS to common-board-devices
Quoted 9 lines · Mike Rapoport
Quoted 4 lines · Oleg Drokin
Ok, so here's a simple patch to save everyone trouble, I guess.
Though on the other hand I can imagine that perhaps including this generic
common-board-devices.cmight not be desirable for people that don't use anything from that file.Since the
common-board-devices.chas TWL initialization I doubt there would a board that does not use it at all...
Quoted 8 lines
Quoted 1 line
Would it be a better idea to split it to a file-per-feature?
Splitting the common-board-devices into a file-per-feature will diminish its added value, IMO.
We can either continue to use #ifdefCONFIG_SOMETHINGin both common-board-devices.[ch] as your fix proposes or just drop #ifdefs and inlines from the header.
Tony, what is your preference?
We should consider the code size too.. Maybe see if you can make them weak instead of the ifdefs?
Tony
PATCH 3/4 omap: move detection of NAND CS to common-board-devices
Quoted 19 lines · Tony Lindgren
Quoted 9 lines · Mike Rapoport
Quoted 4 lines · Oleg Drokin
Ok, so here's a simple patch to save everyone trouble, I guess.
Though on the other hand I can imagine that perhaps including this generic
common-board-devices.cmight not be desirable for people that don't use anything from that file.Since the
common-board-devices.chas TWL initialization I doubt there would a board that does not use it at all...Quoted 8 lines
Quoted 1 line
Would it be a better idea to split it to a file-per-feature?
Splitting the common-board-devices into a file-per-feature will diminish its added value, IMO.
We can either continue to use #ifdefCONFIG_SOMETHINGin both common-board-devices.[ch] as your fix proposes or just drop #ifdefs and inlines from the header.
Tony, what is your preference?
Quoted 2 lines
We should consider the code size too.. Maybe see if you can make them weak instead of the ifdefs?
Unless I completely misunderstand how weak works, we'll still have ifdefs in .c file, i.e.
common-board-devices.h:
void __omap_nand_flash_init(int opts, struct mtd_partition *parts, int n_parts) {
}
void omap_nand_flash_init(int opts, struct mtd_partition *parts, int n_parts) __attribute__((weak, alias("__omap_nand_flash_init")));
common-board-devices.c:
#if defined(CONFIG_MTD_NAND_OMAP2) || defined(CONFIG_MTD_NAND_OMAP2_MODULE) void omap_nand_flash_init(int opts, struct mtd_partition *parts, int n_parts) {
...
}
#endif
Yet, we can keep the ifdefs only in common-board-devices.c and get rid if inlines in the header.
Also, all the code in common-board-devices.c is __init, so it's eventually dropped in runtime
Quoted 1 line
Tony
Signature · 2 lines
Sincerely yours, Mike.
Tony Lindgren
maintainerPATCH 3/4 omap: move detection of NAND CS to common-board-devices
Quoted 43 lines · Mike Rapoport
Quoted 19 lines · Tony Lindgren
Quoted 9 lines · Mike Rapoport
Quoted 4 lines · Oleg Drokin
Ok, so here's a simple patch to save everyone trouble, I guess.
Though on the other hand I can imagine that perhaps including this generic
common-board-devices.cmight not be desirable for people that don't use anything from that file.Since the
common-board-devices.chas TWL initialization I doubt there would a board that does not use it at all...Quoted 8 lines
Quoted 1 line
Would it be a better idea to split it to a file-per-feature?
Splitting the common-board-devices into a file-per-feature will diminish its added value, IMO.
We can either continue to use #ifdefCONFIG_SOMETHINGin both common-board-devices.[ch] as your fix proposes or just drop #ifdefs and inlines from the header.
Tony, what is your preference?Quoted 2 lines
We should consider the code size too.. Maybe see if you can make them weak instead of the ifdefs?
Unless I completely misunderstand how weak works, we'll still have ifdefs in .c file, i.e.
common-board-devices.h:void
__omap_nand_flash_init(int opts, struct mtd_partition *parts, int n_parts){
}void
omap_nand_flash_init(int opts, struct mtd_partition *parts, int n_parts)__attribute__((weak, alias("__omap_nand_flash_init")));
common-board-devices.c:
#ifdefined(CONFIG_MTD_NAND_OMAP2)||defined(CONFIG_MTD_NAND_OMAP2_MODULE)voidomap_nand_flash_init(int opts, struct mtd_partition *parts, int n_parts){
...
}
#endif
Quoted 4 lines
Yet, we can keep the ifdefs only in
common-board-devices.cand get rid if inlines in the header.
Also, all the code incommon-board-devices.cis__init, so it's eventually dropped in runtime
Sounds OK to me for the simple platform init functions used for most common devices.
For anything more complex, we can have a separate file with ifdef in the header and Makefile compiling it in only as selected.
Regards,
Tony
PATCH 3/4 omap: move detection of NAND CS to common-board-devices
In reply to Mike RapoportHello!
Quoted 7 lines · Mike Rapoport
Quoted 4 lines · Oleg Drokin
Ok, so here's a simple patch to save everyone trouble, I guess.
Though on the other hand I can imagine that perhaps including this generic
common-board-devices.cmight not be desirable for people that don't use anything from that file.Since the
common-board-devices.chas TWL initialization I doubt there would a board that does not use it at all...
Actually the twl init you have is somewhat inflexible.
E.g. on the Nook Color the 1st i2c bus has the twl and some other devices, but I don't see how to put more than just the twl on the first bus with your common code.
Bye,
Oleg
PATCH 4/4 omap: musb: introduce default baord config
In reply to Mike RapoportMost boards use exactly the same configuration for musb initialization. Create a default that can be shared amount different boards.
--- arch/arm/mach-omap2/board-2430sdp.c | 7 +------ arch/arm/mach-omap2/board-3430sdp.c | 8 +------- arch/arm/mach-omap2/board-cm-t35.c | 8 +------- arch/arm/mach-omap2/board-devkit8000.c | 8 +------- arch/arm/mach-omap2/board-igep0020.c | 8 +------- arch/arm/mach-omap2/board-igep0030.c | 8 +------- arch/arm/mach-omap2/board-ldp.c | 8 +------- arch/arm/mach-omap2/board-omap3beagle.c | 8 +------- arch/arm/mach-omap2/board-omap3pandora.c | 8 +------- arch/arm/mach-omap2/board-omap3stalker.c | 8 +------- arch/arm/mach-omap2/board-omap3touchbook.c | 8 +------- arch/arm/mach-omap2/board-overo.c | 8 +------- arch/arm/mach-omap2/board-rm680.c | 8 +------- arch/arm/mach-omap2/board-zoom-peripherals.c | 8 +------- arch/arm/mach-omap2/usb-musb.c | 14 +++++++++++++- 15 files changed, 27 insertions(+), 98 deletions(-)
arch/arm/mach-omap2/board-2430sdp.c +1 -6
@@ -208,11 +208,6 @@ static struct omap2_hsmmc_info mmc[] __initdata = { {}/* Terminator */ }; -static struct omap_musb_board_data musb_board_data = { - .interface_type =MUSB_INTERFACE_ULPI , - .mode =MUSB_OTG , - .power =100 , -};static struct omap_usb_config sdp2430_usb_config__initdata = { .otg =1 , #ifdef CONFIG_USB_GADGET_OMAP
@@ -246,7 +241,7 @@ static void __init omap_2430sdp_init(void)omap2_usbfs_init (&sdp2430_usb_config);omap_mux_init_signal ("usb0hs_stp" ,OMAP_PULL_ENA |OMAP_PULL_UP ); -usb_musb_init (&musb_board_data); +usb_musb_init (NULL );board_smc91x_init ();
arch/arm/mach-omap2/board-3430sdp.c +1 -7
@@ -810,12 +810,6 @@ static struct flash_partitions sdp_flash_partitions[] = { }, }; -static struct omap_musb_board_data musb_board_data = { - .interface_type =MUSB_INTERFACE_ULPI , - .mode =MUSB_OTG , - .power =100 , -}; -static void __init omap_3430sdp_init (void ) {int gpio_pendown;
@@ -832,7 +826,7 @@ static void __init omap_3430sdp_init(void) gpio_pendown =SDP3430_TS_GPIO_IRQ_SDPV1 ;omap_ads7846_init (1 , gpio_pendown,310 ,NULL );board_serial_init (); -usb_musb_init (&musb_board_data); +usb_musb_init (NULL );board_smc91x_init ();board_flash_init (sdp_flash_partitions, chip_sel_3430,0 );sdp3430_display_init ();
arch/arm/mach-omap2/board-cm-t35.c +1 -7
@@ -651,12 +651,6 @@ static struct omap_board_mux board_mux[] __initdata = { };#endif -static struct omap_musb_board_data musb_board_data = { - .interface_type =MUSB_INTERFACE_ULPI , - .mode =MUSB_OTG , - .power =100 , -}; -static struct omap_board_config_kernel cm_t35_config[]__initdata = { };
@@ -673,7 +667,7 @@ static void __init cm_t35_init(void)cm_t35_init_led ();cm_t35_init_display (); -usb_musb_init (&musb_board_data); +usb_musb_init (NULL );usbhs_init (&usbhs_bdata); }
arch/arm/mach-omap2/board-devkit8000.c +1 -7
@@ -509,12 +509,6 @@ static struct platform_device *devkit8000_devices[] __initdata = { &omap_dm9000_dev, }; -static struct omap_musb_board_data musb_board_data = { - .interface_type =MUSB_INTERFACE_ULPI , - .mode =MUSB_OTG , - .power =100 , -}; -static const struct usbhs_omap_board_data usbhs_bdata__initconst = { .port_mode[0 ] =OMAP_EHCI_PORT_MODE_PHY ,
@@ -698,7 +692,7 @@ static void __init devkit8000_init(void)omap_ads7846_init (2 ,OMAP3_DEVKIT_TS_GPIO ,0 ,NULL ); -usb_musb_init (&musb_board_data); +usb_musb_init (NULL );usbhs_init (&usbhs_bdata);omap_nand_flash_init (NAND_BUSWIDTH_16 , devkit8000_nand_partitions,ARRAY_SIZE (devkit8000_nand_partitions));
arch/arm/mach-omap2/board-igep0020.c +1 -7
@@ -559,12 +559,6 @@ static void __init igep2_i2c_init(void)pr_warning ("IGEP2: Could not register I2C3 bus (%d)\n" , ret); } -static struct omap_musb_board_data musb_board_data = { - .interface_type =MUSB_INTERFACE_ULPI , - .mode =MUSB_OTG , - .power =100 , -}; -static const struct usbhs_omap_board_data usbhs_bdata__initconst = { .port_mode[0 ] =OMAP_EHCI_PORT_MODE_PHY , .port_mode[1 ] =OMAP_USBHS_PORT_MODE_UNUSED ,
@@ -637,7 +631,7 @@ static void __init igep2_init(void)platform_add_devices (igep2_devices,ARRAY_SIZE (igep2_devices));omap_display_init (&igep2_dss_data);omap_serial_init (); -usb_musb_init (&musb_board_data); +usb_musb_init (NULL );usbhs_init (&usbhs_bdata);igep2_flash_init ();
arch/arm/mach-omap2/board-igep0030.c +1 -7
@@ -357,12 +357,6 @@ static int __init igep3_i2c_init(void)return 0 ; } -static struct omap_musb_board_data musb_board_data = { - .interface_type =MUSB_INTERFACE_ULPI , - .mode =MUSB_OTG , - .power =100 , -}; -#if defined(CONFIG_LIBERTAS_SDIO ) || defined(CONFIG_LIBERTAS_SDIO_MODULE )static void __init igep3_wifi_bt_init (void )
@@ -424,7 +418,7 @@ static void __init igep3_init(void)igep3_i2c_init ();platform_add_devices (igep3_devices,ARRAY_SIZE (igep3_devices));omap_serial_init (); -usb_musb_init (&musb_board_data); +usb_musb_init (NULL );usbhs_init (&usbhs_bdata);igep3_flash_init ();
arch/arm/mach-omap2/board-ldp.c +1 -7
@@ -294,12 +294,6 @@ static struct omap_board_mux board_mux[] __initdata = { };#endif -static struct omap_musb_board_data musb_board_data = { - .interface_type =MUSB_INTERFACE_ULPI , - .mode =MUSB_OTG , - .power =100 , -}; -static struct mtd_partition ldp_nand_partitions[] = {/* All the partition sizes are listed in terms of NAND block size */ {
@@ -342,7 +336,7 @@ static void __init omap_ldp_init(void)platform_add_devices (ldp_devices,ARRAY_SIZE (ldp_devices));omap_ads7846_init (1 ,54 ,310 ,NULL );omap_serial_init (); -usb_musb_init (&musb_board_data); +usb_musb_init (NULL );board_nand_init (ldp_nand_partitions,ARRAY_SIZE (ldp_nand_partitions),ZOOM_NAND_CS ,0 );
arch/arm/mach-omap2/board-omap3beagle.c +1 -7
@@ -551,12 +551,6 @@ static struct omap_board_mux board_mux[] __initdata = { };#endif -static struct omap_musb_board_data musb_board_data = { - .interface_type =MUSB_INTERFACE_ULPI , - .mode =MUSB_OTG , - .power =100 , -}; -static void __init beagle_opp_init (void ) {int r =0 ;
@@ -618,7 +612,7 @@ static void __init omap3_beagle_init(void)/* REVISIT leave DVI powered down until it's needed ... */ gpio_direction_output (170 , true); -usb_musb_init (&musb_board_data); +usb_musb_init (NULL );usbhs_init (&usbhs_bdata);omap_nand_flash_init (NAND_BUSWIDTH_16 , omap3beagle_nand_partitions,ARRAY_SIZE (omap3beagle_nand_partitions));
arch/arm/mach-omap2/board-omap3pandora.c +1 -7
@@ -633,12 +633,6 @@ static struct omap_board_mux board_mux[] __initdata = { };#endif -static struct omap_musb_board_data musb_board_data = { - .interface_type =MUSB_INTERFACE_ULPI , - .mode =MUSB_OTG , - .power =100 , -}; -static void __init omap3pandora_init (void ) {omap3_mux_init (board_mux,OMAP_PACKAGE_CBB );
@@ -652,7 +646,7 @@ static void __init omap3pandora_init(void) ARRAY_SIZE(omap3pandora_spi_board_info));omap_ads7846_init (1 ,OMAP3_PANDORA_TS_GPIO ,0 ,NULL );usbhs_init (&usbhs_bdata); -usb_musb_init (&musb_board_data); +usb_musb_init (NULL );gpmc_nand_init (&pandora_nand_data);/* Ensure SDRC pins are mux'd for self-refresh */
arch/arm/mach-omap2/board-omap3stalker.c +1 -7
@@ -526,12 +526,6 @@ static struct omap_board_mux board_mux[] __initdata = { };#endif -static struct omap_musb_board_data musb_board_data = { - .interface_type =MUSB_INTERFACE_ULPI , - .mode =MUSB_OTG , - .power =100 , -}; -static void __init omap3_stalker_init (void ) {omap3_mux_init (board_mux,OMAP_PACKAGE_CUS );
@@ -546,7 +540,7 @@ static void __init omap3_stalker_init(void)omap_display_init (&omap3_stalker_dss_data);omap_serial_init (); -usb_musb_init (&musb_board_data); +usb_musb_init (NULL );usbhs_init (&usbhs_bdata);omap_ads7846_init (1 ,OMAP3_STALKER_TS_GPIO ,310 ,NULL );
arch/arm/mach-omap2/board-omap3touchbook.c +1 -7
@@ -421,12 +421,6 @@ static int __init early_touchbook_revision(char *p) }early_param ("tbr" , early_touchbook_revision); -static struct omap_musb_board_data musb_board_data = { - .interface_type =MUSB_INTERFACE_ULPI , - .mode =MUSB_OTG , - .power =100 , -}; -static void __init omap3_touchbook_init (void ) {omap3_mux_init (board_mux,OMAP_PACKAGE_CBB );
@@ -447,7 +441,7 @@ static void __init omap3_touchbook_init(void)/* Touchscreen and accelerometer */ omap_ads7846_init (4 ,OMAP3_TS_GPIO ,310 , &ads7846_pdata); -usb_musb_init (&musb_board_data); +usb_musb_init (NULL );usbhs_init (&usbhs_bdata);omap_nand_flash_init (NAND_BUSWIDTH_16 , omap3touchbook_nand_partitions,ARRAY_SIZE (omap3touchbook_nand_partitions));
arch/arm/mach-omap2/board-overo.c +1 -7
@@ -551,12 +551,6 @@ static struct omap_board_mux board_mux[] __initdata = { };#endif -static struct omap_musb_board_data musb_board_data = { - .interface_type =MUSB_INTERFACE_ULPI , - .mode =MUSB_OTG , - .power =100 , -}; -static void __init overo_init (void ) {omap3_mux_init (board_mux,OMAP_PACKAGE_CBB );
@@ -565,7 +559,7 @@ static void __init overo_init(void)omap_serial_init ();omap_nand_flash_init (0 , overo_nand_partitions,ARRAY_SIZE (overo_nand_partitions)); -usb_musb_init (&musb_board_data); +usb_musb_init (NULL );usbhs_init (&usbhs_bdata);overo_spi_init ();overo_ads7846_init ();
arch/arm/mach-omap2/board-rm680.c +1 -7
@@ -144,17 +144,11 @@ static struct omap_board_mux board_mux[] __initdata = { };#endif -static struct omap_musb_board_data rm680_musb_data = { - .interface_type =MUSB_INTERFACE_ULPI , - .mode =MUSB_PERIPHERAL , - .power =100 , -}; -static void __init rm680_init (void ) {omap3_mux_init (board_mux,OMAP_PACKAGE_CBB );omap_serial_init (); -usb_musb_init (&rm680_musb_data); +usb_musb_init (NULL );rm680_peripherals_init (); }
arch/arm/mach-omap2/board-zoom-peripherals.c +1 -7
@@ -363,12 +363,6 @@ static int __init omap_i2c_init(void)return 0 ; } -static struct omap_musb_board_data musb_board_data = { - .interface_type =MUSB_INTERFACE_ULPI , - .mode =MUSB_OTG , - .power =100 , -}; -static void enable_board_wakeup_source (void ) {/* T2 interrupt line (keypad) */
@@ -383,7 +377,7 @@ void __init zoom_peripherals_init(void)omap_i2c_init ();platform_device_register (&omap_vwlan_device); -usb_musb_init (&musb_board_data); +usb_musb_init (NULL );enable_board_wakeup_source ();omap_serial_init (); }
arch/arm/mach-omap2/usb-musb.c +13 -1
@@ -108,7 +108,13 @@ static void usb_musb_mux_init(struct omap_musb_board_data *board_data) } } -void __init usb_musb_init (struct omap_musb_board_data *board_data) +static struct omap_musb_board_data musb_default_board_data = { + .interface_type =MUSB_INTERFACE_ULPI , + .mode =MUSB_OTG , + .power =100 , +}; + +void __init usb_musb_init (struct omap_musb_board_data *musb_board_data) {struct omap_hwmod *oh;struct omap_device *od;
@@ -116,6 +122,12 @@ void __init usb_musb_init(struct omap_musb_board_data *board_data)struct device *dev;int bus_id =-1 ;const char *oh_name, *name; +struct omap_musb_board_data *board_data; + +if (musb_board_data) + board_data = musb_board_data; +else + board_data = &musb_default_board_data;if (cpu_is_omap3517 () ||cpu_is_omap3505 ()) { }else if (cpu_is_omap44xx ()) {
Signature · 1 line
1.7.3.1
PATCH 4/4 omap: musb: introduce default baord config
Hello!
arch/arm/mach-omap2/usb-musb.c static void usb_musb_mux_init(struct omap_musb_board_data *board_data) · line 113
Quoted 4 lines · Mike Rapoport
arch/arm/mach-omap2/usb-musb.c +3
-1-void __init usb_musb_init (struct omap_musb_board_data *board_data) +static struct omap_musb_board_data musb_default_board_data = { + .interface_type =MUSB_INTERFACE_ULPI , + .mode =MUSB_OTG ,
In fact can you make it more generic with ifdefs like this?
(since there are tons of boards taht are client only or would like to be compiled in some other way):
+#ifdef CONFIG_USB_MUSB_OTG
+ .mode = MUSB_OTG,
+#elif defined(CONFIG_USB_MUSB_HDRC_HCD)
+ .mode = MUSB_HOST,
+#elif defined(CONFIG_USB_GADGET_MUSB_HDRC)
+ .mode = MUSB_PERIPHERAL,
+#endif
arch/arm/mach-omap2/usb-musb.c static void usb_musb_mux_init(struct omap_musb_board_data *board_data) · line 116
Quoted 3 lines
arch/arm/mach-omap2/usb-musb.c +3
-0+ .power = 100, +}; +
Thanks!
Bye,
Oleg
PATCH 4/4 omap: musb: introduce default baord config
Quoted 10 lines · Oleg Drokin
Hello!
arch/arm/mach-omap2/usb-musb.c static void usb_musb_mux_init(struct omap_musb_board_data *board_data) · line 113
Quoted 4 lines · Mike Rapoport
arch/arm/mach-omap2/usb-musb.c +3
-1-void __init usb_musb_init (struct omap_musb_board_data *board_data) +static struct omap_musb_board_data musb_default_board_data = { + .interface_type =MUSB_INTERFACE_ULPI , + .mode =MUSB_OTG ,In fact can you make it more generic with ifdefs like this?
(since there are tons of boards taht are client only or would like to be compiled in some other way):
I didn't want to change current functionality. The purpose of this patch is to reduce amount of code shared among board files.
If certain board needs mode other than OTG it can still pass musb_board_data.
Quoted 17 lines
(quoted diff) +7
-0+#ifdef CONFIG_USB_MUSB_OTG + .mode = MUSB_OTG, +#elif defined(CONFIG_USB_MUSB_HDRC_HCD) + .mode = MUSB_HOST, +#elif defined(CONFIG_USB_GADGET_MUSB_HDRC) + .mode = MUSB_PERIPHERAL, +#endifarch/arm/mach-omap2/usb-musb.c static void usb_musb_mux_init(struct omap_musb_board_data *board_data) · line 116
Quoted 4 lines
arch/arm/mach-omap2/usb-musb.c +3
-0+ .power = 100, +}; +Thanks!
Bye,
Oleg
Signature · 2 lines
Sincerely yours, Mike.
PATCH 4/4 omap: musb: introduce default baord config
In reply to Oleg DrokinQuoted 11 lines · Oleg Drokin
Hello!
arch/arm/mach-omap2/usb-musb.c static void usb_musb_mux_init(struct omap_musb_board_data *board_data) · line 113
Quoted 4 lines · Mike Rapoport
arch/arm/mach-omap2/usb-musb.c +3
-1-void __init usb_musb_init (struct omap_musb_board_data *board_data) +static struct omap_musb_board_data musb_default_board_data = { + .interface_type =MUSB_INTERFACE_ULPI , + .mode =MUSB_OTG ,In fact can you make it more generic with ifdefs like this?
(since there are tons of boards taht are client only or would like to be compiled in some other way):
Review
Quoted 7 lines
(quoted diff) +7
-0+#ifdef CONFIG_USB_MUSB_OTG + .mode = MUSB_OTG, +#elif defined(CONFIG_USB_MUSB_HDRC_HCD) + .mode = MUSB_HOST, +#elif defined(CONFIG_USB_GADGET_MUSB_HDRC) + .mode = MUSB_PERIPHERAL, +#endif
If this is something that's desired, then it should not be done via ifdefs but by platforms passing the mode argument into an initialization function. Eventually, when we switch to some DT like system, this is the kind of information that would be obtained from DT, and identifying this stuff now will help when DT stuff comes along.
PATCH 4/4 omap: musb: introduce default baord config
Hello!
Quoted 8 lines · Russell King - ARM Linux
Quoted 8 lines
Review
Quoted 4 lines
(quoted diff) +3
-1-void __init usb_musb_init(struct omap_musb_board_data *board_data) +static struct omap_musb_board_data musb_default_board_data = { + .interface_type = MUSB_INTERFACE_ULPI, + .mode = MUSB_OTG,In fact can you make it more generic with ifdefs like this?
(since there are tons of boards taht are client only or would like to be compiled in some other way):
Quoted 12 lines
Review
Quoted 7 lines
(quoted diff) +7
-0+#ifdef CONFIG_USB_MUSB_OTG + .mode = MUSB_OTG, +#elif defined(CONFIG_USB_MUSB_HDRC_HCD) + .mode = MUSB_HOST, +#elif defined(CONFIG_USB_GADGET_MUSB_HDRC) + .mode = MUSB_PERIPHERAL, +#endifIf this is something that's desired, then it should not be done via ifdefs but by platforms passing the mode argument into an initialization function. Eventually, when we switch to some DT like system, this is the kind of information that would be obtained from DT, and identifying this stuff now will help when DT stuff comes along.
Frankly, I am not even sure why the mode needs to be supplied by the board at all. The musb code already has a very similar switch in musb_plat and so it totally looks like a duplicated specification of the same thing from the board file and from generic musb code where the original init value is then ignored.
I see that in .29 the board file did not need to specify usb mode and it was all decided in musb-specific code, and I have no idea why that was later changed to the way it is now.
Would it just be better if a patch removing mode field from struct omap_musb_board_data is adopted like this (warning - not a real patch)?
arch/arm/mach-omap2/usb-musb.c +0 -1
@@ -129,7 +129,6 @@ void __init usb_musb_init(struct omap_musb_board_data *board musb_plat.clock ="ick" ; musb_plat.board_data = board_data; musb_plat.power = board_data->power >>1 ; - musb_plat.mode = board_data->mode; musb_plat.extvbus = board_data->extvbus;if (cpu_is_omap44xx ())
Bye,
Oleg
PATCH 4/4 omap: musb: introduce default baord config
Quoted 10 lines · Oleg Drokin
Frankly, I am not even sure why the mode needs to be supplied by the board at all. The musb code already has a very similar switch in
musb_platand so it totally looks like a duplicated specification of the same thing from the board file and from generic musb code where the original init value is then ignored.I see that in .29 the board file did not need to specify usb mode and it was all decided in musb-specific code, and I have no idea why that was later changed to the way it is now.
Would it just be better if a patch removing mode field from struct
omap_musb_board_datais adopted like this (warning - not a real patch)?
Hmm, it looks to me like we're ending up with two layers on top of each other, both trying to provide some kind of generic board interface.
I think they should be squashed together. And that:
static struct musb_hdrc_platform_data musb_plat = { #ifdef CONFIG_USB_MUSB_OTG
.mode = MUSB_OTG,
#elif defined(CONFIG_USB_MUSB_HDRC_HCD)
.mode = MUSB_HOST,
#elif defined(CONFIG_USB_GADGET_MUSB_HDRC)
.mode = MUSB_PERIPHERAL,
#endif
in usb-musb.c needs the same treatment as I mentioned in the previous message if it really is board specific. If not, I see no reason why the above can't go into the musb driver itself.
PATCH 4/4 omap: musb: introduce default baord config
Hello!
Quoted 14 lines · Russell King - ARM Linux
mm, it looks to me like we're ending up with two layers on top of each other, both trying to provide some kind of generic board interface.
I think they should be squashed together. And that:
static struct
musb_hdrc_platform_datamusb_plat= { #ifdefCONFIG_USB_MUSB_OTG
.mode =MUSB_OTG,
#elifdefined(CONFIG_USB_MUSB_HDRC_HCD)
.mode =MUSB_HOST,
#elifdefined(CONFIG_USB_GADGET_MUSB_HDRC)
.mode =MUSB_PERIPHERAL,
#endif
Quoted 3 lines
in
usb-musb.cneeds the same treatment as I mentioned in the previous message if it really is board specific. If not, I see no reason why the above can't go into the musb driver itself.
In the end it's chip dependent. And the musb can work in all three modes. Of course the board dictates if the power is supplied to the bus in host mode and such, but even that could be worked around as nokia 9x0 saga for USB host shows.
So to me it looks like something totally in realm of musb driver itself. Nothing bad happens if you configure your MUSB as say OTG while in fact only peripheral mode was implemented, it continues to work as it did. Of course enabling HOST mode may not magically make things work, but I suspect this could be addressed from Kconfig itself instead.
Now I totally expect musb maintainer to jump in and explain how many misconceptions I have ;)
Bye,
Oleg
Tony Lindgren
maintainerPATCH 4/4 omap: musb: introduce default baord config
Quoted 30 lines · Oleg Drokin
Hello!
Quoted 14 lines · Russell King - ARM Linux
mm, it looks to me like we're ending up with two layers on top of each other, both trying to provide some kind of generic board interface.
I think they should be squashed together. And that:
static struct
musb_hdrc_platform_datamusb_plat= { #ifdefCONFIG_USB_MUSB_OTG
.mode =MUSB_OTG,
#elifdefined(CONFIG_USB_MUSB_HDRC_HCD)
.mode =MUSB_HOST,
#elifdefined(CONFIG_USB_GADGET_MUSB_HDRC)
.mode =MUSB_PERIPHERAL,
#endifQuoted 3 lines
in
usb-musb.cneeds the same treatment as I mentioned in the previous message if it really is board specific. If not, I see no reason why the above can't go into the musb driver itself.In the end it's chip dependent. And the musb can work in all three modes. Of course the board dictates if the power is supplied to the bus in host mode and such, but even that could be worked around as nokia 9x0 saga for USB host shows.
So to me it looks like something totally in realm of musb driver itself. Nothing bad happens if you configure your MUSB as say OTG while in fact only peripheral mode was implemented, it continues to work as it did. Of course enabling HOST mode may not magically make things work, but I suspect this could be addressed fromKconfigitself instead.
Quoted 2 lines
Now I totally expect musb maintainer to jump in and explain how many misconceptions I have ;)
As far as I remember MUSB always relies on the OTG hardware to enable the host mode.. So I don't even know if the driver is usable with host only configuration. And for the peripheral mode, it should be possible to have OTG enabled, for cert testing some strings need to be changed in that case for peripheral only configuration.
I think Felipe already has some patches to remove the various Kconfig options for musb? In any case, the musb configuration should be a runtime configuration passed in the platform data or cmdline.
Regards,
Tony
PATCH 4/4 omap: musb: introduce default baord config
Quoted 31 lines · Tony Lindgren
Quoted 30 lines · Oleg Drokin
Hello!
Quoted 14 lines · Russell King - ARM Linux
mm, it looks to me like we're ending up with two layers on top of each other, both trying to provide some kind of generic board interface.
I think they should be squashed together. And that:
static struct
musb_hdrc_platform_datamusb_plat= { #ifdefCONFIG_USB_MUSB_OTG
.mode =MUSB_OTG,
#elifdefined(CONFIG_USB_MUSB_HDRC_HCD)
.mode =MUSB_HOST,
#elifdefined(CONFIG_USB_GADGET_MUSB_HDRC)
.mode =MUSB_PERIPHERAL,
#endifQuoted 3 lines
in
usb-musb.cneeds the same treatment as I mentioned in the previous message if it really is board specific. If not, I see no reason why the above can't go into the musb driver itself.In the end it's chip dependent. And the musb can work in all three modes. Of course the board dictates if the power is supplied to the bus in host mode and such, but even that could be worked around as nokia 9x0 saga for USB host shows.
So to me it looks like something totally in realm of musb driver itself. Nothing bad happens if you configure your MUSB as say OTG while in fact only peripheral mode was implemented, it continues to work as it did. Of course enabling HOST mode may not magically make things work, but I suspect this could be addressed fromKconfigitself instead.
Quoted 6 lines
Quoted 2 lines
Now I totally expect musb maintainer to jump in and explain how many misconceptions I have ;)
As far as I remember MUSB always relies on the OTG hardware to enable the host mode.. So I don't even know if the driver is usable with host only configuration. And for the peripheral mode, it should be
yes, it is :-)
Quoted 6 lines
possible to have OTG enabled, for cert testing some strings need to be changed in that case for peripheral only configuration.
I think Felipe already has some patches to remove the various
Kconfigoptions for musb? In any case, the musb configuration should be a runtime configuration passed in the platform data or cmdline.
Yeah, I'm planning to get rid of all the ifdeferry and always compile it with HOST and Peripheral support. It's only few extra tens of bytes anyway. Still, I doubt I can get that done for this merge window, I already have pending the debugging rework.
Signature · 1 line
balbi
Tony Lindgren
maintainerPATCH 4/4 omap: musb: introduce default baord config
Quoted 8 lines · Felipe Balbi
Quoted 7 lines · Tony Lindgren
Quoted 6 lines · Oleg Drokin
So to me it looks like something totally in realm of musb driver itself. Nothing bad happens if you configure your MUSB as say OTG while in fact only peripheral mode was implemented, it continues to work as it did. Of course enabling HOST mode may not magically make things work, but I suspect this could be addressed from
Kconfigitself instead.
So based on the discussion it sounds like we still the board specific configuration for the mode in some cases.
Quoted 8 lines
Quoted 3 lines
I think Felipe already has some patches to remove the various
Kconfigoptions for musb? In any case, the musb configuration should be a runtime configuration passed in the platform data or cmdline.Yeah, I'm planning to get rid of all the ifdeferry and always compile it with HOST and Peripheral support. It's only few extra tens of bytes anyway. Still, I doubt I can get that done for this merge window, I already have pending the debugging rework.
So care to ack the original patch then? It still allows overriding the default mode from board-*.c file as needed.
Regards,
Tony
PATCH v2 4/4 omap: musb: introduce default board config
In reply to Mike RapoportMost boards use exactly the same configuration for musb initialization. Create a default that can be shared amount different boards.
---
Fixed spelling in $SUBJ, thanks to Felipe Contreras
arch/arm/mach-omap2/board-2430sdp.c | 7 +------ arch/arm/mach-omap2/board-3430sdp.c | 8 +------- arch/arm/mach-omap2/board-cm-t35.c | 8 +------- arch/arm/mach-omap2/board-devkit8000.c | 8 +------- arch/arm/mach-omap2/board-igep0020.c | 8 +------- arch/arm/mach-omap2/board-igep0030.c | 8 +------- arch/arm/mach-omap2/board-ldp.c | 8 +------- arch/arm/mach-omap2/board-omap3beagle.c | 8 +------- arch/arm/mach-omap2/board-omap3pandora.c | 8 +------- arch/arm/mach-omap2/board-omap3stalker.c | 8 +------- arch/arm/mach-omap2/board-omap3touchbook.c | 8 +------- arch/arm/mach-omap2/board-overo.c | 8 +------- arch/arm/mach-omap2/board-rm680.c | 8 +------- arch/arm/mach-omap2/board-zoom-peripherals.c | 8 +------- arch/arm/mach-omap2/usb-musb.c | 14 +++++++++++++- 15 files changed, 27 insertions(+), 98 deletions(-)
arch/arm/mach-omap2/board-2430sdp.c +1 -6
@@ -208,11 +208,6 @@ static struct omap2_hsmmc_info mmc[] __initdata = { {}/* Terminator */ }; -static struct omap_musb_board_data musb_board_data = { - .interface_type =MUSB_INTERFACE_ULPI , - .mode =MUSB_OTG , - .power =100 , -};static struct omap_usb_config sdp2430_usb_config__initdata = { .otg =1 , #ifdef CONFIG_USB_GADGET_OMAP
@@ -246,7 +241,7 @@ static void __init omap_2430sdp_init(void)omap2_usbfs_init (&sdp2430_usb_config);omap_mux_init_signal ("usb0hs_stp" ,OMAP_PULL_ENA |OMAP_PULL_UP ); -usb_musb_init (&musb_board_data); +usb_musb_init (NULL );board_smc91x_init ();
arch/arm/mach-omap2/board-3430sdp.c +1 -7
@@ -810,12 +810,6 @@ static struct flash_partitions sdp_flash_partitions[] = { }, }; -static struct omap_musb_board_data musb_board_data = { - .interface_type =MUSB_INTERFACE_ULPI , - .mode =MUSB_OTG , - .power =100 , -}; -static void __init omap_3430sdp_init (void ) {int gpio_pendown;
@@ -832,7 +826,7 @@ static void __init omap_3430sdp_init(void) gpio_pendown =SDP3430_TS_GPIO_IRQ_SDPV1 ;omap_ads7846_init (1 , gpio_pendown,310 ,NULL );board_serial_init (); -usb_musb_init (&musb_board_data); +usb_musb_init (NULL );board_smc91x_init ();board_flash_init (sdp_flash_partitions, chip_sel_3430,0 );sdp3430_display_init ();
arch/arm/mach-omap2/board-cm-t35.c +1 -7
@@ -651,12 +651,6 @@ static struct omap_board_mux board_mux[] __initdata = { };#endif -static struct omap_musb_board_data musb_board_data = { - .interface_type =MUSB_INTERFACE_ULPI , - .mode =MUSB_OTG , - .power =100 , -}; -static struct omap_board_config_kernel cm_t35_config[]__initdata = { };
@@ -673,7 +667,7 @@ static void __init cm_t35_init(void)cm_t35_init_led ();cm_t35_init_display (); -usb_musb_init (&musb_board_data); +usb_musb_init (NULL );usbhs_init (&usbhs_bdata); }
arch/arm/mach-omap2/board-devkit8000.c +1 -7
@@ -509,12 +509,6 @@ static struct platform_device *devkit8000_devices[] __initdata = { &omap_dm9000_dev, }; -static struct omap_musb_board_data musb_board_data = { - .interface_type =MUSB_INTERFACE_ULPI , - .mode =MUSB_OTG , - .power =100 , -}; -static const struct usbhs_omap_board_data usbhs_bdata__initconst = { .port_mode[0 ] =OMAP_EHCI_PORT_MODE_PHY ,
@@ -698,7 +692,7 @@ static void __init devkit8000_init(void)omap_ads7846_init (2 ,OMAP3_DEVKIT_TS_GPIO ,0 ,NULL ); -usb_musb_init (&musb_board_data); +usb_musb_init (NULL );usbhs_init (&usbhs_bdata);omap_nand_flash_init (NAND_BUSWIDTH_16 , devkit8000_nand_partitions,ARRAY_SIZE (devkit8000_nand_partitions));
arch/arm/mach-omap2/board-igep0020.c +1 -7
@@ -559,12 +559,6 @@ static void __init igep2_i2c_init(void)pr_warning ("IGEP2: Could not register I2C3 bus (%d)\n" , ret); } -static struct omap_musb_board_data musb_board_data = { - .interface_type =MUSB_INTERFACE_ULPI , - .mode =MUSB_OTG , - .power =100 , -}; -static const struct usbhs_omap_board_data usbhs_bdata__initconst = { .port_mode[0 ] =OMAP_EHCI_PORT_MODE_PHY , .port_mode[1 ] =OMAP_USBHS_PORT_MODE_UNUSED ,
@@ -637,7 +631,7 @@ static void __init igep2_init(void)platform_add_devices (igep2_devices,ARRAY_SIZE (igep2_devices));omap_display_init (&igep2_dss_data);omap_serial_init (); -usb_musb_init (&musb_board_data); +usb_musb_init (NULL );usbhs_init (&usbhs_bdata);igep2_flash_init ();
arch/arm/mach-omap2/board-igep0030.c +1 -7
@@ -357,12 +357,6 @@ static int __init igep3_i2c_init(void)return 0 ; } -static struct omap_musb_board_data musb_board_data = { - .interface_type =MUSB_INTERFACE_ULPI , - .mode =MUSB_OTG , - .power =100 , -}; -#if defined(CONFIG_LIBERTAS_SDIO ) || defined(CONFIG_LIBERTAS_SDIO_MODULE )static void __init igep3_wifi_bt_init (void )
@@ -424,7 +418,7 @@ static void __init igep3_init(void)igep3_i2c_init ();platform_add_devices (igep3_devices,ARRAY_SIZE (igep3_devices));omap_serial_init (); -usb_musb_init (&musb_board_data); +usb_musb_init (NULL );usbhs_init (&usbhs_bdata);igep3_flash_init ();
arch/arm/mach-omap2/board-ldp.c +1 -7
@@ -294,12 +294,6 @@ static struct omap_board_mux board_mux[] __initdata = { };#endif -static struct omap_musb_board_data musb_board_data = { - .interface_type =MUSB_INTERFACE_ULPI , - .mode =MUSB_OTG , - .power =100 , -}; -static struct mtd_partition ldp_nand_partitions[] = {/* All the partition sizes are listed in terms of NAND block size */ {
@@ -342,7 +336,7 @@ static void __init omap_ldp_init(void)platform_add_devices (ldp_devices,ARRAY_SIZE (ldp_devices));omap_ads7846_init (1 ,54 ,310 ,NULL );omap_serial_init (); -usb_musb_init (&musb_board_data); +usb_musb_init (NULL );board_nand_init (ldp_nand_partitions,ARRAY_SIZE (ldp_nand_partitions),ZOOM_NAND_CS ,0 );
arch/arm/mach-omap2/board-omap3beagle.c +1 -7
@@ -551,12 +551,6 @@ static struct omap_board_mux board_mux[] __initdata = { };#endif -static struct omap_musb_board_data musb_board_data = { - .interface_type =MUSB_INTERFACE_ULPI , - .mode =MUSB_OTG , - .power =100 , -}; -static void __init beagle_opp_init (void ) {int r =0 ;
@@ -618,7 +612,7 @@ static void __init omap3_beagle_init(void)/* REVISIT leave DVI powered down until it's needed ... */ gpio_direction_output (170 , true); -usb_musb_init (&musb_board_data); +usb_musb_init (NULL );usbhs_init (&usbhs_bdata);omap_nand_flash_init (NAND_BUSWIDTH_16 , omap3beagle_nand_partitions,ARRAY_SIZE (omap3beagle_nand_partitions));
arch/arm/mach-omap2/board-omap3pandora.c +1 -7
@@ -633,12 +633,6 @@ static struct omap_board_mux board_mux[] __initdata = { };#endif -static struct omap_musb_board_data musb_board_data = { - .interface_type =MUSB_INTERFACE_ULPI , - .mode =MUSB_OTG , - .power =100 , -}; -static void __init omap3pandora_init (void ) {omap3_mux_init (board_mux,OMAP_PACKAGE_CBB );
@@ -652,7 +646,7 @@ static void __init omap3pandora_init(void) ARRAY_SIZE(omap3pandora_spi_board_info));omap_ads7846_init (1 ,OMAP3_PANDORA_TS_GPIO ,0 ,NULL );usbhs_init (&usbhs_bdata); -usb_musb_init (&musb_board_data); +usb_musb_init (NULL );gpmc_nand_init (&pandora_nand_data);/* Ensure SDRC pins are mux'd for self-refresh */
arch/arm/mach-omap2/board-omap3stalker.c +1 -7
@@ -526,12 +526,6 @@ static struct omap_board_mux board_mux[] __initdata = { };#endif -static struct omap_musb_board_data musb_board_data = { - .interface_type =MUSB_INTERFACE_ULPI , - .mode =MUSB_OTG , - .power =100 , -}; -static void __init omap3_stalker_init (void ) {omap3_mux_init (board_mux,OMAP_PACKAGE_CUS );
@@ -546,7 +540,7 @@ static void __init omap3_stalker_init(void)omap_display_init (&omap3_stalker_dss_data);omap_serial_init (); -usb_musb_init (&musb_board_data); +usb_musb_init (NULL );usbhs_init (&usbhs_bdata);omap_ads7846_init (1 ,OMAP3_STALKER_TS_GPIO ,310 ,NULL );
arch/arm/mach-omap2/board-omap3touchbook.c +1 -7
@@ -421,12 +421,6 @@ static int __init early_touchbook_revision(char *p) }early_param ("tbr" , early_touchbook_revision); -static struct omap_musb_board_data musb_board_data = { - .interface_type =MUSB_INTERFACE_ULPI , - .mode =MUSB_OTG , - .power =100 , -}; -static void __init omap3_touchbook_init (void ) {omap3_mux_init (board_mux,OMAP_PACKAGE_CBB );
@@ -447,7 +441,7 @@ static void __init omap3_touchbook_init(void)/* Touchscreen and accelerometer */ omap_ads7846_init (4 ,OMAP3_TS_GPIO ,310 , &ads7846_pdata); -usb_musb_init (&musb_board_data); +usb_musb_init (NULL );usbhs_init (&usbhs_bdata);omap_nand_flash_init (NAND_BUSWIDTH_16 , omap3touchbook_nand_partitions,ARRAY_SIZE (omap3touchbook_nand_partitions));
arch/arm/mach-omap2/board-overo.c +1 -7
@@ -551,12 +551,6 @@ static struct omap_board_mux board_mux[] __initdata = { };#endif -static struct omap_musb_board_data musb_board_data = { - .interface_type =MUSB_INTERFACE_ULPI , - .mode =MUSB_OTG , - .power =100 , -}; -static void __init overo_init (void ) {omap3_mux_init (board_mux,OMAP_PACKAGE_CBB );
@@ -565,7 +559,7 @@ static void __init overo_init(void)omap_serial_init ();omap_nand_flash_init (0 , overo_nand_partitions,ARRAY_SIZE (overo_nand_partitions)); -usb_musb_init (&musb_board_data); +usb_musb_init (NULL );usbhs_init (&usbhs_bdata);overo_spi_init ();overo_ads7846_init ();
arch/arm/mach-omap2/board-rm680.c +1 -7
@@ -144,17 +144,11 @@ static struct omap_board_mux board_mux[] __initdata = { };#endif -static struct omap_musb_board_data rm680_musb_data = { - .interface_type =MUSB_INTERFACE_ULPI , - .mode =MUSB_PERIPHERAL , - .power =100 , -}; -static void __init rm680_init (void ) {omap3_mux_init (board_mux,OMAP_PACKAGE_CBB );omap_serial_init (); -usb_musb_init (&rm680_musb_data); +usb_musb_init (NULL );rm680_peripherals_init (); }
arch/arm/mach-omap2/board-zoom-peripherals.c +1 -7
@@ -363,12 +363,6 @@ static int __init omap_i2c_init(void)return 0 ; } -static struct omap_musb_board_data musb_board_data = { - .interface_type =MUSB_INTERFACE_ULPI , - .mode =MUSB_OTG , - .power =100 , -}; -static void enable_board_wakeup_source (void ) {/* T2 interrupt line (keypad) */
@@ -383,7 +377,7 @@ void __init zoom_peripherals_init(void)omap_i2c_init ();platform_device_register (&omap_vwlan_device); -usb_musb_init (&musb_board_data); +usb_musb_init (NULL );enable_board_wakeup_source ();omap_serial_init (); }
arch/arm/mach-omap2/usb-musb.c +13 -1
@@ -108,7 +108,13 @@ static void usb_musb_mux_init(struct omap_musb_board_data *board_data) } } -void __init usb_musb_init (struct omap_musb_board_data *board_data) +static struct omap_musb_board_data musb_default_board_data = { + .interface_type =MUSB_INTERFACE_ULPI , + .mode =MUSB_OTG , + .power =100 , +}; + +void __init usb_musb_init (struct omap_musb_board_data *musb_board_data) {struct omap_hwmod *oh;struct omap_device *od;
@@ -116,6 +122,12 @@ void __init usb_musb_init(struct omap_musb_board_data *board_data)struct device *dev;int bus_id =-1 ;const char *oh_name, *name; +struct omap_musb_board_data *board_data; + +if (musb_board_data) + board_data = musb_board_data; +else + board_data = &musb_default_board_data;if (cpu_is_omap3517 () ||cpu_is_omap3505 ()) { }else if (cpu_is_omap44xx ()) {
Signature · 1 line
1.7.3.1
PATCH v2 4/4 omap: musb: introduce default board config
Hi,
Quoted 4 lines
Most boards use exactly the same configuration for musb initialization. Create a default that can be shared amount different boards.
Signed-off-by Mike Rapoport <[email protected]>
Signature · 1 line
balbi
cover omap: cleanup board files
In reply to Mike Rapoportping?
Quoted 49 lines · Mike Rapoport
Hi Tony,
These patches cleanup some of the common code in the board files. The changes
are basically almost mechanically move the code shared among several boards
into some common place.
There are a lot of places for further improvement, especially DSS and TWL
initialization. I'll try to find some time to sort these out as well.Special thanks to Igor Grinberg for the original idea :)
Mike Rapoport (4):
omap: consolidate touch screen initialization among different boards
omap: use common initialization for PMIC i2c bus
omap: move detection of NAND CS to common-board-devices
omap: musb: introduce default baord config
arch/arm/mach-omap2/Makefile| 2 +arch/arm/mach-omap2/board-2430sdp.c | 20 +--- arch/arm/mach-omap2/board-3430sdp.c | 85 ++------------- arch/arm/mach-omap2/board-4430sdp.c | 16 +---
arch/arm/mach-omap2/board-cm-t35.c| 78 +-------------arch/arm/mach-omap2/board-devkit8000.c| 119 +--------------------arch/arm/mach-omap2/board-igep0020.c| 23 +----arch/arm/mach-omap2/board-igep0030.c| 21 +---arch/arm/mach-omap2/board-ldp.c| 77 +-------------arch/arm/mach-omap2/board-omap3beagle.c| 66 +-----------arch/arm/mach-omap2/board-omap3evm.c| 72 +------------arch/arm/mach-omap2/board-omap3logic.c| 13 +--arch/arm/mach-omap2/board-omap3pandora.c| 69 +-----------arch/arm/mach-omap2/board-omap3stalker.c| 78 +-------------arch/arm/mach-omap2/board-omap3touchbook.c| 101 ++----------------arch/arm/mach-omap2/board-omap4panda.c| 17 +---arch/arm/mach-omap2/board-overo.c| 108 +------------------arch/arm/mach-omap2/board-rm680.c| 21 +---arch/arm/mach-omap2/board-rx51-peripherals.c| 13 +--arch/arm/mach-omap2/board-zoom-peripherals.c| 21 +---arch/arm/mach-omap2/common-board-devices.c| 148
++++++++++++++++++++++++++arch/arm/mach-omap2/common-board-devices.h| 52 +++++++++arch/arm/mach-omap2/usb-musb.c| 14 +++-23 files changed, 293 insertions(+), 941 deletions(-)create mode 100644
arch/arm/mach-omap2/common-board-devices.ccreate mode 100644arch/arm/mach-omap2/common-board-devices.h--
1.7.3.1
Tony Lindgren
maintainercover omap: cleanup board files
Quoted 1 line · Mike Rapoport
ping?
Looks OK to me, let's wait on Felipe's comments on the musb related stuff.
Tony
Tony Lindgren
maintainercover omap: cleanup board files
Quoted 5 lines · Tony Lindgren
Quoted 1 line · Mike Rapoport
ping?
Looks OK to me, let's wait on Felipe's comments on the musb related stuff.
Applying this series into devel-cleanup for next merge window.
Regards,
Tony