adding gpmc configuration functions, west bridge related
Subsystems (6)
PATCH 1/1 adding gpmc configuration functions, west bridge related
This patch implements gpmc configuration functions needed by westbridge device controller driver in staging tree. These functions currently implemented in staging tree. This patch is part of the effort to bring westbridge device controller driver out of staging tree.
Signed-off by: Sutharsan Ramamoorthy <sutharsan.ramamoorthy-/[email protected]>
---
arch/arm/mach-omap2/board-zoom-peripherals.c +4 -0
@@ -19,6 +19,7 @@#include <linux/regulator/fixed.h> #include <linux/wl12xx.h> #include <linux/mmc/host.h> +#include <linux/usb/cywb.h> #include <asm/mach-types.h> #include <asm/mach/arch.h>
@@ -348,6 +349,9 @@ void __init zoom_peripherals_init(void)omap_i2c_init ();platform_device_register (&omap_vwlan_device);usb_musb_init (&musb_board_data); +#ifdef CONFIG_WESTBRIDGE_ASTORIA +usb_cywb_init (); +#endif enable_board_wakeup_source ();omap_serial_init (); }
arch/arm/mach-omap2/Makefile +1 -0
@@ -182,6 +182,7 @@ obj-y += $(usbfs-m) $(usbfs-y) obj-y += usb-musb.o obj-$(CONFIG_MACH_OMAP2_TUSB6010) += usb-tusb6010.o obj-y += usb-ehci.o +obj-$(CONFIG_WESTBRIDGE_ASTORIA) += usb-cywb-pnand.o onenand-$(CONFIG_MTD_ONENAND_OMAP2) := gpmc-onenand.o obj-y += $(onenand-m) $(onenand-y)
arch/arm/mach-omap2/usb-cywb-pnand.c +171 -0
171 lines not on this page · raw message
drivers/staging/westbridge/astoria/arch/arm/mach-omap2/cyashalomap_kernel.c +15 -114
186 lines not on this page · raw message
drivers/staging/westbridge/astoria/arch/arm/plat-omap/include/mach/westbridge/westbridge-omap3-pnand-hal/cyashalomap_kernel.h +4 -1
@@ -32,6 +32,7 @@#include <linux/module.h> #include <linux/wait.h> #include <linux/string.h> +#include <linux/usb/cywb.h> /* include does not seem to work * moving for patch submission #include <mach/gpmc.h>
@@ -307,7 +308,9 @@ void cyashal_prn_buf(void *buf, uint16_* but are required to be called for this HAL. */ int start_o_m_a_p_kernel (const char *pgm, -cy_as_hal_device_tag *tag,cy_bool debug); +cy_as_hal_device_tag *tag, +struct cywb_platform_data *cywb_pd, +cy_bool debug);int stop_o_m_a_p_kernel (const char *pgm,cy_as_hal_device_tag tag);int omap_start_intr (cy_as_hal_device_tag tag);void cy_as_hal_set_ep_dma_mode (uint8_t ep,bool sg_xfer_enabled);
drivers/staging/westbridge/astoria/device/cyasdevice.c +10 -18
@@ -28,6 +28,7 @@#include <linux/firmware.h> #include <linux/platform_device.h> #include <linux/slab.h> +#include <linux/usb/cywb.h> /* moved for staging location * update/patch submission
@@ -57,6 +58,7 @@ static cyasdevice *cy_as_device_controllint cy_as_device_init_done;const char *dev_handle_name ="cy_astoria_dev_handle" ; +static int cyasdevice_initialize (void );#ifdef CONFIG_MACH_OMAP3_WESTBRIDGE_AST_PNAND_HAL extern void cy_as_hal_config_c_s_mux (void );#endif
@@ -172,6 +174,10 @@ static struct platform_device *westbridgstatic int __devinit wb_probe (struct platform_device *devptr) {cy_as_hal_print_message ("%s called\n" , __func__); + westbridge_pd = devptr; +if (cyasdevice_initialize () !=0 ) +return -ENODEV ; +return 0 ; }
@@ -229,8 +235,9 @@ static int cyasdevice_initialize(void)/* start OMAP HAL init instsnce */ if (!start_o_m_a_p_kernel (dev_handle_name, - &(cy_as_dev->hal_tag), cy_false)) { - + &(cy_as_dev->hal_tag), + westbridge_pd ? westbridge_pd->dev.platform_data :NULL , + cy_false)) {cy_as_hal_print_message ("<1>_cy_as_device: start OMAP34xx HAL failed\n" ); goto done;
@@ -267,16 +274,6 @@ static int cyasdevice_initialize(void) goto done; } - ret =platform_driver_register (&west_bridge_driver); -if (unlikely (ret <0 )) -return ret; - westbridge_pd =platform_device_register_simple ( -"west_bridge_dev" ,-1 ,NULL ,0 ); - -if (IS_ERR (westbridge_pd)) { -platform_driver_unregister (&west_bridge_driver); -return PTR_ERR (westbridge_pd); - }/* Load the firmware */ ret =request_firmware (&fw_entry,"west bridge fw" , &westbridge_pd->dev);
@@ -384,17 +381,12 @@ cy_as_hal_device_tag cyasdevice_gethalta }EXPORT_SYMBOL (cyasdevice_gethaltag); -/*init Westbridge device driver **/ static int __init cyasdevice_init (void ) { -if (cyasdevice_initialize () !=0 ) -return ENODEV ; - -return 0 ; +return platform_driver_register (&west_bridge_driver); } - static void __exit cyasdevice_cleanup(void) {
include/linux/usb/cywb.h +21 -0
@@ -0,0 +1,21 @@ +/* +* data structure declaration for passing gpmc configuration +* functions to westbridge device controller driver. +* usb-cywb-pnand.c defines the configuration functions +*/ + +#ifndef __LINUX_USB_CYWB_H +#define __LINUX_USB_CYWB_H + + +struct cywb_platform_data { +/* PNAND retime function */ +int (*retime)(void ); + +/* PNAND bus width configuration */ +void (*config_bus_width)(bool dbus16_enabled); +}; + +extern void usb_cywb_init (void ); + +#endif /* __LINUX_USB_CYWB_H */
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
Quoted 6 lines · Sutharsan Ramamoorthy
This patch implements gpmc configuration functions needed by westbridge device controller driver in staging tree. These functions currently implemented in staging tree. This patch is part of the effort to bring westbridge device controller driver out of staging tree.
Signed-off by: Sutharsan Ramamoorthy <[email protected]>
Close, but not quite.
Why remove your cypress.com email address here? That's who really is "signing off" on this patch, right?
Also, please note my previous comments about "lots more needs to be done to the driver before this can even start to move out of the staging tree". Moving these functions should be one of the _last_ things that happens, not the first.
Please work on cleaning up the code in the drivers/staging/westbridge/ directory first. When that is all done, _then_ we can start moving it out.
Ok?
thanks,
greg k-h
Tony Lindgren
maintainerQuoted 2 lines · Sutharsan Ramamoorthy
arch/arm/mach-omap2/usb-cywb-pnand.c +0
-0
...
Quoted 24 lines
arch/arm/mach-omap2/usb-cywb-pnand.c +24
-0+/* +* switch GPMC DATA bus mode +*/ +void cywb_gpmc_enable_16bit_bus (bool dbus16_enabled) +{ +u32 tmp32; + +/* +* disable gpmc CS4 operation 1st +*/ + tmp32 =gpmc_cs_read_reg (AST_GPMC_CS , +GPMC_CS_CONFIG7 ) & ~GPMC_CONFIG7_CSVALID ; +gpmc_cs_write_reg (AST_GPMC_CS ,GPMC_CS_CONFIG7 , tmp32); + +/* +* GPMC NAND data bus can be 8 or 16 bit wide +*/ +if (dbus16_enabled) { +gpmc_cs_write_reg (AST_GPMC_CS ,GPMC_CS_CONFIG1 , + (GPMC_CONFIG1_DEVICETYPE (2 ) | +GPMC_CONFIG1_WAIT_PIN_SEL (2 ) | +GPMC_CONFIG1_DEVICESIZE_16 )); + }else { + gpmc_cs_write_reg(AST_GPMC_CS, GPMC_CS_CONFIG1,
arch/arm/mach-omap2/usb-cywb-pnand.c line 75
Quoted 10 lines
arch/arm/mach-omap2/usb-cywb-pnand.c +10
-0+ (GPMC_CONFIG1_DEVICETYPE (2 ) | + GPMC_CONFIG1_WAIT_PIN_SEL(2))); + } + +/* +* re-enable astoria CS operation on GPMC +*/ +gpmc_cs_write_reg (AST_GPMC_CS ,GPMC_CS_CONFIG7 , + (tmp32 |GPMC_CONFIG7_CSVALID )); +}
This should be static, right?
Quoted 85 lines
arch/arm/mach-omap2/usb-cywb-pnand.c +85
-0+int cywb_pnand_platform_retime () +{ +u32 tmp32; +struct gpmc_timings timings; +int retval =0 ; + + +gpmc_cs_write_reg (AST_GPMC_CS ,GPMC_CS_CONFIG1 , + (GPMC_CONFIG1_DEVICETYPE (2 ) | +GPMC_CONFIG1_WAIT_PIN_SEL (2 ))); + +memset (&timings,0 ,sizeof (timings)); + +/* cs timing */ + timings.cs_on =WB_GPMC_CS_T_O_N ; + timings.cs_wr_off =WB_GPMC_BUSCYC_T ; + timings.cs_rd_off =WB_GPMC_BUSCYC_T ; + +/* adv timing */ + timings.adv_on =WB_GPMC_ADV_T_O_N ; + timings.adv_rd_off =WB_GPMC_BUSCYC_T ; + timings.adv_wr_off =WB_GPMC_BUSCYC_T ; + +/* oe timing */ + timings.oe_on =WB_GPMC_OE_T_O_N ; + timings.oe_off =WB_GPMC_OE_T_O_F_F ; + timings.access =WB_GPMC_RD_T_A_C_C ; + timings.rd_cycle =WB_GPMC_BUSCYC_T ; + +/* we timing */ + timings.we_on =WB_GPMC_WE_T_O_N ; + timings.we_off =WB_GPMC_WE_T_O_F_F ; + timings.wr_access =WB_GPMC_WR_T_A_C_C ; + timings.wr_cycle =WB_GPMC_BUSCYC_T ; + + timings.page_burst_access =WB_GPMC_BUSCYC_T ; + timings.wr_data_mux_bus =WB_GPMC_BUSCYC_T ; +gpmc_cs_set_timings (AST_GPMC_CS , &timings); + +/* +* DISABLE cs4, NOTE GPMC REG7 is already configured +* at this point by gpmc_cs_request +*/ + tmp32 =gpmc_cs_read_reg (AST_GPMC_CS ,GPMC_CS_CONFIG7 ) & + ~GPMC_CONFIG7_CSVALID ; +gpmc_cs_write_reg (AST_GPMC_CS ,GPMC_CS_CONFIG7 , tmp32); + +/* +* PROGRAM chip select Region, (see OMAP3430 TRM PAGE 1088) +*/ +gpmc_cs_write_reg (AST_GPMC_CS ,GPMC_CS_CONFIG7 , + (AS_CS_MASK |AS_CS_BADDR )); + +/* +* by default configure GPMC into 8 bit mode +* (to match astoria default mode) +*/ +gpmc_cs_write_reg (AST_GPMC_CS ,GPMC_CS_CONFIG1 , + (GPMC_CONFIG1_DEVICETYPE (2 ) | +GPMC_CONFIG1_WAIT_PIN_SEL (2 ))); + +/* +* ENABLE astoria cs operation on GPMC +*/ +gpmc_cs_write_reg (AST_GPMC_CS ,GPMC_CS_CONFIG7 , + (tmp32 |GPMC_CONFIG7_CSVALID )); + +return retval; + +} + +static struct cywb_platform_data cywb_plat = { + .retime = cywb_pnand_platform_retime, + .config_bus_width = cywb_gpmc_enable_16bit_bus, +}; + +static struct platform_device cywb_device = { + .name ="west_bridge_dev" , + .id =-1 , + .dev = { + .platform_data = &cywb_plat, + } +}; + +#ifdef CONFIG_WESTBRIDGE_ASTORIA
arch/arm/mach-omap2/usb-cywb-pnand.c line 171
Quoted 10 lines
arch/arm/mach-omap2/usb-cywb-pnand.c +10
-0+void __init usb_cywb_init () +{ +if (platform_device_register (&cywb_device) <0 ) +dev_err (&cywb_device.dev,"Unable to register cywb-astoria device\n" ); +} +#else +void __init usb_cywb_init () +{ +} +#endif /* CONFIG_WESTBRIDGE_ASTORIA */
Can you also move gpmc_cs_request to this file too?
Regards,
Tony