aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDaniel Glöckner <daniel-gl@gmx.net>2014-03-19 05:50:41 -0400
committerMauro Carvalho Chehab <m.chehab@samsung.com>2014-04-16 17:22:48 -0400
commitc8204930b21ea4d0a5504b40a73479ae318958dd (patch)
treea61316533370f17bd6745b05f25c49eade6d1d48
parent2ff0f16ded0843e32acdbc683f9a04f07765987c (diff)
[media] bttv: Add support for PCI-8604PW
This patch adds support for the PCI-8604PW card equipped with four 878A. It is unknown who the manufacturer of this card is and no drivers were available during development of the patch. According to images found online, the card is originally sold with Linux DVR software. A CPLD on the card prevents the 878A from requesting access to the bus until an initialization sequence has been issued via GPIOs. The implemented sequence uses the minimum number of GPIOs needed to successfully unlock bus access. As there are many more GPIOs connected to the CPLD, it is very likely that some of the others have an influence on the bus arbitration scheduling. This should be investigated further in case of performance issues. The tested card contains an EEPROM on one of the 878A, but it is completely empty (i.e. contains only 0xff), so it is not possible to detect the card. Signed-off-by: Daniel Glöckner <daniel-gl@gmx.net> Tested-by: Robert Longbottom <rongblor@googlemail.com> Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
-rw-r--r--drivers/media/pci/bt8xx/bttv-cards.c110
-rw-r--r--drivers/media/pci/bt8xx/bttv.h1
2 files changed, 111 insertions, 0 deletions
diff --git a/drivers/media/pci/bt8xx/bttv-cards.c b/drivers/media/pci/bt8xx/bttv-cards.c
index d06963b3dcf3..d8ec583c154c 100644
--- a/drivers/media/pci/bt8xx/bttv-cards.c
+++ b/drivers/media/pci/bt8xx/bttv-cards.c
@@ -52,6 +52,7 @@ static void osprey_eeprom(struct bttv *btv, const u8 ee[256]);
52static void modtec_eeprom(struct bttv *btv); 52static void modtec_eeprom(struct bttv *btv);
53static void init_PXC200(struct bttv *btv); 53static void init_PXC200(struct bttv *btv);
54static void init_RTV24(struct bttv *btv); 54static void init_RTV24(struct bttv *btv);
55static void init_PCI8604PW(struct bttv *btv);
55 56
56static void rv605_muxsel(struct bttv *btv, unsigned int input); 57static void rv605_muxsel(struct bttv *btv, unsigned int input);
57static void eagle_muxsel(struct bttv *btv, unsigned int input); 58static void eagle_muxsel(struct bttv *btv, unsigned int input);
@@ -2871,6 +2872,22 @@ struct tvcard bttv_tvcards[] = {
2871 .has_remote = 1, 2872 .has_remote = 1,
2872 .has_radio = 1, 2873 .has_radio = 1,
2873 }, 2874 },
2875 /* ---- card 0xa6---------------------------------- */
2876 [BTTV_BOARD_PCI_8604PW] = {
2877 /* PCI-8604PW with special unlock sequence */
2878 .name = "PCI-8604PW",
2879 .video_inputs = 2,
2880 /* .audio_inputs= 0, */
2881 .svhs = NO_SVHS,
2882 /* The second input is available on CN4, if populated.
2883 * The other 5x2 header (CN2?) connects to the same inputs
2884 * as the on-board BNCs */
2885 .muxsel = MUXSEL(2, 3),
2886 .tuner_type = TUNER_ABSENT,
2887 .no_msp34xx = 1,
2888 .no_tda7432 = 1,
2889 .pll = PLL_35,
2890 },
2874}; 2891};
2875 2892
2876static const unsigned int bttv_num_tvcards = ARRAY_SIZE(bttv_tvcards); 2893static const unsigned int bttv_num_tvcards = ARRAY_SIZE(bttv_tvcards);
@@ -3305,6 +3322,9 @@ void bttv_init_card1(struct bttv *btv)
3305 case BTTV_BOARD_ADLINK_RTV24: 3322 case BTTV_BOARD_ADLINK_RTV24:
3306 init_RTV24( btv ); 3323 init_RTV24( btv );
3307 break; 3324 break;
3325 case BTTV_BOARD_PCI_8604PW:
3326 init_PCI8604PW(btv);
3327 break;
3308 3328
3309 } 3329 }
3310 if (!bttv_tvcards[btv->c.type].has_dvb) 3330 if (!bttv_tvcards[btv->c.type].has_dvb)
@@ -4185,6 +4205,96 @@ init_RTV24 (struct bttv *btv)
4185 4205
4186 4206
4187/* ----------------------------------------------------------------------- */ 4207/* ----------------------------------------------------------------------- */
4208/*
4209 * The PCI-8604PW contains a CPLD, probably an ispMACH 4A, that filters
4210 * the PCI REQ signals comming from the four BT878 chips. After power
4211 * up, the CPLD does not forward requests to the bus, which prevents
4212 * the BT878 from fetching RISC instructions from memory. While the
4213 * CPLD is connected to most of the GPIOs of PCI device 0xD, only
4214 * five appear to play a role in unlocking the REQ signal. The following
4215 * sequence has been determined by trial and error without access to the
4216 * original driver.
4217 *
4218 * Eight GPIOs of device 0xC are provided on connector CN4 (4 in, 4 out).
4219 * Devices 0xE and 0xF do not appear to have anything connected to their
4220 * GPIOs.
4221 *
4222 * The correct GPIO_OUT_EN value might have some more bits set. It should
4223 * be possible to derive it from a boundary scan of the CPLD. Its JTAG
4224 * pins are routed to test points.
4225 *
4226 */
4227/* ----------------------------------------------------------------------- */
4228static void
4229init_PCI8604PW(struct bttv *btv)
4230{
4231 int state;
4232
4233 if ((PCI_SLOT(btv->c.pci->devfn) & ~3) != 0xC) {
4234 pr_warn("This is not a PCI-8604PW\n");
4235 return;
4236 }
4237
4238 if (PCI_SLOT(btv->c.pci->devfn) != 0xD)
4239 return;
4240
4241 btwrite(0x080002, BT848_GPIO_OUT_EN);
4242
4243 state = (btread(BT848_GPIO_DATA) >> 21) & 7;
4244
4245 for (;;) {
4246 switch (state) {
4247 case 1:
4248 case 5:
4249 case 6:
4250 case 4:
4251 pr_debug("PCI-8604PW in state %i, toggling pin\n",
4252 state);
4253 btwrite(0x080000, BT848_GPIO_DATA);
4254 msleep(1);
4255 btwrite(0x000000, BT848_GPIO_DATA);
4256 msleep(1);
4257 break;
4258 case 7:
4259 pr_info("PCI-8604PW unlocked\n");
4260 return;
4261 case 0:
4262 /* FIXME: If we are in state 7 and toggle GPIO[19] one
4263 more time, the CPLD goes into state 0, where PCI bus
4264 mastering is inhibited again. We have not managed to
4265 get out of that state. */
4266
4267 pr_err("PCI-8604PW locked until reset\n");
4268 return;
4269 default:
4270 pr_err("PCI-8604PW in unknown state %i\n", state);
4271 return;
4272 }
4273
4274 state = (state << 4) | ((btread(BT848_GPIO_DATA) >> 21) & 7);
4275
4276 switch (state) {
4277 case 0x15:
4278 case 0x56:
4279 case 0x64:
4280 case 0x47:
4281 /* The transition from state 7 to state 0 is, as explained
4282 above, valid but undesired and with this code impossible
4283 as we exit as soon as we are in state 7.
4284 case 0x70: */
4285 break;
4286 default:
4287 pr_err("PCI-8604PW invalid transition %i -> %i\n",
4288 state >> 4, state & 7);
4289 return;
4290 }
4291 state &= 7;
4292 }
4293}
4294
4295
4296
4297/* ----------------------------------------------------------------------- */
4188/* Miro Pro radio stuff -- the tea5757 is connected to some GPIO ports */ 4298/* Miro Pro radio stuff -- the tea5757 is connected to some GPIO ports */
4189/* 4299/*
4190 * Copyright (c) 1999 Csaba Halasz <qgehali@uni-miskolc.hu> 4300 * Copyright (c) 1999 Csaba Halasz <qgehali@uni-miskolc.hu>
diff --git a/drivers/media/pci/bt8xx/bttv.h b/drivers/media/pci/bt8xx/bttv.h
index bb5da349a46e..f08126244662 100644
--- a/drivers/media/pci/bt8xx/bttv.h
+++ b/drivers/media/pci/bt8xx/bttv.h
@@ -189,6 +189,7 @@
189#define BTTV_BOARD_BT848_CAP_14 0xa3 189#define BTTV_BOARD_BT848_CAP_14 0xa3
190#define BTTV_BOARD_CYBERVISION_CV06 0xa4 190#define BTTV_BOARD_CYBERVISION_CV06 0xa4
191#define BTTV_BOARD_KWORLD_VSTREAM_XPERT 0xa5 191#define BTTV_BOARD_KWORLD_VSTREAM_XPERT 0xa5
192#define BTTV_BOARD_PCI_8604PW 0xa6
192 193
193/* more card-specific defines */ 194/* more card-specific defines */
194#define PT2254_L_CHANNEL 0x10 195#define PT2254_L_CHANNEL 0x10