* [PATCH] atyfb updates
@ 2003-10-10 16:05 Geert Uytterhoeven
2003-10-10 19:12 ` Daniël Mantione
0 siblings, 1 reply; 6+ messages in thread
From: Geert Uytterhoeven @ 2003-10-10 16:05 UTC (permalink / raw)
To: Daniël Mantione, Marcelo Tosatti; +Cc: Linux Kernel Development
This one is still needed to get atyfb compiled when Mach64 GX support is
enabled.
Daniël: no, I haven't changed the M64_HAS(GTB_DSP) test yet.
---------- Forwarded message ----------
Hoi Daniël,
Here are some more updates for atyfb, while trying to build the Atari[*]
support (Mach64 GX only):
- ram_resv[] is needed for Mach64 GX, too.
- Move declaration of v, since it's used for generic LCD only.
- aty_ld_pll() used to be global, but now it's defined for Mach64 CT only,
causing a link failure if you don't enable Mach64 CT support.
Since Mach64 GX never has a GTB-style DSP, make that part of the code
Mach64 CT dependant.
- Move declaration of pll_ref_div, since it's used for Mach64 CT only.
- Kill warnings when ioremap()ing in the Atari case.
- Add missing xres parameter to Mach64 GX aty_var_to_pll_*() routines.
Most of these problems should show up on ia32 too if you enable Mach64 GX.
[*] Caveat: I don't have Atari hardware, just doing compile tests.
--- linux-2.4.23-pre5/drivers/video/aty/atyfb_base.c Mon Sep 22 08:43:06 2003
+++ linux-m68k-2.4.23-pre5/drivers/video/aty/atyfb_base.c Mon Sep 22 21:51:41 2003
@@ -382,6 +382,7 @@
#if defined(CONFIG_FB_ATY_GX) || defined(CONFIG_FB_ATY_CT)
static char ram_dram[] __initdata = "DRAM";
+static char ram_resv[] __initdata = "RESV";
#endif /* CONFIG_FB_ATY_GX || CONFIG_FB_ATY_CT */
#ifdef CONFIG_FB_ATY_GX
@@ -394,7 +395,6 @@
static char ram_sgram[] __initdata = "SGRAM";
static char ram_wram[] __initdata = "WRAM";
static char ram_off[] __initdata = "OFF";
-static char ram_resv[] __initdata = "RESV";
#endif /* CONFIG_FB_ATY_CT */
#ifdef CONFIG_FB_ATY_GX
@@ -487,8 +487,6 @@
static void aty_set_crtc(const struct fb_info_aty *info,
const struct crtc *crtc)
{
- u32 v;
-
aty_st_le32(CRTC_H_TOTAL_DISP, crtc->h_tot_disp, info);
aty_st_le32(CRTC_H_SYNC_STRT_WID, crtc->h_sync_strt_wid, info);
#ifdef CONFIG_FB_ATY_GENERIC_LCD
@@ -522,6 +520,7 @@
registers.
*/
if (info->lcd_table != 0) {
+ u32 v;
/* Enable/disable horizontal stretching */
v = aty_ld_lcd(HORZ_STRETCHING, info);
v = v & ~(HORZ_STRETCH_RATIO | HORZ_STRETCH_EN | AUTO_HORZ_RATIO |
@@ -1984,7 +1983,6 @@
#if defined(CONFIG_PPC)
int sense;
#endif
- u8 pll_ref_div;
u32 monitors_enabled;
info->aty_cmap_regs = (struct aty_cmap_regs *)(info->ati_regbase+0xc0);
@@ -2094,19 +2092,24 @@
info->ref_clk_per = 1000000000000ULL/14318180;
xtal = "14.31818";
- if (M64_HAS(GTB_DSP) && (pll_ref_div = aty_ld_pll(PLL_REF_DIV, info))) {
- int diff1, diff2;
- diff1 = 510*14/pll_ref_div-pll;
- diff2 = 510*29/pll_ref_div-pll;
- if (diff1 < 0)
- diff1 = -diff1;
- if (diff2 < 0)
- diff2 = -diff2;
- if (diff2 < diff1) {
- info->ref_clk_per = 1000000000000ULL/29498928;
- xtal = "29.498928";
- }
+#ifdef CONFIG_FB_ATY_CT
+ if (M64_HAS(GTB_DSP)) {
+ u8 pll_ref_div = aty_ld_pll(PLL_REF_DIV, info);
+ if (pll_ref_div) {
+ int diff1, diff2;
+ diff1 = 510*14/pll_ref_div-pll;
+ diff2 = 510*29/pll_ref_div-pll;
+ if (diff1 < 0)
+ diff1 = -diff1;
+ if (diff2 < 0)
+ diff2 = -diff2;
+ if (diff2 < diff1) {
+ info->ref_clk_per = 1000000000000ULL/29498928;
+ xtal = "29.498928";
+ }
+ }
}
+#endif /* CONFIG_FB_ATY_CT */
i = aty_ld_le32(MEM_CNTL, info);
gtb_memsize = M64_HAS(GTB_DSP);
@@ -2992,9 +2995,11 @@
* Map the video memory (physical address given) to somewhere in the
* kernel address space.
*/
- info->frame_buffer = ioremap(phys_vmembase[m64_num], phys_size[m64_num]);
+ info->frame_buffer = (unsigned long)ioremap(phys_vmembase[m64_num],
+ phys_size[m64_num]);
info->frame_buffer_phys = info->frame_buffer; /* Fake! */
- info->ati_regbase = ioremap(phys_guiregbase[m64_num], 0x10000)+0xFC00ul;
+ info->ati_regbase = (unsigned long)ioremap(phys_guiregbase[m64_num],
+ 0x10000)+0xFC00ul;
info->ati_regbase_phys = info->ati_regbase; /* Fake! */
aty_st_le32(CLOCK_CNTL, 0x12345678, info);
--- linux-2.4.23-pre5/drivers/video/aty/mach64_gx.c Sat Sep 13 16:29:48 2003
+++ linux-m68k-2.4.23-pre5/drivers/video/aty/mach64_gx.c Mon Sep 22 13:01:58 2003
@@ -124,7 +124,7 @@
}
static int aty_var_to_pll_514(const struct fb_info_aty *info, u32 vclk_per,
- u8 bpp, union aty_pll *pll)
+ u8 bpp, u32 xres, union aty_pll *pll)
{
/*
* FIXME: use real calculations instead of using fixed values from the old
@@ -325,7 +325,7 @@
*/
static int aty_var_to_pll_18818(const struct fb_info_aty *info, u32 vclk_per,
- u8 bpp, union aty_pll *pll)
+ u8 bpp, u32 xres, union aty_pll *pll)
{
u32 MHz100; /* in 0.01 MHz */
u32 program_bits;
@@ -481,7 +481,7 @@
*/
static int aty_var_to_pll_1703(const struct fb_info_aty *info, u32 vclk_per,
- u8 bpp, union aty_pll *pll)
+ u8 bpp, u32 xres, union aty_pll *pll)
{
u32 mhz100; /* in 0.01 MHz */
u32 program_bits;
@@ -595,7 +595,7 @@
*/
static int aty_var_to_pll_8398(const struct fb_info_aty *info, u32 vclk_per,
- u8 bpp, union aty_pll *pll)
+ u8 bpp, u32 xres, union aty_pll *pll)
{
u32 tempA, tempB, fOut, longMHz100, diff, preDiff;
@@ -723,7 +723,7 @@
*/
static int aty_var_to_pll_408(const struct fb_info_aty *info, u32 vclk_per,
- u8 bpp, union aty_pll *pll)
+ u8 bpp, u32 xres, union aty_pll *pll)
{
u32 mhz100; /* in 0.01 MHz */
u32 program_bits;
Gr{oetje,eeting}s,
Geert
--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org
In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] atyfb updates
2003-10-10 16:05 [PATCH] atyfb updates Geert Uytterhoeven
@ 2003-10-10 19:12 ` Daniël Mantione
2003-10-21 20:19 ` Olaf Hering
0 siblings, 1 reply; 6+ messages in thread
From: Daniël Mantione @ 2003-10-10 19:12 UTC (permalink / raw)
To: Geert Uytterhoeven; +Cc: Marcelo Tosatti, Linux Kernel Development
On Fri, 10 Oct 2003, Geert Uytterhoeven wrote:
> This one is still needed to get atyfb compiled when Mach64 GX support is
> enabled.
Ok, go ahead! We'll also need to get that Mach64 LT fifo width set to 24
bit and the Powerbook special detection applied.
Daniël
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] atyfb updates
2003-10-10 19:12 ` Daniël Mantione
@ 2003-10-21 20:19 ` Olaf Hering
2003-10-21 20:31 ` Daniël Mantione
0 siblings, 1 reply; 6+ messages in thread
From: Olaf Hering @ 2003-10-21 20:19 UTC (permalink / raw)
To: Daniël Mantione
Cc: Geert Uytterhoeven, Marcelo Tosatti, Linux Kernel Development
On Fri, Oct 10, Daniël Mantione wrote:
>
>
> On Fri, 10 Oct 2003, Geert Uytterhoeven wrote:
>
> > This one is still needed to get atyfb compiled when Mach64 GX support is
> > enabled.
>
> Ok, go ahead! We'll also need to get that Mach64 LT fifo width set to 24
> bit and the Powerbook special detection applied.
This patch is still missing, ibook1 doesnt work (unless I missed a patch
to fix it).
--
USB is for mice, FireWire is for men!
sUse lINUX ag, nÜRNBERG
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] atyfb updates
2003-10-21 20:19 ` Olaf Hering
@ 2003-10-21 20:31 ` Daniël Mantione
0 siblings, 0 replies; 6+ messages in thread
From: Daniël Mantione @ 2003-10-21 20:31 UTC (permalink / raw)
To: Olaf Hering; +Cc: Geert Uytterhoeven, Marcelo Tosatti, Linux Kernel Development
[-- Attachment #1: Type: TEXT/PLAIN, Size: 522 bytes --]
On Tue, 21 Oct 2003, Olaf Hering wrote:
> On Fri, Oct 10, Daniël Mantione wrote:
>
> >
> >
> > On Fri, 10 Oct 2003, Geert Uytterhoeven wrote:
> >
> > > This one is still needed to get atyfb compiled when Mach64 GX support is
> > > enabled.
> >
> > Ok, go ahead! We'll also need to get that Mach64 LT fifo width set to 24
> > bit and the Powerbook special detection applied.
>
> This patch is still missing, ibook1 doesnt work (unless I missed a patch
> to fix it).
It's attached again.
Daniël
[-- Attachment #2: Type: TEXT/PLAIN, Size: 1993 bytes --]
diff -urN linux-2.4.22-bk22/drivers/video/aty/atyfb_base.c linux-2.4.22-bk22.fixed/drivers/video/aty/atyfb_base.c
--- linux-2.4.22-bk22/drivers/video/aty/atyfb_base.c Fri Sep 19 19:52:32 2003
+++ linux-2.4.22-bk22.fixed/drivers/video/aty/atyfb_base.c Fri Sep 19 19:56:23 2003
@@ -323,7 +323,8 @@
It's also often a good idea to contact ATi.
Lastly, third party board vendors might use different memory clocks
- than ATi. No examples of this have been found yet, but it is possible.
+ than ATi. An example of this is the Apple iBook1 which is handled specially
+ in aty_init.
(Daniel Mantione, 26 June 2003)
*/
@@ -356,7 +357,7 @@
/* Mach64 LT */
{ 0x4c54, 0x4c54, 0x00, 0x00, m64n_lt, 135, 63, 63, M64F_GT | M64F_INTEGRATED | M64F_GTB_DSP },
- { 0x4c47, 0x4c47, 0x00, 0x00, m64n_ltg, 230, 63, 63, M64F_GT | M64F_INTEGRATED | M64F_GTB_DSP | M64F_SDRAM_MAGIC_PLL | M64F_EXTRA_BRIGHT | M64F_LT_SLEEP | M64F_G3_PB_1024x768 },
+ { 0x4c47, 0x4c47, 0x00, 0x00, m64n_ltg, 230, 63, 63, M64F_GT | M64F_INTEGRATED | M64F_GTB_DSP | M64F_SDRAM_MAGIC_PLL | M64F_EXTRA_BRIGHT | M64F_LT_SLEEP | M64F_G3_PB_1024x768 | M64F_FIFO_24 },
/* Mach64 GTC (3D RAGE PRO) */
{ 0x4742, 0x4742, 0x00, 0x00, m64n_gtc_ba, 230, 100, 100, M64F_GT | M64F_INTEGRATED | M64F_RESET_3D | M64F_GTB_DSP | M64F_SDRAM_MAGIC_PLL | M64F_EXTRA_BRIGHT },
@@ -2075,6 +2076,14 @@
ramname = aty_ct_ram[info->ram_type];
info->dac_ops = &aty_dac_ct;
info->pll_ops = &aty_pll_ct;
+#ifdef CONFIG_ALL_PPC
+ /* The Apple iBook1 uses non-standard memory frequencies. We detect it
+ and set the frequency manually. */
+ if ((type==0x4c4e) && machine_is_compatible("PowerBook2,1")) {
+ mclk=70;
+ xclk=53;
+ };
+#endif
/*
* I disable the hack below because it is completely unreliable.
* DRAM at 67 is very well imaginable. If a chip is indeed clocked
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] atyfb updates
2003-09-23 5:54 Geert Uytterhoeven
@ 2003-09-23 6:59 ` Daniël Mantione
0 siblings, 0 replies; 6+ messages in thread
From: Daniël Mantione @ 2003-09-23 6:59 UTC (permalink / raw)
To: Geert Uytterhoeven
Cc: Marcelo Tosatti, Benjamin Herrenschmidt, Bernd Harries,
Linux Kernel Development, Linux/m68k
On Tue, 23 Sep 2003, Geert Uytterhoeven wrote:
> - aty_ld_pll() used to be global, but now it's defined for Mach64 CT only,
> causing a link failure if you don't enable Mach64 CT support.
> Since Mach64 GX never has a GTB-style DSP, make that part of the code
> Mach64 CT dependant.
Now I look at it, that code is suspicious:
> +#ifdef CONFIG_FB_ATY_CT
> + if (M64_HAS(GTB_DSP)) {
> + u8 pll_ref_div = aty_ld_pll(PLL_REF_DIV, info);
> + if (pll_ref_div) {
> + int diff1, diff2;
> + diff1 = 510*14/pll_ref_div-pll;
> + diff2 = 510*29/pll_ref_div-pll;
> + if (diff1 < 0)
> + diff1 = -diff1;
> + if (diff2 < 0)
> + diff2 = -diff2;
> + if (diff2 < diff1) {
> + info->ref_clk_per = 1000000000000ULL/29498928;
> + xtal = "29.498928";
> + }
> + }
> }
> +#endif /* CONFIG_FB_ATY_CT */
It's true that at_ld_pll should never be called on a GX boards, but only
boards with a GTB DSP can use a 29.49 XTALIN? For safety, I would also
remove the GTB_DSP check.
Daniël
^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH] atyfb updates
@ 2003-09-23 5:54 Geert Uytterhoeven
2003-09-23 6:59 ` Daniël Mantione
0 siblings, 1 reply; 6+ messages in thread
From: Geert Uytterhoeven @ 2003-09-23 5:54 UTC (permalink / raw)
To: Daniël Mantione
Cc: Marcelo Tosatti, Benjamin Herrenschmidt, Bernd Harries,
Linux Kernel Development, Linux/m68k
Hoi Daniël,
Here are some more updates for atyfb, while trying to build the Atari[*]
support (Mach64 GX only):
- ram_resv[] is needed for Mach64 GX, too.
- Move declaration of v, since it's used for generic LCD only.
- aty_ld_pll() used to be global, but now it's defined for Mach64 CT only,
causing a link failure if you don't enable Mach64 CT support.
Since Mach64 GX never has a GTB-style DSP, make that part of the code
Mach64 CT dependant.
- Move declaration of pll_ref_div, since it's used for Mach64 CT only.
- Kill warnings when ioremap()ing in the Atari case.
- Add missing xres parameter to Mach64 GX aty_var_to_pll_*() routines.
Most of these problems should show up on ia32 too if you enable Mach64 GX.
[*] Caveat: I don't have Atari hardware, just doing compile tests.
--- linux-2.4.23-pre5/drivers/video/aty/atyfb_base.c Mon Sep 22 08:43:06 2003
+++ linux-m68k-2.4.23-pre5/drivers/video/aty/atyfb_base.c Mon Sep 22 21:51:41 2003
@@ -382,6 +382,7 @@
#if defined(CONFIG_FB_ATY_GX) || defined(CONFIG_FB_ATY_CT)
static char ram_dram[] __initdata = "DRAM";
+static char ram_resv[] __initdata = "RESV";
#endif /* CONFIG_FB_ATY_GX || CONFIG_FB_ATY_CT */
#ifdef CONFIG_FB_ATY_GX
@@ -394,7 +395,6 @@
static char ram_sgram[] __initdata = "SGRAM";
static char ram_wram[] __initdata = "WRAM";
static char ram_off[] __initdata = "OFF";
-static char ram_resv[] __initdata = "RESV";
#endif /* CONFIG_FB_ATY_CT */
#ifdef CONFIG_FB_ATY_GX
@@ -487,8 +487,6 @@
static void aty_set_crtc(const struct fb_info_aty *info,
const struct crtc *crtc)
{
- u32 v;
-
aty_st_le32(CRTC_H_TOTAL_DISP, crtc->h_tot_disp, info);
aty_st_le32(CRTC_H_SYNC_STRT_WID, crtc->h_sync_strt_wid, info);
#ifdef CONFIG_FB_ATY_GENERIC_LCD
@@ -522,6 +520,7 @@
registers.
*/
if (info->lcd_table != 0) {
+ u32 v;
/* Enable/disable horizontal stretching */
v = aty_ld_lcd(HORZ_STRETCHING, info);
v = v & ~(HORZ_STRETCH_RATIO | HORZ_STRETCH_EN | AUTO_HORZ_RATIO |
@@ -1984,7 +1983,6 @@
#if defined(CONFIG_PPC)
int sense;
#endif
- u8 pll_ref_div;
u32 monitors_enabled;
info->aty_cmap_regs = (struct aty_cmap_regs *)(info->ati_regbase+0xc0);
@@ -2094,19 +2092,24 @@
info->ref_clk_per = 1000000000000ULL/14318180;
xtal = "14.31818";
- if (M64_HAS(GTB_DSP) && (pll_ref_div = aty_ld_pll(PLL_REF_DIV, info))) {
- int diff1, diff2;
- diff1 = 510*14/pll_ref_div-pll;
- diff2 = 510*29/pll_ref_div-pll;
- if (diff1 < 0)
- diff1 = -diff1;
- if (diff2 < 0)
- diff2 = -diff2;
- if (diff2 < diff1) {
- info->ref_clk_per = 1000000000000ULL/29498928;
- xtal = "29.498928";
- }
+#ifdef CONFIG_FB_ATY_CT
+ if (M64_HAS(GTB_DSP)) {
+ u8 pll_ref_div = aty_ld_pll(PLL_REF_DIV, info);
+ if (pll_ref_div) {
+ int diff1, diff2;
+ diff1 = 510*14/pll_ref_div-pll;
+ diff2 = 510*29/pll_ref_div-pll;
+ if (diff1 < 0)
+ diff1 = -diff1;
+ if (diff2 < 0)
+ diff2 = -diff2;
+ if (diff2 < diff1) {
+ info->ref_clk_per = 1000000000000ULL/29498928;
+ xtal = "29.498928";
+ }
+ }
}
+#endif /* CONFIG_FB_ATY_CT */
i = aty_ld_le32(MEM_CNTL, info);
gtb_memsize = M64_HAS(GTB_DSP);
@@ -2992,9 +2995,11 @@
* Map the video memory (physical address given) to somewhere in the
* kernel address space.
*/
- info->frame_buffer = ioremap(phys_vmembase[m64_num], phys_size[m64_num]);
+ info->frame_buffer = (unsigned long)ioremap(phys_vmembase[m64_num],
+ phys_size[m64_num]);
info->frame_buffer_phys = info->frame_buffer; /* Fake! */
- info->ati_regbase = ioremap(phys_guiregbase[m64_num], 0x10000)+0xFC00ul;
+ info->ati_regbase = (unsigned long)ioremap(phys_guiregbase[m64_num],
+ 0x10000)+0xFC00ul;
info->ati_regbase_phys = info->ati_regbase; /* Fake! */
aty_st_le32(CLOCK_CNTL, 0x12345678, info);
--- linux-2.4.23-pre5/drivers/video/aty/mach64_gx.c Sat Sep 13 16:29:48 2003
+++ linux-m68k-2.4.23-pre5/drivers/video/aty/mach64_gx.c Mon Sep 22 13:01:58 2003
@@ -124,7 +124,7 @@
}
static int aty_var_to_pll_514(const struct fb_info_aty *info, u32 vclk_per,
- u8 bpp, union aty_pll *pll)
+ u8 bpp, u32 xres, union aty_pll *pll)
{
/*
* FIXME: use real calculations instead of using fixed values from the old
@@ -325,7 +325,7 @@
*/
static int aty_var_to_pll_18818(const struct fb_info_aty *info, u32 vclk_per,
- u8 bpp, union aty_pll *pll)
+ u8 bpp, u32 xres, union aty_pll *pll)
{
u32 MHz100; /* in 0.01 MHz */
u32 program_bits;
@@ -481,7 +481,7 @@
*/
static int aty_var_to_pll_1703(const struct fb_info_aty *info, u32 vclk_per,
- u8 bpp, union aty_pll *pll)
+ u8 bpp, u32 xres, union aty_pll *pll)
{
u32 mhz100; /* in 0.01 MHz */
u32 program_bits;
@@ -595,7 +595,7 @@
*/
static int aty_var_to_pll_8398(const struct fb_info_aty *info, u32 vclk_per,
- u8 bpp, union aty_pll *pll)
+ u8 bpp, u32 xres, union aty_pll *pll)
{
u32 tempA, tempB, fOut, longMHz100, diff, preDiff;
@@ -723,7 +723,7 @@
*/
static int aty_var_to_pll_408(const struct fb_info_aty *info, u32 vclk_per,
- u8 bpp, union aty_pll *pll)
+ u8 bpp, u32 xres, union aty_pll *pll)
{
u32 mhz100; /* in 0.01 MHz */
u32 program_bits;
Gr{oetje,eeting}s,
Geert
--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org
In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2003-10-21 20:31 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-10-10 16:05 [PATCH] atyfb updates Geert Uytterhoeven
2003-10-10 19:12 ` Daniël Mantione
2003-10-21 20:19 ` Olaf Hering
2003-10-21 20:31 ` Daniël Mantione
-- strict thread matches above, loose matches on Subject: below --
2003-09-23 5:54 Geert Uytterhoeven
2003-09-23 6:59 ` Daniël Mantione
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).