Support for SM502 on PCI bus
cover Support for SM502 on PCI bus
This patch series adds support for SM502 on ICON
board.
Anatolij Gustschin (3):
video: sm501: add support for SM501 chips on PCI bus
video: sm501.c: add weak default functions
ppc4xx: icon: add support for SM502 chip
board/mosaixtech/icon/icon.c | 69 +++++++++++++++++++++++++ drivers/video/sm501.c | 117 ++++++++++++++++++++++++++++++++++++++++-- include/configs/icon.h | 23 ++++++++ include/pci_ids.h | 1 + 4 files changed, 205 insertions(+), 5 deletions(-)
PATCH 1/3 video: sm501: add support for SM501 chips on PCI bus
--- drivers/video/sm501.c | 89 ++++++++++++++++++++++++++++++++++++++++++++++--- include/pci_ids.h | 1 + 2 files changed, 85 insertions(+), 5 deletions(-)
drivers/video/sm501.c +84 -5
@@ -31,6 +31,7 @@#include <common.h> +#include <asm/io.h> #include <video_fb.h> #include <sm501.h>
@@ -54,6 +55,18 @@GraphicDevice sm501; +void write_be32 (int off,unsigned int val) +{ +out_be32 ((unsigned __iomem *)(sm501.isaBase + off), val); +} + +void write_le32 (int off,unsigned int val) +{ +out_le32 ((unsigned __iomem *)(sm501.isaBase + off), val); +} + +void (*write_reg32)(int off,unsigned int val) = write_be32; +/*----------------------------------------------------------------------------- * SmiSetRegs -- *-----------------------------------------------------------------------------
@@ -66,7 +79,7 @@ static void SmiSetRegs (void)*/ const SMI_REGS *preg =board_get_regs ();while (preg->Index) { -write32 (preg->Index, preg->Value); +write_reg32 (preg->Index, preg->Value);/* * Insert a delay between */
@@ -75,26 +88,92 @@ static void SmiSetRegs (void) } } +#ifdef CONFIG_VIDEO_SM501_PCI +static struct pci_device_id sm501_pci_tbl[] = { + {PCI_VENDOR_ID_SMI ,PCI_DEVICE_ID_SMI_501 }, + {} +}; +#endif +/*----------------------------------------------------------------------------- * video_hw_init -- *----------------------------------------------------------------------------- */ void *video_hw_init (void ) { +#ifdef CONFIG_VIDEO_SM501_PCI +unsigned int pci_mem_base, pci_mmio_base; +unsigned int id; +unsigned short device_id; +pci_dev_t devbusfn; +int mem; +#endif unsigned int *vm, i;memset (&sm501,0 ,sizeof (GraphicDevice)); +#ifdef CONFIG_VIDEO_SM501_PCI +printf ("Video: " ); + +/* Look for SM501/SM502 chips */ + devbusfn =pci_find_devices (sm501_pci_tbl,0 ); +if (devbusfn <0 ) { +printf ("PCI Controller not found.\n" ); + goto not_pci; + } + +/* Setup */ +pci_write_config_dword (devbusfn,PCI_COMMAND , + (PCI_COMMAND_MEMORY |PCI_COMMAND_IO )); +pci_read_config_word (devbusfn,PCI_DEVICE_ID , &device_id); +pci_read_config_dword (devbusfn,PCI_REVISION_ID , &id); +pci_read_config_dword (devbusfn,PCI_BASE_ADDRESS_0 , &pci_mem_base); +pci_read_config_dword (devbusfn,PCI_BASE_ADDRESS_1 , &pci_mmio_base); + sm501.frameAdrs =pci_mem_to_phys (devbusfn, pci_mem_base); + sm501.isaBase =pci_mem_to_phys (devbusfn, pci_mmio_base); + +if (sm501.isaBase) + write_reg32 = write_le32; + + mem =in_le32 ((unsigned __iomem *)(sm501.isaBase +0x10 )); + mem = (mem &0x0000e000 ) >>13 ; +switch (mem) { +case 1 : + mem =8 ; +break ; +case 2 : + mem =16 ; +break ; +case 3 : + mem =32 ; +break ; +case 4 : + mem =64 ; +break ; +case 5 : + mem =2 ; +break ; +case 0 : +default : + mem =4 ; + } +printf ("PCI SM50%d %d MB\n" , ((id &0xff ) ==0xC0 ) ?2 :1 , mem); +not_pci: +#endif /* * Initialization of the access to the graphic chipset Retreive base * address of the chipset (see board/RPXClassic/eccx.c) */ -if ((sm501.isaBase =board_video_init ()) ==0 ) { -return (NULL ); +if (!sm501.isaBase) { + sm501.isaBase =board_video_init (); +if (!sm501.isaBase) +return NULL ; } -if ((sm501.frameAdrs =board_video_get_fb ()) ==0 ) { -return (NULL ); +if (!sm501.frameAdrs) { + sm501.frameAdrs =board_video_get_fb (); +if (!sm501.frameAdrs) +return NULL ; } sm501.winSizeX =board_get_width ();
include/pci_ids.h +1 -0
@@ -1454,6 +1454,7 @@#define PCI_DEVICE_ID_SMI_710 0x0710#define PCI_DEVICE_ID_SMI_712 0x0712#define PCI_DEVICE_ID_SMI_810 0x0810 +#define PCI_DEVICE_ID_SMI_501 0x0501#define PCI_VENDOR_ID_HUGHES 0x1273#define PCI_DEVICE_ID_HUGHES_DIRECPC 0x0002
Signature · 1 line
1.6.2.5
PATCH 1/3 video: sm501: add support for SM501 chips on PCI bus
Quoted 5 lines · On Wed, 26 May 2010 10:38:57 +0200 Anatolij Gustschin <[email protected]> wrote:
Signed-off-by Anatolij Gustschin <[email protected]>--- drivers/video/sm501.c | 89 ++++++++++++++++++++++++++++++++++++++++++++++--- include/pci_ids.h | 1 + 2 files changed, 85 insertions(+), 5 deletions(-)
Applied to u-boot-video/next.
Anatolij
PATCH 2/3 video: sm501.c: add weak default functions
In reply to Anatolij GustschinFor boards using sm501/sm502 on PCI bus some driver functions normaly defined in the board code are not needed and empty. Provide weak default functions for them and do not enforce board code to define empty functions.
--- drivers/video/sm501.c | 28 ++++++++++++++++++++++++++++ 1 files changed, 28 insertions(+), 0 deletions(-)
drivers/video/sm501.c +28 -0
@@ -95,6 +95,34 @@ static struct pci_device_id sm501_pci_tbl[] = { };#endif +/* +* We do not enforce board code to provide empty/unused +* functions for this driver and define weak default +* functions here. +*/ +unsigned int __board_video_init (void ) +{ +return 0 ; +} + +unsigned int board_video_init (void ) + __attribute__((weak,alias ("__board_video_init" ))); + +unsigned int __board_video_get_fb (void ) +{ +return 0 ; +} + +unsigned int board_video_get_fb (void ) + __attribute__((weak,alias ("__board_video_get_fb" ))); + +void __board_validate_screen (unsigned int base) +{ +} + +void board_validate_screen (unsigned int base) + __attribute__((weak,alias ("__board_validate_screen" ))); +/*----------------------------------------------------------------------------- * video_hw_init -- *-----------------------------------------------------------------------------
Signature · 1 line
1.6.2.5
PATCH 2/3 video: sm501.c: add weak default functions
Quoted 10 lines · On Wed, 26 May 2010 10:38:58 +0200 Anatolij Gustschin <[email protected]> wrote:
For boards using sm501/sm502 on PCI bus some driver functions normaly defined in the board code are not needed and empty. Provide weak default functions for them and do not enforce board code to define empty functions.
Signed-off-by Anatolij Gustschin <[email protected]>--- drivers/video/sm501.c | 28 ++++++++++++++++++++++++++++ 1 files changed, 28 insertions(+), 0 deletions(-)
Applied to u-boot-video/next.
Anatolij
PATCH 3/3 ppc4xx: icon: add support for SM502 chip
In reply to Anatolij GustschinAdds initialization code for SM502 graphics controller and NL6448BC20-21D LCD panel.
--- board/mosaixtech/icon/icon.c | 69 ++++++++++++++++++++++++++++++++++++++++++ include/configs/icon.h | 23 ++++++++++++++ 2 files changed, 92 insertions(+), 0 deletions(-)
board/mosaixtech/icon/icon.c +69 -0
@@ -317,3 +317,72 @@ int board_pcie_last(void)/* Only 2 PCIe ports used on ICON, so the last one is 1 */ return 1 ; } + +/* +* Video +*/ +#ifdef CONFIG_VIDEO_SM501 +#include <sm501.h> + +#define DISPLAY_WIDTH 640 +#define DISPLAY_HEIGHT 480 + +static const SMI_REGS sm502_init_regs[] = { + {0x00004 ,0x0 }, + {0x00040 ,0x00021847 }, + {0x00044 ,0x091a0a01 },/* 24 MHz pixclk */ + {0x00054 ,0x0 }, + {0x00048 ,0x00021847 }, + {0x0004C ,0x091a0a01 }, + {0x00054 ,0x1 }, + {0x80004 ,0xc428bb17 }, + {0x8000C ,0x00000000 }, + {0x80010 ,0x0a000a00 }, + {0x80014 ,0x02800000 }, + {0x80018 ,0x01e00000 }, + {0x8001C ,0x00000000 }, + {0x80020 ,0x01e00280 }, + {0x80024 ,0x02fa027f }, + {0x80028 ,0x004a0280 }, + {0x8002C ,0x020c01df }, + {0x80030 ,0x000201e7 }, + {0x80200 ,0x00010000 }, + {0x00008 ,0x20000000 },/* gpio29 is pwm0, LED_PWM */ + {0x0000C ,0x3f000000 },/* gpio56 - gpio61 as flat panel data pins */ + {0x10020 ,0x25725728 },/* 20 kHz pwm0, 50 % duty cycle, disabled */ + {0x80000 ,0x0f010106 },/* vsync & hsync pos, disp on */ + {0 ,0 } +}; + +/* +* Return a pointer to the register initialization table. +*/ +const SMI_REGS *board_get_regs (void ) +{ +return sm502_init_regs; +} + +int board_get_width (void ) +{ +return DISPLAY_WIDTH ; +} + +int board_get_height (void ) +{ +return DISPLAY_HEIGHT ; +} + +#ifdef CONFIG_CONSOLE_EXTRA_INFO +/* +* Return text to be printed besides the logo. +*/ +void video_get_info_str (int line_number,char *info) +{ +if (line_number ==1 ) +strcpy (info," Board: ICON" ); +else + info[0 ] ='\0' ; +} +#endif + +#endif /* CONFIG_VIDEO_SM501 */
include/configs/icon.h +23 -0
@@ -143,6 +143,26 @@#define CONFIG_SYS_M41T11_BASE_YEAR 1900/* play along with linux */ /* +* Video options +*/ +#define CONFIG_VIDEO + +#ifdef CONFIG_VIDEO +#define CONFIG_VIDEO_SM501 +#define CONFIG_VIDEO_SM501_32BPP +#define CONFIG_VIDEO_SM501_PCI +#define VIDEO_FB_LITTLE_ENDIAN +#define CONFIG_CFB_CONSOLE +#define CONFIG_VIDEO_LOGO +#define CONFIG_CONSOLE_EXTRA_INFO +#define CONFIG_VGA_AS_SINGLE_DEVICE +#define CONFIG_VIDEO_SW_CURSOR +#define CONFIG_VIDEO_BMP_RLE8 +#define CONFIG_SPLASH_SCREEN +#define CFG_CONSOLE_IS_IN_ENV +#endif + +/* * Environment */ #define CONFIG_ENV_IS_IN_FLASH 1/* Environment uses flash */
@@ -171,6 +191,9 @@#define CONFIG_CMD_PCI #define CONFIG_CMD_SDRAM #define CONFIG_CMD_SNTP +#ifdef CONFIG_VIDEO +#define CONFIG_CMD_BMP +#endif #define CONFIG_IBM_EMAC4_V4 /* 440SPe has this EMAC version */ #define CONFIG_PHY_ADDR 1/* PHY address, See schematics */
Signature · 1 line
1.6.2.5
PATCH 3/3 ppc4xx: icon: add support for SM502 chip
Dear Anatolij Gustschin,
Quoted 9 lines · In message <[email protected]> you wrote:
Adds initialization code for SM502 graphics controller and NL6448BC20-21D LCD panel.
Signed-off-by Anatolij Gustschin <[email protected]>Cc Stefan Roese <[email protected]>--- board/mosaixtech/icon/icon.c | 69 ++++++++++++++++++++++++++++++++++++++++++ include/configs/icon.h | 23 ++++++++++++++ 2 files changed, 92 insertions(+), 0 deletions(-)
As Stefan is on vacation, I jump in and apply this to "next".
Thanks.
Best regards,
Wolfgang Denk
Signature · 4 lines
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de Prediction is very difficult, especially of the future. - Niels Bohr